Hi Folks! I used the code below previously with no problems, but now I get: DTB3<-read.table("C:\\Program Files\\R\\R-2.7.1\\DTB3.csv",header=TRUE,sep=",")> tail(DTB3)DATE VALUE 14233 2008-07-23 1.56 14234 2008-07-24 1.62 14235 2008-07-25 1.71 14236 2008-07-28 1.70 14237 2008-07-29 1.69 14238 2008-07-30 1.67> DTB3<-as.timeSeries(DTB3)> tail(DTB3)TS.1 2008-07-23 100 2008-07-24 106 2008-07-25 115 2008-07-28 114 2008-07-29 113 2008-07-30 111 What might be causing the values to change when I go from read.table to as.timeSeries? Many thanks. John [[alternative HTML version deleted]]
Apparently, the Fed changed the way they handled missing values in the interest rates files; now they use a period instead of #N/A like they did in my old files. When I do a global replace and replace the periods with a blank prior to importing in R, I get what I used to get: DTB3<-read.table("C:\\Program Files\\R\\R-2.7.1\\DTB3.csv",header=TRUE,sep=",")> tail(DTB3)DATE VALUE 14233 2008-07-23 1.56 14234 2008-07-24 1.62 14235 2008-07-25 1.71 14236 2008-07-28 1.70 14237 2008-07-29 1.69 14238 2008-07-30 1.67> DTB3<-as.timeSeries(DTB3) > tail(DTB3)TS.1 2008-07-23 1.56 2008-07-24 1.62 2008-07-25 1.71 2008-07-28 1.70 2008-07-29 1.69 2008-07-30 1.67 John -----Original Message----- From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org] On Behalf Of Kerpel, John Sent: Friday, August 01, 2008 1:13 PM To: r-help at r-project.org Subject: [R] Reading data in R-metrics Hi Folks! I used the code below previously with no problems, but now I get: DTB3<-read.table("C:\\Program Files\\R\\R-2.7.1\\DTB3.csv",header=TRUE,sep=",")> tail(DTB3)DATE VALUE 14233 2008-07-23 1.56 14234 2008-07-24 1.62 14235 2008-07-25 1.71 14236 2008-07-28 1.70 14237 2008-07-29 1.69 14238 2008-07-30 1.67> DTB3<-as.timeSeries(DTB3)> tail(DTB3)TS.1 2008-07-23 100 2008-07-24 106 2008-07-25 115 2008-07-28 114 2008-07-29 113 2008-07-30 111 What might be causing the values to change when I go from read.table to as.timeSeries? Many thanks. John [[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.
My suspicion is that there is some value that R does not think is numeric, so the column becomes a factor, and you are seeing the codes for the factor. Patrick Burns patrick at burns-stat.com +44 (0)20 8525 0696 http://www.burns-stat.com (home of S Poetry and "A Guide for the Unwilling S User") Kerpel, John wrote:> Hi Folks! > > > > I used the code below previously with no problems, but now I get: > > > > DTB3<-read.table("C:\\Program > Files\\R\\R-2.7.1\\DTB3.csv",header=TRUE,sep=",") > > >> tail(DTB3) >> > > DATE VALUE > > 14233 2008-07-23 1.56 > > 14234 2008-07-24 1.62 > > 14235 2008-07-25 1.71 > > 14236 2008-07-28 1.70 > > 14237 2008-07-29 1.69 > > 14238 2008-07-30 1.67 > > >> DTB3<-as.timeSeries(DTB3) >> > > >> tail(DTB3) >> > > TS.1 > > 2008-07-23 100 > > 2008-07-24 106 > > 2008-07-25 115 > > 2008-07-28 114 > > 2008-07-29 113 > > 2008-07-30 111 > > > > What might be causing the values to change when I go from read.table to > as.timeSeries? > > > > Many thanks. > > > > John > > > [[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. > > >
John, I suspect that Patrick is right. send us a str(df) to we see how your data frame looks like kind regards miltinho astronaura brazil On 8/1/08, Kerpel, John <John.Kerpel@infores.com> wrote:> > Hi Folks! > > > > I used the code below previously with no problems, but now I get: > > > > DTB3<-read.table("C:\\Program > Files\\R\\R-2.7.1\\DTB3.csv",header=TRUE,sep=",") > > > tail(DTB3) > > DATE VALUE > > 14233 2008-07-23 1.56 > > 14234 2008-07-24 1.62 > > 14235 2008-07-25 1.71 > > 14236 2008-07-28 1.70 > > 14237 2008-07-29 1.69 > > 14238 2008-07-30 1.67 > > > DTB3<-as.timeSeries(DTB3) > > > tail(DTB3) > > TS.1 > > 2008-07-23 100 > > 2008-07-24 106 > > 2008-07-25 115 > > 2008-07-28 114 > > 2008-07-29 113 > > 2008-07-30 111 > > > > What might be causing the values to change when I go from read.table to > as.timeSeries? > > > > Many thanks. > > > > John > > > [[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. >[[alternative HTML version deleted]]