I have a raster (which I called glc), which I read into R as a raster with "raster.create.from.file" from the raster package (R-forge). Values in glc range between 1 and 27 (whole numbers only). I'd like to extract all cells with a value of 1 to create a new raster with only the cells that have a value of 1, or to extract the xy values of all raster cells with a value of 1. Could you please help me along? I have tried using several of the functions in the raster help package, e.g. "raster.get.xy.from.cell", but do not know how to specify glc=1. I have tried to use e.g.: glc1<-raster.get.xy.from.cell(glc,glc==1) glc1<-raster.get.xy.from.cell(glc, glc[which(glc==1)])
The reason I specifically used the raster package to read in my files is because I have been unable to read my ascii files (which are very big) into R using read.asciigrid because the ascii files are so big (and none of the various suggestions I found in various R-help archives that I found for increasing memory size were sufficient to allow me to read in my ascii files). Therefore if alternatively somebody knows of another way to read raster or ascii files into R, which would make it easier to conduct the extraction I mentioned in my first paragraph, I would appreciate any suggestions. Regards, Michelle ______________________________________________ R-help@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.