DO NOT DO THIS!
This is a complete misuse of R.
R is not a macro/scripting language that constructs language expressions to
be evaluated (although it can do this). Rather, it is a functional language
that uses functions that build new objects from inputted objects and
parameters. I would strongly
Also, Instead of ?attach, you could try ?with or ?within
aa$z<- with(aa,eval(parse(text=bb)))
aa$z
#[1] 3 7 11
aa<- within(aa,z<- eval(parse(text=bb)))
aa
# x y z
#1 2 3 3
#2 4 5 7
#3 6 7 11
A.K.
- Original Message -
From: arun
To: R help
Cc:
Sent: Wednesday, September 25, 201
Hi,
Change:
aa$z<- eval(parse(text=bb))
aa
# x y z
#1 2 3 3
#2 4 5 7
#3 6 7 11
A.K.
I want to create a new column to a data frame using a formula from another
variable:
Example:
I have a data set "aa" is;
x y
2 3
4 5
6 7
My R code is;
>bb <- "x+y-2"
>attach(aa)
>aa$
3 matches
Mail list logo