Skip to content
Prev 42371 / 398506 Next

Importing Excel/Openoffice Dates into R

I am puzzled: `csv' means `comma-separated values' and those files have no 
commas in them.  You could use

A <- read.table("cboevix.csv")
B <- read.table("yenv.csv")

which looks better.  You can then merge the two dfs by
Row.names   VIX YENV
1   1/1/1999 24.42 19.5
2  1/11/1999 25.46 21.6
3  1/12/1999 28.10 20.9
4  1/14/1999 32.98 19.3
5   1/4/1999 26.17 22.2
6   1/5/1999 24.46 23.2
7   1/6/1999 23.34 21.0
8   1/7/1999 24.37 20.2
9   1/8/1999 23.28   NA
10 1/13/1999    NA 19.1

and then convert to R's date format by 

Date <- as.POSIXct(strptime(as.character(AB$Row.names), "%m/%d/%Y"))
row.names(AB) <- Date
AB <- AB[sort.list(Date),-1]
AB
             VIX YENV
1999-01-01 24.42 19.5
1999-01-04 26.17 22.2
1999-01-05 24.46 23.2
1999-01-06 23.34 21.0
1999-01-07 24.37 20.2
1999-01-08 23.28   NA
1999-01-11 25.46 21.6
1999-01-12 28.10 20.9
1999-01-13    NA 19.1
1999-01-14 32.98 19.3

Second, as ts.union is not part of tseries, and is for regular time series
I don't see how you hoped to use it.  You could for example use

irts(row.names(AB), as.matrix(AB))

to create an object of class "irts", or you could use the `its' package
from CRAN (which is what I would use).
On Fri, 2 Jan 2004, Ashley Davies wrote: