r selection of character elements doesn’t work

anti_join will work well here. Once you take your sample_n, you can then anti_join this with the original dataframe ants to single out all records in ants that are not in your ants.sel. Check ?anti_join for more info.

library(dplyr)

ants<-read.table("https://raw.githubusercontent.com/Leprechault/trash/main/test_ant.txt",h=F) 

ants.sel<-sample_n(ants,195, replace = FALSE)

rest.ants <- anti_join(ants, ants.sel)

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top