I took a sample of a spatial polygon dataframe with 2256 elements using:
valdata <- ref_10[sample(ref_10@data$ID, length(ref_10)/3),]
now I would like to sort my new spatial dataframe by my ID-colum and always get this error message:
valdata[sort(valdata@data$ID),]
Error in valdata[sort(valdata@data$ID), ] : cannot get a slot ("Polygons") from an object of type "NULL"