> How would I extract from it all strings that start with E10?

Hi Ana,

Here's a simple solution:

    x <- c ("P24601", "E101", "E102", "3.141593",
        "E101", "xE101", "e103", " E104 ")

    x [substring (x, 1, 3) == "E10"]

You' will need to replace x with another *character vector*.
(As touched on earlier, a data.frame may cause some problems).

Here's some variations:

    unique (x [substring (x, 1, 3) == "E10"])

    y <- toupper (x)
    y [substring (y, 1, 3) == "E10"]

    y <- trimws (x)
    y [substring (y, 1, 3) == "E10"]

______________________________________________
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