Dear All
I am trying to convert from the type expression to the type
numeric. The following works:
x - expression(6.2)
as.numeric(as.character(x))
[1] 6.2
However, the following does not work:
x - expression(62/100)
as.numeric(as.character(x))
[1] NA
Warning message:
NAs introduced by
Paul Smith wrote:
x - expression(62/100)
as.numeric(as.character(x))
[1] NA
Warning message:
NAs introduced by coercion
Any idea about how to deal with the second case?
eval-uate the expression:
x - expression(62/100)
eval(x)
[1] 0.62
Barry
On 11/23/06, Barry Rowlingson [EMAIL PROTECTED] wrote:
x - expression(62/100)
as.numeric(as.character(x))
[1] NA
Warning message:
NAs introduced by coercion
Any idea about how to deal with the second case?
eval-uate the expression:
x - expression(62/100)
eval(x)
[1]
Paul Smith [EMAIL PROTECTED] writes:
Dear All
I am trying to convert from the type expression to the type
numeric. The following works:
x - expression(6.2)
as.numeric(as.character(x))
[1] 6.2
However, the following does not work:
x - expression(62/100)
On 23 Nov 2006 18:20:17 +0100, Peter Dalgaard [EMAIL PROTECTED] wrote:
I am trying to convert from the type expression to the type
numeric. The following works:
x - expression(6.2)
as.numeric(as.character(x))
[1] 6.2
However, the following does not work:
x -
On 11/23/06, Paul Smith [EMAIL PROTECTED] wrote:
On 23 Nov 2006 18:20:17 +0100, Peter Dalgaard [EMAIL PROTECTED] wrote:
I am trying to convert from the type expression to the type
numeric. The following works:
x - expression(6.2)
as.numeric(as.character(x))
[1] 6.2
Paul Smith [EMAIL PROTECTED] writes:
Thanks, Peter. I did not know about the existence of the command
'eval', in spite of the fact of having searched the Internet for a
solution for my problem.
'eval' seems not working in connection with Ryacas:
library(Ryacas)
x - yacas(2/3*5/7)
x
Also note that Ryacas provides an Eval which has a yacas method
that simplifies writing this:
library(Ryacas)
Eval(yacas(1/2))
See ?Eval
On 11/23/06, Gabor Grothendieck [EMAIL PROTECTED] wrote:
On 11/23/06, Paul Smith [EMAIL PROTECTED] wrote:
On 23 Nov 2006 18:20:17 +0100, Peter Dalgaard