Hi, im trying to create a 3-D interpretation of a geological fault using the akima package. But my code fails below highlighted in red: Does anyone have any ideas why this is. Thanks dat<-read.delim("D:\\fault.txt",header=T,sep=",") library(rgl) # data rgl.spheres(dat$X,dat$Z , dat$Y,1,color="red") rgl.bbox() # bivariate linear interpolation # interp: akima.li <- interp(dat$X, dat$Y, dat$Z, xo=seq(min(dat$X), max(dat$X), length = 100), yo=seq(min(dat$Y), max(dat$Y), length = 100)) This is my error: Error in interp.old(x, y, z, xo = xo, yo = yo, ncp = 0, extrap = extrap, : duplicate data points: need to set 'duplicate = ..' # interp surface: rgl.surface(akima.li$X,akima.li$Y,akima.li$Z,color="green",alpha=c(0.5)) # interpp: akima.p <- interpp(dat$X, dat$Y, dat$Z, runif(200,min(dat$X),max(dat$X)), runif(200,min(dat$Y),max(dat$Y))) # interpp points: rgl.points(akima.p$X,akima.p$Z , akima.p$Y,size=4,color="yellow") # bivariate spline interpolation # data rgl.spheres(dat$X,dat$Z ,dat$Y,0.5,color="red") rgl.bbox() # bivariate cubic spline interpolation # interp: akima.si <- interp(dat$X, dat$Y, dat$Z, xo=seq(min(dat$X), max(dat$X), length = 100), yo=seq(min(dat$Y), max(dat$Y), length = 100), linear = FALSE, extrap = TRUE) -- Shane [[alternative HTML version deleted]]
Hi Shane, On Tue, Dec 10, 2013 at 10:35 AM, Shane Carey <careyshan at gmail.com> wrote:> Hi, > > im trying to create a 3-D interpretation of a geological fault using > the akima package. But my code fails below highlighted in red: > Does anyone have any ideas why this is.This is a plain-text email list, so no highlighting in red is available. More importantly, you should take a look at: http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example and provide a simple example with data that demonstrates your problem. Sarah> > Thanks > > dat<-read.delim("D:\\fault.txt",header=T,sep=",") > library(rgl) > # data > rgl.spheres(dat$X,dat$Z , dat$Y,1,color="red") > rgl.bbox() > # bivariate linear interpolation > # interp: > akima.li <- interp(dat$X, dat$Y, dat$Z, > xo=seq(min(dat$X), max(dat$X), length = 100), > yo=seq(min(dat$Y), max(dat$Y), length = 100)) > > This is my error: > Error in interp.old(x, y, z, xo = xo, yo = yo, ncp = 0, extrap = extrap, : > duplicate data points: need to set 'duplicate = ..' > > # interp surface: > rgl.surface(akima.li$X,akima.li$Y,akima.li$Z,color="green",alpha=c(0.5)) > # interpp: > akima.p <- interpp(dat$X, dat$Y, dat$Z, > runif(200,min(dat$X),max(dat$X)), > runif(200,min(dat$Y),max(dat$Y))) > # interpp points: > rgl.points(akima.p$X,akima.p$Z , akima.p$Y,size=4,color="yellow") > # bivariate spline interpolation > # data > rgl.spheres(dat$X,dat$Z ,dat$Y,0.5,color="red") > rgl.bbox() > # bivariate cubic spline interpolation > # interp: > akima.si <- interp(dat$X, dat$Y, dat$Z, > xo=seq(min(dat$X), max(dat$X), length = 100), > yo=seq(min(dat$Y), max(dat$Y), length = 100), > linear = FALSE, extrap = TRUE) > > >-- Sarah Goslee http://www.functionaldiversity.org
Hi, I have since solved that problem, but now R keeps crashing. I have over 20,000 points. Can R handle that amount? Cheers On Tue, Dec 10, 2013 at 3:35 PM, Shane Carey <careyshan@gmail.com> wrote:> Hi, > > im trying to create a 3-D interpretation of a geological fault using > the akima package. But my code fails below highlighted in red: > Does anyone have any ideas why this is. > > Thanks > > dat<-read.delim("D:\\fault.txt",header=T,sep=",") > library(rgl) > # data > rgl.spheres(dat$X,dat$Z , dat$Y,1,color="red") > rgl.bbox() > # bivariate linear interpolation > # interp: > akima.li <- interp(dat$X, dat$Y, dat$Z, > xo=seq(min(dat$X), max(dat$X), length = 100), > yo=seq(min(dat$Y), max(dat$Y), length = 100)) > > This is my error: > Error in interp.old(x, y, z, xo = xo, yo = yo, ncp = 0, extrap = extrap, > : > duplicate data points: need to set 'duplicate = ..' > > # interp surface: > rgl.surface(akima.li$X,akima.li$Y,akima.li$Z,color="green",alpha=c(0.5)) > # interpp: > akima.p <- interpp(dat$X, dat$Y, dat$Z, > runif(200,min(dat$X),max(dat$X)), > runif(200,min(dat$Y),max(dat$Y))) > # interpp points: > rgl.points(akima.p$X,akima.p$Z , akima.p$Y,size=4,color="yellow") > # bivariate spline interpolation > # data > rgl.spheres(dat$X,dat$Z ,dat$Y,0.5,color="red") > rgl.bbox() > # bivariate cubic spline interpolation > # interp: > akima.si <- interp(dat$X, dat$Y, dat$Z, > xo=seq(min(dat$X), max(dat$X), length = 100), > yo=seq(min(dat$Y), max(dat$Y), length = 100), > linear = FALSE, extrap = TRUE) > > > > > > > -- > Shane >-- Shane [[alternative HTML version deleted]]
The error says you have duplicate points in dat so you need to set duplicate= to tell interp() how to handle them. ?interp ------------------------------------- David L Carlson Department of Anthropology Texas A&M University College Station, TX 77840-4352 -----Original Message----- From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org] On Behalf Of Shane Carey Sent: Tuesday, December 10, 2013 9:36 AM To: r-help at r-project.org Subject: [R] 3-D interpretation Hi, im trying to create a 3-D interpretation of a geological fault using the akima package. But my code fails below highlighted in red: Does anyone have any ideas why this is. Thanks dat<-read.delim("D:\\fault.txt",header=T,sep=",") library(rgl) # data rgl.spheres(dat$X,dat$Z , dat$Y,1,color="red") rgl.bbox() # bivariate linear interpolation # interp: akima.li <- interp(dat$X, dat$Y, dat$Z, xo=seq(min(dat$X), max(dat$X), length = 100), yo=seq(min(dat$Y), max(dat$Y), length = 100)) This is my error: Error in interp.old(x, y, z, xo = xo, yo = yo, ncp = 0, extrap extrap, : duplicate data points: need to set 'duplicate = ..' # interp surface: rgl.surface(akima.li$X,akima.li$Y,akima.li$Z,color="green",alpha =c(0.5)) # interpp: akima.p <- interpp(dat$X, dat$Y, dat$Z, runif(200,min(dat$X),max(dat$X)), runif(200,min(dat$Y),max(dat$Y))) # interpp points: rgl.points(akima.p$X,akima.p$Z , akima.p$Y,size=4,color="yellow") # bivariate spline interpolation # data rgl.spheres(dat$X,dat$Z ,dat$Y,0.5,color="red") rgl.bbox() # bivariate cubic spline interpolation # interp: akima.si <- interp(dat$X, dat$Y, dat$Z, xo=seq(min(dat$X), max(dat$X), length = 100), yo=seq(min(dat$Y), max(dat$Y), length = 100), linear = FALSE, extrap = TRUE) -- Shane [[alternative HTML version deleted]] ______________________________________________ R-help at r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.