Suppose I have a character vector as follows:

> aa
[1] "1 (472)" "2 (445)" "3 (431)" "3 (431)" "5 (415)" "6 (405)" "7 (1)”

I want to extract the values within parentheses and place them into a column 
that is numeric. The values in aa vary in length and so using strsplit() won’t 
work because the positions change. Is there are better pattern matching 
function that I can use to grab values from within the parentheses?


        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
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