I have a list named coord_pts with 4 SpatialPointsDataFrame files and a list with 14 raster. What I want is to extract the data from the 14 raster for the coordinates of each one of the SpatialpointsDataFrame files. I tried to make a nested for loop but I am only getting the output for the first object of coord_pts.
crops<-list()
extract<-list()
for(j in 1:length(coord_pts)){
for(i in 1:length(Temp_raster)){
extract[[j*i]]<-extract(Temp_raster[[i]],coord_pts[[j]], method='simple')
crops[[j]]<-data.frame(c(extract))
}
colnames(crops)<-c('MeanTemp', 'Prec', 'Temp1', 'Temp10', 'Temp11', 'Temp12', 'Temp2', 'Temp3', 'Temp4', 'Temp5', 'Temp6', 'Temp7', 'Temp8', 'Temp9')
}