0
votes

I have two files:

  • a RasterStack (with 2 layers, each represents a raster map) named m_stack;
  • A SpatialPointsDataFrame (points) named shph (with columns populated with data);

i can extract a buffer for each point (bdata) for each layer by doing:

bdata<-extract(m_stack,shph,buffer=60, cellnumbers=T)

bdata returns a list, row id's of the list are set automatically.

my problem is here: i need row id's of bdata to be id's from shph (obtained from a column in shph file named shph@data$ID. Any suggestion how to do this?

Kind regards, Manuel

1

1 Answers

0
votes

The list that is returned has no row numbers. It is a list! Neither do the matrices in the list have row numbers. To name the list elements you can do

names(bdata) <- shph$ID  

Does that answer your question?