[R] Accessing variables inside a namespace

Uwe Ligges
2010-11-20T18:33:51Z

On 18.11.2010 02:12, Santosh Srinivas wrote:
> Hello Group,
>
> I am trying to see if there is way to access data that is inside another
> namespace.
> For e.g. the addATR function in the quantmod package calculates the ATR
> using the TTR package and then plots it to the graph.
>
> Now since it has already calculated the info that I need, can I access that
> data which if I look at the function code is stored in a variable called
> "atr"
>
>
> library(TTR)
> library(quantmod)
> data(ttrc)
> x<-
subset(ttrc,select=c("Date","Open","High","Low","Close"))
> x.z<- read.zoo(x)
> x.xts<- as.xts(x.z)
> chartSeries(x.xts)
> addATR()


All that is returned by addATR() can be saved

temp <- addATR()

and you can look at it by

str(temp)

for example. All other objects are deleted once the function returns.

Best,
Uwe Ligges



>
> Just so that I don't need to recalculate the same stuff again. I
believe the
> data hasn't "expired" already.
>
> Thanks for your help.
> S
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.