Hello, this command was running for more than 2 hours grep("E10",tot,value=T) and no output
and this command df1 <- tot %>% filter_all(any_vars(grepl( '^E10', .))) gave me a subset (a data frame) of tot where ^E10 what I need is just a vector or all values in tot which start with E10. Thanks Ana On Fri, May 15, 2020 at 12:13 PM Jeff Newmiller <jdnew...@dcn.davis.ca.us> wrote: > > Read about regular expressions... they are extremely useful. > > df1 <- tot %>% filter_all(any_vars(grepl( '^E10', .))) > > It is bad form not to put spaces around the <- assignment. > > > On May 15, 2020 10:00:04 AM PDT, Ana Marija <sokovic.anamar...@gmail.com> > wrote: > >Hello, > > > >I have a data frame: > > > >> dim(tot) > >[1] 502536 1093 > > > >How would I extract from it all strings that start with E10? > > > >I know how to extract all rows that contain with E10 > >df0<-tot %>% filter_all(any_vars(. %in% c('E10'))) > >> dim(df0) > >[1] 5105 1093 > > > >but I just need a vector of strings that start with E10... > >it would look something like this: > > > >[1] "E102" "E109" "E108" "E103" "E104" "E105" "E101" "E106" "E107" > > > >Thanks > >Ana > > > >______________________________________________ > >R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see > >https://stat.ethz.ch/mailman/listinfo/r-help > >PLEASE do read the posting guide > >http://www.R-project.org/posting-guide.html > >and provide commented, minimal, self-contained, reproducible code. > > -- > Sent from my phone. Please excuse my brevity. ______________________________________________ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.