Dear all,

I would appreciate anyone's help on this.
I constructed a dataframe from several raster layers and compiled these
layers using the 'stack' and 'brick' function in 'raster' package

s <- stack(r1,r2,r3,r4,r5)
b <- brick(s)

I converted this into a matrix and stored this as a dataframe:

mb <- as.matrix(b)
write.csv(mb,"C:/Source/mb.csv")

This new dataframe (mb) lists all the cells as rows and all the attributes
in my raster layers (r1-r5) as columns
The first column in mb also provides a number to each cell which I assume
acts as a form of identification number to every grid cell
I used mb in an R-coded model which simulates land cover change, in which I
selected the most suitable cells for land use conversion
My final dataframe (df) has a lower number of rows compared to mb but has
preserved the identification number of each grid cell.

My question is: Can I map out the cells in df by tracing its identification
number back to the original dataframe mb?
I have been trying to figure this out and will appreciate any suggestions.

Many thanks and best regards,
Janice Lee

        [[alternative HTML version deleted]]

_______________________________________________
R-sig-Geo mailing list
[email protected]
https://stat.ethz.ch/mailman/listinfo/r-sig-geo

Reply via email to