Error using Rmetrics to read data
Yes, in the previous email that I send to you i comment this: you need the %Y SP500$Date <- as.character(as.Date(as.character(SP500$Date), "%m/%d/%Y"))
On 24/01/2008, Kerpel, John <John.Kerpel at infores.com> wrote:
But look what happens to the date field:
SP500<-read.table("SP500.csv",header=TRUE,sep=",")
head(SP500)
Date Open High Low Close Volume Close2 1 8/4/2006 1280.26 1292.92 1273.82 1279.40 2530970112 1279.40 2 8/3/2006 1278.22 1283.96 1271.25 1280.27 2728440064 1280.27 3 8/2/2006 1270.73 1283.42 1270.73 1277.41 2610749952 1277.41 4 8/1/2006 1278.53 1278.66 1265.71 1270.92 2527689984 1270.92 5 7/31/2006 1278.53 1278.66 1274.31 1276.66 2461299968 1276.66 6 7/28/2006 1263.15 1280.42 1263.15 1278.55 2480420096 1278.55
SP500$Date <- as.character(as.Date(as.character(SP500$Date), "%m/%d/%y")) SP500<-as.timeSeries(SP500) head(SP500)
Open High Low Close Volume Close2 2020-08-04 1280.26 1292.92 1273.82 1279.40 2530970112 1279.40 2020-08-03 1278.22 1283.96 1271.25 1280.27 2728440064 1280.27 2020-08-02 1270.73 1283.42 1270.73 1277.41 2610749952 1277.41 2020-08-01 1278.53 1278.66 1265.71 1270.92 2527689984 1270.92 2020-07-31 1278.53 1278.66 1274.31 1276.66 2461299968 1276.66 2020-07-28 1263.15 1280.42 1263.15 1278.55 2480420096 1278.55 -----Original Message----- From: Henrique Dallazuanna [mailto:wwwhsd at gmail.com] Sent: Thursday, January 24, 2008 2:02 PM To: Kerpel, John Cc: r-help at r-project.org Subject: Re: [R] Error using Rmetrics to read data SP500$Date <- as.character(as.Date(as.character(SP500$Date), "%m/%d/%y")) SP500<-as.timeSeries(SP500) On 24/01/2008, Kerpel, John <John.Kerpel at infores.com> wrote:
Hi folks. This set of code used to work, but after upgrading to the
latest version of Rmetrics it no longer does. Any ideas?
SP500<-read.table("SP500.csv",header=TRUE,sep=",")
head(SP500)
Date Open High Low Close Volume Close2
1 8/4/2006 1280.26 1292.92 1273.82 1279.40 2530970112 1279.40
2 8/3/2006 1278.22 1283.96 1271.25 1280.27 2728440064 1280.27
3 8/2/2006 1270.73 1283.42 1270.73 1277.41 2610749952 1277.41
4 8/1/2006 1278.53 1278.66 1265.71 1270.92 2527689984 1270.92
5 7/31/2006 1278.53 1278.66 1274.31 1276.66 2461299968 1276.66
6 7/28/2006 1263.15 1280.42 1263.15 1278.55 2480420096 1278.55
SP500<-as.timeSeries(SP500)
Error in .midnightStandard(charvec, format) : 'charvec' has non-NA entries of different number of characters
[[alternative HTML version deleted]]
______________________________________________ R-help at 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
______________________________________________ R-help at 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