I want to create a contour of the variable z with data x, y, z. However, it seems to us that we need to provide data in an increasing order.
I tried using some kind of code, but it gave me an error.
I tried the following code: Trial 1:
age2100 <- read.table("temp.csv",header=TRUE,sep=",") x <- age2100$x y <- age2100$y z <- age2100$z contour(x,y,z,add=TRUE,col="black")
I got the following error:
Error in contour.default(x, y, z, add = TRUE, col = "black") : increasing 'x' and 'y' values expected
Then I tried using ggplot2 to create a path. I used the following code:
library("ggplot2") library("MASS") library("rgdal") library("gpclib") library("maptools") age2100 <- read.table("temp.csv",header=TRUE,sep=",") v <- ggplot(age2100, aes(age2100$x, age2100$y,z=age2100$z))+geom_contour() v
I got the following error:
Warning message:
Not possible to generate contour data
Please find the following data https://www.dropbox.com/s/mg2bo4rcr6n3dks/temp.csv
Can someone tell me how to create contour data from third variable (z) from temp.csv? I need to do this many times, so I'm trying to do it in R instead of Arcgis.