-1

I created an sf object from a point shapefile and would like to create a new object by choosing points with certain attributes only. In that case, only those points which have "Survey Start" in the column Subcategor. Shifting thinking from sp/rgdal is hard. Apologies this example is not reproducible, but I hope it is simple enough to answer.

data_pts <- st_read("Point.shp")

# I tried two approaches. More traditional, and something tidyvers-ey
field_id_pts <- data_pts[data_pts$Subcategor == "Survey Start",]
field_id_pts <- data_pts %>% select(Subcategor == "Survey Start")

None of them work. Thanks in advance for help.

MIH
  • 989
  • 1
  • 12
  • 23

1 Answers1

1

You could use subset to easily select the points based on the "Subcategor" variable.

field_id_pts <- subset(data_pts, data_pts$Subcategor == "Survey Start")