I have a large dataset (7000+ rows and 42 columns). I want to subset this dataset using specific IDs that each row has. There are 178 IDs I'd like to use and its possible that the IDs occur more than once. I've tried using "filter" from dplyr
but I keep getting this error:
longer object length is not a multiple of shorter object length"
Edit: Sorry I'm still new to most of this, and to this site.
Here is the code I used to try and filter out the specific IDs:
df2 <- filter(df, df$ID==c(2983, 3413, 1266, 3049, 1237,[...], 1002, 1003, 4001)) #the elipsis is there because otherwise code would be too long for this post.
It produces this error:
Warning messages:
1: In `==.default`(df$ID, c(2983, 3413, 1266, 3049, 1237, :
longer object length is not a multiple of shorter object length
2: In is.na(e1) | is.na(e2) :
longer object length is not a multiple of shorter object length
Edit 2: Thanks for all the help, I was able to fix my issue. I appreciate the feedback and hopefully will be able to be more clear if I have questions for this site in the future.