I have a data frame of chemical concentrations that are measurements taken from 12 locations all in the same vicinity. I have manually assigned x and y coordinates to each location (on a 0 to 20 scale) and each observation has a concentration value. a small sample is given below:
dat<-data.frame(x = rep(c(2, 5.5, 8, 14), each=2), y = rep(c(3, 9, 14, 17), 2), z = log(rnorm(8, 10, .75))
I want to display the concentration over space in an image by sort of averaging over the 2 dimensions so as to fill the whole plot space. I think what I want to do here is a contour plot, but I can't figure out how to make this work, so maybe this isn't the right kind of data for such a plot? I'm trying to implement this in R, so any R advice on how to do this would be awesome.