Created
July 11, 2013 19:47
-
-
Save stevenworthington/5978612 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# list with character vectors | |
text <- list(a = "all day I play @sworth with R", | |
b = "all night I play @sworth with R") | |
# extract letters after "@" in a single character vector | |
sub("^.*@(\\w+).*", "\\1", text$a) | |
# extract letters after "@" in a list of character vectors | |
gsub("^.*@(\\w+).*", "\\1", text) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment