Re: [R] the hat ^ in regular expression

2010-02-09 Thread kMan
...@gmail.com] Sent: Monday, February 08, 2010 6:01 AM To: christophe dutang Cc: r-help@r-project.org Subject: Re: [R] the hat ^ in regular expression Try this: library(gsubfn) myexpr - expression( ( mydata$variable1 / mydata$variable2 ) ^ 2 - 1 + 3 * 4) strapply(as.character(myexpr), mydata

[R] the hat ^ in regular expression

2010-02-08 Thread christophe dutang
Dear UseRs, I'm trying to find variable names (string after the mydata$) in a expression. For example, myexpr - expression( ( mydata$variable1 / mydata$variable2 ) ^ 2 - 1 + 3 * 4 ) I would like to get variable1 and variable2. The following few lines split the original character string into

Re: [R] the hat ^ in regular expression

2010-02-08 Thread Duncan Murdoch
christophe dutang wrote: Dear UseRs, I'm trying to find variable names (string after the mydata$) in a expression. For example, myexpr - expression( ( mydata$variable1 / mydata$variable2 ) ^ 2 - 1 + 3 * 4 ) I would like to get variable1 and variable2. The following few lines split the

Re: [R] the hat ^ in regular expression

2010-02-08 Thread Gabor Grothendieck
Try this: library(gsubfn) myexpr - expression( ( mydata$variable1 / mydata$variable2 ) ^ 2 - 1 + 3 * 4) strapply(as.character(myexpr), mydata\\$(\\w+))[[1]] [1] variable1 variable2 See http://gsubfn.googlecode.com for more info on strapply. Another approach is setdiff(all.vars(myexpr),