[R-SIG-Finance] quantmod, getSymbols, csv
jeff.a.ryan at gmail.com
Thu Jul 17 19:05:03 CEST 2008
getSymbols.csv is not very robust at this time. What needs to be done
is a clean generalization of the call, for cases that can't be covered
(like the date in the 3rd col, and superfluous data in cols 1 and 4,
if I am reading your data correctly).
I suspect something to identify the timestamp column, and the columns
you would like to include would make this more useful. The other
option is to create your own custom getSymbols.John function, so
getSymbols('FILE', src="John") would do exactly what you want. Simply
adding the below in the appropriate places to the getSymbols.csv
source would be all that is required.
x <- read.csv('CREFglobeq.csv',header=TRUE)
x <- xts(matrix(x$price,dimnames=list(index(x),'price')),as.Date(x$date))
xts can be replaced by zoo, or any other time-series constructor you like.
On Thu, Jul 17, 2008 at 11:10 AM, John P. Burkett <burkett at uri.edu> wrote:
> Making a first attempt use quantmod's getSymbols to load data from a .csv
> file, I have encountered a puzzling error message.
> The response to
> getSymbols("CREFglobaleq", from="1992-05-01", to="2008-06-30", src="csv")
> Error in fromchar(x) :
> character string is not in a standard unambiguous format
> My basic problem is ignorance about what is acceptable as "a standard
> unambiguous format." Explanations or references to documentation would be
> greatly appreciated.
> The first few rows of my CREFglobaleq.csv file read as follows:
> fund , price , date , id
> CREFglob , 25.8429 , 1992-05-01 , 199205
> CREFglob , 25.9774 , 1992-05-04 , 199205
> CREFglob , 25.9964 , 1992-05-05 , 199205
> CREFglob , 26.2335 , 1992-05-06 , 199205
> CREFglob , 26.3368 , 1992-05-07 , 199205
> Best regards,
> John P. Burkett
> Department of Environmental and Natural Resource Economics
> and Department of Economics
> University of Rhode Island
> Kingston, RI 02881-0808
> phone (401) 874-9195
> R-SIG-Finance at stat.math.ethz.ch mailing list
> -- Subscriber-posting only.
> -- If you want to post, subscribe first.
jeffrey.ryan at insightalgo.com
ia: insight algorithmics
More information about the R-SIG-Finance