Dear list, This seems like a very simple problem, but I am failing to loose a dimension (I think). I have list, like this:
... [2072] "!H*L" "L%" "%L" "H*L" "L%" "%L" "H*L" "H*L" "L%" "%L" "H*L" "!H*L" "L%" "%L" "%L" "%L" "%L" "H*L" "!H*L" [2091] "L%" "H*" "%L" "H*L" "L_%" "%L" "%H" "%H" "!H*L" "%H" "H*" "%H" "%H" "H%" "H*" "!H*L" "H*L" "!H*L" "H*" [2110] "H*L" "L_%" "%L" "%L" "H*L" "L*H" "H%" "%H" "L*H" "H%" "%H" "H*L" "%H" "%L" "H*L" "%H" "%L" "H*L" "L%" [2129] "%L" "H*L" "!H*L" "L%" "%L" "H*L" "%L" "H*L" "%H" "H*L" "%L" What I would like to do is 1) Remove all the %!*0 characters 2) Get the last character of what remains for each string 3) Get a list, comparable to the one above, but with only one character (so, the last three data points would become list(H,L,L) I tried > strsplit(gsub("[*_!%0]*","",TADescSub$ExtendedLabel,""),"") but that gives me something like: ... [[2136]] [1] "H" "L" [[2137]] [1] "H" [[2138]] [1] "H" "L" [[2139]] [1] "L" So, what am I doing wrong? /Fredrik -- "Life is like a trumpet - if you don't put anything into it, you don't get anything out of it." ______________________________________________ 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.