Hi, Someone with a better knowledge of errors like this one might more helpful. But as a a first start, check the structure of of coords and dat objects ( to see whether there was a mistake while reading coords.txt and dem.txt... for example headers, or separator issues), then make sure they are of the same length, i.e. nrow(dat)==nrow(coords)
In the meantime, one of the masters of R SG GEO might show up with the right answer Alex P.S.: as an advice for your next post, if you want to increase the probability of answers, provide more info. The "masters" mentioned above have a job / life and they cannot answer every single question. The other users, who might not be as skillful, but still of some help, might need complementary information, like the output of str() of the objects you are trying to convert, or what you tried, etc... In any case, try to provide a reproducible code: it will help you understand how functions are working and will avoid sending large files to all the members of the list... 2013/2/6 <fsan...@ujaen.es> > Dear R-Geo users, > > I am trying to create a SP objects using SpatialPixelsDataFrame. Next I > can see the code: > > > proj <- '+proj=lcc +ellps=WGS84 +lat_0=0 +lat_1=30 +lat_2=60 > +lon_0=-4.75' > > coords <- read.table("coords.txt") > > dat <- read.table("dem.txt") > > test <- SpatialPixelsDataFrame(points=coords, data=dat, proj4string=proj) > > Error in if (max(object@grid.index) > .NumberOfCells(object@grid)) > stop("grid.index max value too large") : > missing value where TRUE/FALSE needed > In addition: Warning messages: > 1: In points2grid(points, tolerance, round) : > grid has empty column/rows in dimension 1 > 2: In points2grid(points, tolerance, round) : > grid topology may be corrupt in dimension 1 > 3: In points2grid(points, tolerance, round) : > grid has empty column/rows in dimension 2 > 4: In points2grid(points, tolerance, round) : > grid topology may be corrupt in dimension 2 > 5: In getGridIndex(coordinates(points), grid) : NAs introduced by coercion > > What's the problem? > > PD: I can not attach data for this because the size exceeds the maximum > allowable. > > Thanks in advance. > > _______________________________________________ > R-sig-Geo mailing list > R-sig-Geo@r-project.org > https://stat.ethz.ch/mailman/listinfo/r-sig-geo > -- Alexandre Villers, PhD. Postdoctoral researcher Section of Ecology University of Turku FIN-20014 Turku, Finland Phone +358 (0)2 333 5039 [[alternative HTML version deleted]] _______________________________________________ R-sig-Geo mailing list R-sig-Geo@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-geo