It is a simple change.

If you don't save the results of getSymbol() into a variable, then it's
not available for write.table() to write.

Try
  mydata <- getSymbols(ticker,from='1990-01-01')
  write.table( mydata, {etc})

The help for write.table says that "x" (the first argument to
write.table), contains the data to be written to the file (it says
"object" to be written, not "data" to be written, but that's essentially
what it means). The content of your variable tickler is "IBM" so it writes
that to the file.

-Don


p.s., this is so basic that I'd suggest you try to spend some time with
some of the introductory R documentation. Best wishies!


-- 
Don MacQueen

Lawrence Livermore National Laboratory
7000 East Ave., L-627
Livermore, CA 94550
925-423-1062





On 5/8/14 4:19 PM, "yanni...@gmail.com" <yanni...@gmail.com> wrote:

>Hi y'all,
>
>I'm using quantmod's getSymbols function, which retrieves data in XTS
>format.
>
>I'm trying to pass "IBM" into the "ticker" variable, then write the table
>referencing "ticker."  However, when I run the write.table command, it
>writes "IBM", not the data inside IBM.
>
>Do you have any thoughts on how to fix this?  I imagine it's a simple
>change.
>
>Thank you much!
>
>ticker="IBM"
>getSymbols(ticker,from='1990-01-01')
>write.table(ticker,file="deleteme.csv", col.names=FALSE, sep=',')
>write.table(as.data.frame(ticker),file="deleteme2.csv", col.names=FALSE,
>sep=',')
>
>-- 
>Yan Wu
>510-333-3188 <http://bigkidsbighearts.org>
>yanni...@gmail.com
>
>       [[alternative HTML version deleted]]
>
>______________________________________________
>R-help@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.

______________________________________________
R-help@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.

Reply via email to