[R] Splitting a character vector.
jrkrideau at inbox.com
Sat Jul 7 23:37:43 CEST 2012
I am lousy at simple regex and I have not found a solution to a simple problem.
I have a vector with some character values that I want to split.
dd1 <- c( "XXY (mat harry)","XXY (jim bob)", "CAMP (joe blow)", "ALP (max jack)")
dd2 <- data.frame( xx = c("XXY", "XXY", "CAMP", "ALP"), yy = c("mat harry", "jim bob" , "joe blow", "max jack"))
I thought I should be able to split the characters with strsplit but either I am misunderstanding the function or don't know how to escape a "(" properly in an effort to at least get "XXY" "(mat harry)"
Any pointers would be appreciated
Kingston ON Canada
FREE 3D MARINE AQUARIUM SCREENSAVER - Watch dolphins, sharks & orcas on your desktop!
More information about the R-help