Dear Ana

Would it not be possible to use grep instead of grepl and get the values using the value = TRUE parameter?

Michael

On 10/04/2020 17:15, Ana Marija wrote:
Hello,

Hello,

I have a data frame (tot) with about 2000 columns. How can I extract
from it all strings that start with E14?

I tried this:
e14 <- sapply(tot, function(x) grepl("^E14", x))

but this returns me just TRUE and FALSE vector, how do I get actual
strings that start with E14?

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.


--
Michael
http://www.dewey.myzen.co.uk/home.html

______________________________________________
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.

Reply via email to