I am newly subscribed to r-project. I have recently plunged into R on a totally self-taught basis (may not have been the smartest decision!) I am attempting to download tickers as a time series. I can successfully create RDA files but I want to convert them to CVS. Following is the code I have created so far. if (!require(BatchGetSymbols)) install.packages('BatchGetSymbols') library(BatchGetSymbols) tickers <- c('SPY','VCR', 'RPG') first.date <- Sys.Date()-365 last.date <- Sys.Date l.out <- BatchGetSymbols(tickers = tickers, first.date = first.date, last.date = last.date, cache.folder = file.path("c://Users/Owner/Documents/R", + 'BGS_Cache') ) print(l.out$df.control) print(l.out$df.tickers) I can print(l.out) and see that it contains all the data, but it is not a data.frame Can anyone help with creating a data.frame and then converting to CSV? Any help is GREATLY appreciated! Thanks Jim Sent from Mail<https://go.microsoft.com/fwlink/?LinkId=550986> for Windows 10 [[alternative HTML version deleted]]
Others may help, but I suggest first going through an R tutorial or two to learn about R's basic data structures, i/o, etc. This list can help, but cannot substitute for such homework. Some tutorial recommendations can be found here: https://www.rstudio.com/online-learning/#r-programming There are many more, of course. See also: ?read.table (etc. in the Help page) ?write.table Cheers, Bert Bert Gunter "The trouble with having an open mind is that people keep coming along and sticking things into it." -- Opus (aka Berkeley Breathed in his "Bloom County" comic strip ) On Fri, Sep 14, 2018 at 1:56 PM Jim Blackburn <outlook_5DC74CB3034CB0A2 at outlook.com> wrote:> > I am newly subscribed to r-project. > > > I have recently plunged into R on a totally self-taught basis (may not have been the smartest decision!) > > > > I am attempting to download tickers as a time series. I can successfully create RDA files but I want to convert them to CVS. Following is the code I have created so far. > > > > if (!require(BatchGetSymbols)) install.packages('BatchGetSymbols') > > library(BatchGetSymbols) > > tickers <- c('SPY','VCR', 'RPG') > > first.date <- Sys.Date()-365 > > last.date <- Sys.Date > > l.out <- BatchGetSymbols(tickers = tickers, > > first.date = first.date, > > last.date = last.date, > > cache.folder = file.path("c://Users/Owner/Documents/R", > > + 'BGS_Cache') ) > > print(l.out$df.control) > > print(l.out$df.tickers) > > > > > > > > I can print(l.out) and see that it contains all the data, but it is not a data.frame > > > > Can anyone help with creating a data.frame and then converting to CSV? > > > > Any help is GREATLY appreciated! > > > > Thanks > > > > Jim > > > Sent from Mail<https://go.microsoft.com/fwlink/?LinkId=550986> for Windows 10 > > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see > 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.
Dear Jim Without knowing what l.out is this might be tricky. What does str(l.out) tell you it is. And is CVS a typo for csv? Michael On 14/09/2018 19:00, Jim Blackburn wrote:> I am newly subscribed to r-project. > > > I have recently plunged into R on a totally self-taught basis (may not have been the smartest decision!) > > > > I am attempting to download tickers as a time series. I can successfully create RDA files but I want to convert them to CVS. Following is the code I have created so far. > > > > if (!require(BatchGetSymbols)) install.packages('BatchGetSymbols') > > library(BatchGetSymbols) > > tickers <- c('SPY','VCR', 'RPG') > > first.date <- Sys.Date()-365 > > last.date <- Sys.Date > > l.out <- BatchGetSymbols(tickers = tickers, > > first.date = first.date, > > last.date = last.date, > > cache.folder = file.path("c://Users/Owner/Documents/R", > > + 'BGS_Cache') ) > > print(l.out$df.control) > > print(l.out$df.tickers) > > > > > > > > I can print(l.out) and see that it contains all the data, but it is not a data.frame > > > > Can anyone help with creating a data.frame and then converting to CSV? > > > > Any help is GREATLY appreciated! > > > > Thanks > > > > Jim > > > Sent from Mail<https://go.microsoft.com/fwlink/?LinkId=550986> for Windows 10 > > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see > 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. >-- Michael http://www.dewey.myzen.co.uk/home.html
Hello Jim, as new use"R" myself, 1.5 years I HIGHLY recommend emersion. Subscribe to : https://www.r-bloggers.com/ https://stackoverflow.com http://blog.revolutionanalytics.com/ Anything Hadley Wickam, he has several free e-books. Depending on r-help (r-help at r-project.org<mailto:r-help at r-project.org>) is a tough way to go, they can be hard on new users without the formality of: PLEASE do read the posting guide http://www.R-project.org/posting-guide.html<http://www.R-project.org/posting-guide.html> Be prepared for partial suggestions that depend on your further research, trial and error! WHP From: R-help <r-help-bounces at r-project.org> On Behalf Of Jim Blackburn Sent: Friday, September 14, 2018 2:00 PM To: r-help at r-project.org Subject: [R] New to R I am newly subscribed to r-project. I have recently plunged into R on a totally self-taught basis (may not have been the smartest decision!) I am attempting to download tickers as a time series. I can successfully create RDA files but I want to convert them to CVS. Following is the code I have created so far. if (!require(BatchGetSymbols)) install.packages('BatchGetSymbols') library(BatchGetSymbols) tickers <- c('SPY','VCR', 'RPG') first.date<http://first.date> <- Sys.Date()-365 last.date<http://last.date> <- Sys.Date<http://Sys.Date> l.out <- BatchGetSymbols(tickers = tickers, first.date<http://first.date> = first.date<http://first.date>, last.date<http://last.date> = last.date<http://last.date>, cache.folder = file.path("c://Users/Owner/Documents/R", + 'BGS_Cache') ) print(l.out$df.control) print(l.out$df.tickers) I can print(l.out) and see that it contains all the data, but it is not a data.frame Can anyone help with creating a data.frame and then converting to CSV? Any help is GREATLY appreciated! Thanks Jim Sent from Mail<https://go.microsoft.com/fwlink/?LinkId=550986<https://go.microsoft.com/fwlink/?LinkId=550986>> for Windows 10 [[alternative HTML version deleted]] ______________________________________________ R-help at r-project.org<mailto:R-help at r-project.org> mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help<https://stat.ethz.ch/mailman/listinfo/r-help> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html<http://www.R-project.org/posting-guide.html> and provide commented, minimal, self-contained, reproducible code. Confidentiality Notice This message is sent from Zelis. ...{{dropped:15}}