[R] question about string handling....

Wu Gong wg2f at mtmail.mtsu.edu
Wed Jul 14 22:11:05 CEST 2010


Try this:

text <- 'var1 var2
1 ab_c_(ok)
2 okf789(db)_c
3 jojfiod(90).gt
4 "ij"_(78)__op
5 (iojfodjfo)_ab'

df <- read.table(textConnection(text), head=T, sep=" ",quote="")
df$var3 <- gsub("(.*\\()(.*)(\\).*)","\\2",df$var2)


-----
A R learner.
-- 
View this message in context: http://r.789695.n4.nabble.com/question-about-string-handling-tp2289178p2289327.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list