Hi, I'm a new R user. My goal is to do a variogram using geoR. I started by trying to do the example in the geoR Illustrative Session using my own data. I am able to read in my Ascii data using: D <- matrix(scan("file.dat", n=530*3), 530,3, byrow=TRUE). Then I use: as.geodata(D, coords.col=1:2, data.col=3) to make the object D geodata. I check the descriptive statistics, and my data file appears to be in order. But when I try the following command: cloud1<- variog(D, option="cloud", max.dist=1), I get this error: Error in array(x, c(length(x), 1), if (!is.null(names(x))) list (names(x), : attempt to set an attribute on NULL I get that same error message when I try different arguments with the variog command. Can someone help? Thanks, Sharon
Is `D' the original matrix or a `geodata' object? You need to assign the output of `as.geodata to another variable and pass that to `variog'. For example, B <- as.geodata(D, coords.col=1:2, data.col=3) variog(B, option = "cloud", max.dist = 1) It seems like the problem is that you're passing the matrix `D' into `variog'. -roger _______________________________ UCLA Department of Statistics rpeng at stat.ucla.edu http://www.stat.ucla.edu/~rpeng On Mon, 10 Feb 2003, Sharon Lambert wrote:> Hi, > > I'm a new R user. My goal is to do a variogram using geoR. > I started by trying to do the example in the geoR Illustrative Session > using my own data. > > I am able to read in my Ascii data using: D <- matrix(scan("file.dat", > n=530*3), 530,3, byrow=TRUE). > > Then I use: as.geodata(D, coords.col=1:2, data.col=3) to make the > object D geodata. > > I check the descriptive statistics, and my data file appears to be in > order. > > But when I try the following command: cloud1<- variog(D, > option="cloud", max.dist=1), I get this error: > Error in array(x, c(length(x), 1), if (!is.null(names(x))) list > (names(x), : > attempt to set an attribute on NULL > > I get that same error message when I try different arguments with the > variog command. > > Can someone help? > > Thanks, > > Sharon > > ______________________________________________ > R-help at stat.math.ethz.ch mailing list > http://www.stat.math.ethz.ch/mailman/listinfo/r-help >
THANKS! This was exactly the problem. Sharon ----- Original Message ----- From: Roger Peng <rpeng at stat.ucla.edu> Date: Monday, February 10, 2003 8:31 pm Subject: Re: [R] geoR question from new R user> Is `D' the original matrix or a `geodata' object? You need to > assign the > output of `as.geodata to another variable and pass that to > `variog'. For > example, > > B <- as.geodata(D, coords.col=1:2, data.col=3) > variog(B, option = "cloud", max.dist = 1) > > It seems like the problem is that you're passing the matrix `D' into > `variog'. > > -roger > _______________________________ > UCLA Department of Statistics > rpeng at stat.ucla.edu > http://www.stat.ucla.edu/~rpeng > > On Mon, 10 Feb 2003, Sharon Lambert wrote: > > > Hi, > > > > I'm a new R user. My goal is to do a variogram using geoR. > > I started by trying to do the example in the geoR Illustrative > Session > > using my own data. > > > > I am able to read in my Ascii data using: D <- > matrix(scan("file.dat", > > n=530*3), 530,3, byrow=TRUE). > > > > Then I use: as.geodata(D, coords.col=1:2, data.col=3) to make > the > > object D geodata. > > > > I check the descriptive statistics, and my data file appears to > be in > > order. > > > > But when I try the following command: cloud1<- variog(D, > > option="cloud", max.dist=1), I get this error: > > Error in array(x, c(length(x), 1), if (!is.null(names(x))) list > > (names(x), : > > attempt to set an attribute on NULL > > > > I get that same error message when I try different arguments > with the > > variog command. > > > > Can someone help? > > > > Thanks, > > > > Sharon > > > > ______________________________________________ > > R-help at stat.math.ethz.ch mailing list > > http://www.stat.math.ethz.ch/mailman/listinfo/r-help > > > >