Hi Robert and Geno, thank you for your help i tried both solutions but none of them worked. when i transformed the grid raster to tif in the second method, instead of having NAs i had 128 as value in all the attribute table
On Tue, Apr 9, 2013 at 9:45 AM, Robert J. Hijmans <[email protected]>wrote: > Eliane, > > I think that is a bug (even though it should not affect the results as I > take it this does not stop the function). I think it will be gone withe > next version of raster. You can probably also avoid it by doing > > a<-"C:/QA_soil/inttotalrain" > aa<-raster(a, RAT=FALSE) > > > On Mon, Apr 8, 2013 at 4:44 AM, Gonzalez-Mirelis Genoveva < > [email protected]> wrote: > >> Hi Eliane, >> Not sure that it will work, but I would recommend converting your raster >> layers to .tiff files prior to importing them into R. > > > Why create an unnecessary copy of the data? > > >> Then try >> >> aa<-raster('C:/QA_soil/inttotalrain.tif',datatype=INT1U) >> > >> (note the file extension, and data type argument). >> > > function 'raster' does not have a 'datatype' argument, so there is no > point in supplying it. > > > >> Good luck! >> Geno >> >> hi list, >> >> i am using R 2.15.3 (64 bit) >> >> i want to stack several raster objects to use for prediction purposes. All >> my raster files are integer and has attribute tables and none has NA >> values. ( i checked it in arcgis).however when i try to import the raster >> to R and check the values in each raster, the only values that i get are >> NAs. I hope the example below will clarify more the problem i am facing. >> Has anymore encountered a similar problem before? i appreciate any >> suggestion. Thanks in advance. >> >> PS: i am able to stack the raster files as well as plot them or compare >> them and even predict with it. however with predict i get the message:" >> Error in .getRat(ratvalues, ratnames, rattypes) : >> argument "rattypes" is missing, with no default" >> >> example: >> >> > a<-"C:/QA_soil/inttotalrain" >> > aa<-raster(a) >> > head(aa) >> 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 >> 1 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA >> 2 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA >> 3 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA >> 4 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA >> 5 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA >> 6 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA >> 7 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA >> 8 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA >> 9 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA >> 10 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA >> > >> > tail(aa) >> 15310 15311 15312 15313 15314 15315 15316 15317 15318 15319 15320 >> 15321 >> 18689 NA NA NA NA NA NA NA NA NA NA NA >> NA >> 18690 NA NA NA NA NA NA NA NA NA NA NA >> NA >> 18691 NA NA NA NA NA NA NA NA NA NA NA >> NA >> 18692 NA NA NA NA NA NA NA NA NA NA NA >> NA >> 18693 NA NA NA NA NA NA NA NA NA NA NA >> NA >> 18694 NA NA NA NA NA NA NA NA NA NA NA >> NA >> 18695 NA NA NA NA NA NA NA NA NA NA NA >> NA >> 18696 NA NA NA NA NA NA NA NA NA NA NA >> NA >> 18697 NA NA NA NA NA NA NA NA NA NA NA >> NA >> 18698 NA NA NA NA NA NA NA NA NA NA NA >> NA >> 15322 15323 15324 15325 15326 15327 15328 15329 >> 18689 NA NA NA NA NA NA NA NA >> 18690 NA NA NA NA NA NA NA NA >> 18691 NA NA NA NA NA NA NA NA >> 18692 NA NA NA NA NA NA NA NA >> 18693 NA NA NA NA NA NA NA NA >> 18694 NA NA NA NA NA NA NA NA >> 18695 NA NA NA NA NA NA NA NA >> 18696 NA NA NA NA NA NA NA NA >> 18697 NA NA NA NA NA NA NA NA >> 18698 NA NA NA NA NA NA NA NA >> > > aa >> class : RasterLayer >> dimensions : 18698, 15329, 286621642 (nrow, ncol, ncell) >> resolution : 10, 10 (x, y) >> extent : 685798.3, 839088.3, 3658405, 3845385 (xmin, xmax, ymin, >> ymax) >> coord. ref. : +proj=utm +zone=36 +ellps=WGS84 +towgs84=0,0,0,0,0,0,0 >> +units=m +no_defs >> data source : C:\QA_soil\inttotalrain >> names : inttotalrain >> values : 6, 1467 (min, max) >> attributes : >> ID COUNT >> from: 6 285 >> to : 1467 55 >> >> >> On Tue, Feb 19, 2013 at 3:08 PM, Charbel Eliane <[email protected]> >> wrote: >> >> > Dear list, >> > >> > I have 2 raster that represent exactly the same area. the 2 raster have >> > the same coordinate system and the same resolution but 2 different >> origins >> > and extents. They are both "float". My goal is to perfectly overlap the >> 2 >> > rasters, so i can use it for analysis. >> > I have tried to use resample in R, to resample one raster using the >> other >> > but the output raster doesn't perfectly overlap with the raster that i >> used >> > to resample to [y in resample (x,y)]. the dim of the resultant resampled >> > raster and the y raster are the same except for the number of cells. >> > >> > I will be grateful for any help. >> > >> > >> > >> > >> > >> >> [[alternative HTML version deleted]] >> >> >> >> ------------------------------ >> >> _______________________________________________ >> R-sig-Geo mailing list >> [email protected] >> https://stat.ethz.ch/mailman/listinfo/r-sig-geo >> >> >> End of R-sig-Geo Digest, Vol 116, Issue 7 >> >> _______________________________________________ >> R-sig-Geo mailing list >> [email protected] >> https://stat.ethz.ch/mailman/listinfo/r-sig-geo >> > > [[alternative HTML version deleted]] _______________________________________________ R-sig-Geo mailing list [email protected] https://stat.ethz.ch/mailman/listinfo/r-sig-geo
