[R-SIG-Finance] fPortfolio, as.timeSeries

John P. Burkett burkett at uri.edu
Tue Jul 22 18:32:21 CEST 2008

Using fPortfolio as part of R version 2.6.1 running under Gentoo Linux, 
I'm having trouble loading returns data in a format recognized by the 

In a separate R program I generated 22 time series named IENAX.ts,..., 
WHVintl.ts, and assembled them with a command of the form
returns <- ts.intersect(IENAX.ts,..., WHVintl.ts). The period covered by 
returns is Oct 2003 - March 2008. I saved the result in two formats, as 
write.csv(returns, file="returns.csv")
save(returns, file="returns.RData")

My troubles start when I try to get fPortfolio to process the returns 
data.  If I give the commands
returnsdata <- read.csv("returns.csv",header=T,sep=",")
Data = as.timeSeries(returnsdata)
the response is
Warning messages:
1: In .whichFormat(charvec, ...) : Could not determine time(date) format
2: In .whichFormat(charvec, ...) : Could not determine time(date) format
The rows of Data are labeled with "dummy dates" starting with 1970-01-01.

If I give the commands
Data = as.timeSeries(returns)
then I find that returns (a 54x22 matrix with row labels Oct 2003,..., 
Mar 2008) has been turned into Data (a vector of 1188 elements assembled 
by stacking the columns of returns and labeled with the dummy dates 
starting with 1970-01-01).

Suggestions for properly loading and transforming data would be most 
welcome. If .R, .csv, or .RData files would be of diagnostic value, I 
will happily supply them.


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

More information about the R-SIG-Finance mailing list