Fuchs Ira wrote:
> Can someone please tell me why the following (last line) doesn't work
> (as I expect it to :-)
>
> library(quantmod)
> a = getSymbols("MSFT",from="2009-3-01")
> a
> MSFT
> eval(as.name(a))
> MSFT$MSFT.Adjusted
> b=paste(a,'$MSFT.Adjusted',sep='')
> b
> eval(as.name(b))
>
> Why do
I thought that's what I had:
> b
[1] "MSFT$MSFT.Adjusted"
> eval(as.name(b))
Error in eval(expr, envir, enclos) :
object "MSFT$MSFT.Adjusted" not found
However, Patrick's suggestion of eliminating the '$' gave me what I
was looking for:
> b=paste(a,'.Adjusted',sep='')
> eval(as.name(a))[,b
Does the first item on page 52 of 'The R Inferno'
explain it for you? If not, can you give some
hints about how to improve the explanation?
Patrick Burns
patr...@burns-stat.com
+44 (0)20 8525 0696
http://www.burns-stat.com
(home of "The R Inferno" and "A Guide for the Unwilling S User")
Fuchs
b is character string:
as.name(b)
`MSFT$MSFT.Adjusted`
Note the backticks: that is a valid (if non-syntatatic) name, but you
don't have an object of that name.
On Thu, 5 Mar 2009, Fuchs Ira wrote:
Can someone please tell me why the following (last line) doesn't work (as I
expect it to :-)
4 matches
Mail list logo