I have a very similar question to that posted here: Subsetting for a minimum number of locations for MCP in R
And here Subset data frame based on number of rows per group
Where I'm trying to subset a dataset dropping all individuals with less than 5 observations.
df <- data.frame(name = c("a", "a", "a", "a", "a", "a", "b", "b", "b"), x = 1:9)
In this case, retain only the records for individual 'a'
I manage to subset my dataset fine with any of the solutions posted in the links above, but it still retains all the individuals' names with 0 records
e.g. in my dataset, table(df$name)
shows
a b
6 0
Instead, I need to get rid of those individuals alltogether from the dataset. (otherwise I still get the error line " At least 5 relocations are required to fit an home range", because the names with less than 5 are still retained in there)
The trick that does it to run this line before:
df$name<-as.numeric(df$name)
a
6
But in this way I lose the labels for the individuals, which i need for the rest of my analyses.
Any suggestions? thanks