Hi, Works for me, try this:
SP500$Date <- as.character(as.Date(as.character(SP500$Date), "%m/%d/%y")) SP500 Date Open High Low Close Volume 1 2006-08-04 1280.26 1292.92 1273.82 1279.40 2530970112 2 2006-08-03 1278.22 1283.96 1271.25 1280.27 2728440064 3 2006-08-02 1270.73 1283.42 1270.73 1277.41 2610749952 4 2006-08-01 1278.53 1278.66 1265.71 1270.92 2527689984 5 2006-07-31 1278.53 1278.66 1274.31 1276.66 2461299968 6 2006-07-28 1263.15 1280.42 1263.15 1278.55 2480420096 SP500.ts <- as.timeSeries(SP500) cut.timeSeries(SP500.ts, from="1980-01-03", to="2006-08-02") Open High Low Close Volume 2006-08-02 1270.73 1283.42 1270.73 1277.41 2610749952 2006-08-01 1278.53 1278.66 1265.71 1270.92 2527689984 2006-07-31 1278.53 1278.66 1274.31 1276.66 2461299968 2006-07-28 1263.15 1280.42 1263.15 1278.55 2480420096 On 09/11/2007, Kerpel, John <[EMAIL PROTECTED]> wrote: > > Hi folks - After upgrading to the latest version of Rmetrics, I can't > read in data like I used to. Is anyone seeing the following? It seems > to truncate the dates after I use "as.timeSeries". > > > > -John > > > > SP500<-read.table("SP500.csv",header=TRUE,sep=",") > > > head(SP500) > > Date Open High Low Close Volume > > 1 08/04/06 1280.26 1292.92 1273.82 1279.40 2530970112 > > 2 08/03/06 1278.22 1283.96 1271.25 1280.27 2728440064 > > 3 08/02/06 1270.73 1283.42 1270.73 1277.41 2610749952 > > 4 08/01/06 1278.53 1278.66 1265.71 1270.92 2527689984 > > 5 07/31/06 1278.53 1278.66 1274.31 1276.66 2461299968 > > 6 07/28/06 1263.15 1280.42 1263.15 1278.55 2480420096 > > > SP500<-as.timeSeries(SP500) > > > head(SP500) > > Open High Low Close Volume > > 0006-08-04 1280.26 1292.92 1273.82 1279.40 2530970112 > > 0006-08-03 1278.22 1283.96 1271.25 1280.27 2728440064 > > 0006-08-02 1270.73 1283.42 1270.73 1277.41 2610749952 > > 0006-08-01 1278.53 1278.66 1265.71 1270.92 2527689984 > > 0006-07-31 1278.53 1278.66 1274.31 1276.66 2461299968 > > 0006-07-28 1263.15 1280.42 1263.15 1278.55 2480420096 > > > SP500<-cut.timeSeries(SP500, from="1980-01-03", to="2006-07-26") > > > head(SP500) > > Open High Low Close Volume > > > > > > > My session info: > > > > sessionInfo() > > R version 2.6.0 Patched (2007-10-22 r43236) > > i386-pc-mingw32 > > > > locale: > > LC_COLLATE=English_United States.1252;LC_CTYPE=English_United > States.1252;LC_MONETARY=English_United > States.1252;LC_NUMERIC=C;LC_TIME=English_United States.1252 > > > > attached base packages: > > [1] tcltk stats graphics grDevices utils datasets methods > > > [8] base > > > > other attached packages: > > [1] fTrading_260.72 fGarch_260.72 fArma_260.72 > fMultivar_260.72 > > [5] fBasics_260.72 fImport_260.72 sn_0.4-2 mnormt_1.2-1 > > > [9] fSeries_260.72 fCalendar_260.72 fEcofin_260.72 > fUtilities_260.72 > > [13] spatial_7.2-37 RUnit_0.4.17 MASS_7.2-37 > robustbase_0.2-8 > > [17] dyn_0.2-6 zoo_1.4-0 > > > > loaded via a namespace (and not attached): > > [1] grid_2.6.0 lattice_0.17-2 tools_2.6.0 > > > > > > [[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. > -- Henrique Dallazuanna Curitiba-Paraná-Brasil 25° 25' 40" S 49° 16' 22" O [[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.