Hi I have animal abundance data collected from quadrats with 4 quadrats per station.
In the field, some quadrats were missed.
ex
St/ Q /Anim1 abundance /Anim 2 abundance/....etc
1 /1 /
1 /2 /
1 /3 /
1 /4 /
2 /1 /
2 /2 /
2 /4 /
3 /1 /
3 /2 /
3 /3 /
3 /4 /
Station 2 is missing quadrat 3. I would like to remove all rows (including animal abundance data) associated with station 2 from further analysis. I would like to do this in a function as I have multiple large csv files I need to clean up.
I tried subset and for loops but struggling with both
Thank you for your time
******update I'm working with this qc_Large29 <- Large29[Large29[, 5]>=4,]
which gives me all the 4th quadrats from each station. Is there a way to add a length() to it so that the new dataframe will only be the data associated with stations that have 4 quadrats?
**********update
dput(Large29[1:30,1:5])
structure(list(FID = 652:681, areaContro = c(29L, 29L, 29L, 29L,
29L, 29L, 29L, 29L, 29L, 29L, 29L, 29L, 29L, 29L, 29L, 29L, 29L,
29L, 29L, 29L, 29L, 29L, 29L, 29L, 29L, 29L, 29L, 29L, 29L, 29L
), areaShortN = structure(c(1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L), .Label = "CAIIN", class = "factor"), station = c(1L,
1L, 1L, 1L, 2L, 2L, 2L, 2L, 3L, 3L, 3L, 3L, 4L, 4L, 4L, 4L, 5L,
5L, 5L, 5L, 6L, 6L, 6L, 6L, 7L, 7L, 7L, 7L, 8L, 8L), quadrat = c(1L,
2L, 3L, 4L, 1L, 2L, 3L, 4L, 1L, 2L, 3L, 4L, 1L, 2L, 3L, 4L, 1L,
2L, 3L, 4L, 1L, 2L, 3L, 4L, 1L, 2L, 3L, 4L, 1L, 2L)), .Names = c("FID",
"areaContro", "areaShortN", "station", "quadrat"), row.names = c(NA,
30L), class = "data.frame")
>