[R] Strange Expression

2006-03-03 Thread A Mani
Hello,
 I have a dataframe with a column 'col' of expressions of the form
2*3+4*5+6*7 and substrings thereof.
Now
eval(2*3+4*5+6*7) is ok.
But I want it done on that column... nothing seems to work
Even
 cil - dataframe$col
eval(cil[1])
2*3+4*5+6*7

I want the elements of the column evaluated.

Thanks,

A. Mani
Member, Cal. Math. Soc

[[alternative HTML version deleted]]

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] Strange Expression

2006-03-03 Thread Duncan Murdoch
On 3/3/2006 7:09 AM, A Mani wrote:
 Hello,
  I have a dataframe with a column 'col' of expressions of the form
 2*3+4*5+6*7 and substrings thereof.

Stored in what form?  It sounds from below that they may be character 
vectors or factors.  It would be easier to help if you gave a 
reproducible example.

Duncan Murdoch

 Now
 eval(2*3+4*5+6*7) is ok.
 But I want it done on that column... nothing seems to work
 Even
 cil - dataframe$col
 eval(cil[1])
 2*3+4*5+6*7
 
 I want the elements of the column evaluated.
 
 Thanks,
 
 A. Mani
 Member, Cal. Math. Soc
 
   [[alternative HTML version deleted]]
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] Strange Expression

2006-03-03 Thread A Mani
On 3/3/06, ¨Tariq Khan [EMAIL PROTECTED] wrote:

 Did you try eval(parse(text = cil[1])) ?

 yes, function (x) eval(parse(x)) works within the *apply  commands.

thanks,
--
A. Mani
Member, Cal. Math. Soc

[[alternative HTML version deleted]]

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html