[R] How to extract value from image in R ?

Michael Sumner mdsumner at gmail.com
Thu May 16 17:04:32 CEST 2013


tab <- cbind(coordinates(r), as.data.frame(r))

should do it.

Also, R-Sig-Geo is a mailing list specific for this topic

On Fri, May 17, 2013 at 12:21 AM, Kristi Glover
<kristi.glover at hotmail.com> wrote:
> Hi R User,
> I am wondering how I can extract the value and want to see the value in table. Is there way?
>
> suppose I do have image  (raster package)
>
>> r
> class       : RasterLayer
> dimensions  : 192, 186, 35712  (nrow, ncol, ncell)
> resolution  : 0.5, 0.5  (x, y)
> extent      : -125, -32, -56, 40  (xmin, xmax, ymin, ymax)
> coord. ref. : +proj=longlat +datum=WGS84 +ellps=WGS84 +towgs84=0,0,0
> data source : in memory
> names       : layer
> values      : 3.523291e-09, 0.96676  (min, max)
>
> I want to see these values in column. if possible, also want to see XY as well as.
> it must be busy, but I could not figure it out.
>
> thanks
>
>
>         [[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.



-- 
Michael Sumner
Hobart, Australia
e-mail: mdsumner at gmail.com



More information about the R-help mailing list