Hello all,
I have a column within a short df containing many different names (in fact a merge of “serial-number age”):
>small_df$animals
[1] x12288 7 x12287 1 x12532 1 x17943 1 x62618 9 x12008 5 x52147 4 x92288 3
…
[5004] x12988 2 x55521 1 x12903 4 x15288 1 x52364 7 x10005 2 x12288 6
I’m trying to subset a different data-frame (“full_data”), so that it a specific column within the large if the name doesn’t appear in the first column it will be removed.
I tried this:
Column for criteria
>vector = as.vector((small_df$animals))
Keep only what matches in ‘animals’ column in the large and the column defined earlier:
>filtered_animals = subset(large_df [large_df$animals %in% vector,])
But I get a new data frame with zero observation.
If I could type in the vector manually I would (e.g., == %in% c(“x12288 7”, “x12287 1”, “x12532 1”,…) I would but the list is way too long.
Any help would be greatly appreciated.
--
You received this message because you are subscribed to the Google Groups "Israel R User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to israel-r-user-group+unsub...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.