I created a couple of timeSeries objects - when I was merging them , I got an error. Looking at the data , I see that one of the time series has 06/30/2007 0.0028 0.0183 0.0122 0.0042 0.0095 - 07/31/2007 -0.0111 0.0255 0.0096 -0.0069 -0.0024 0.0043 08/31/2007 -0.0108 -0.0237 -0.0062 -0.0138 -0.0173 -0.0065 09/30/2007 0.0197 0.0477 0.0410 0.0331 0.0114 0.0322 The "-" (first row, last column) is getting picked up from excel and is not a number How do I check for this and replace with zero [[alternative HTML version deleted]]
s <- read.table('d.dat', na.strings='-') On 16-Mar-11 06:45, Rahul Kaura wrote:> 06/30/2007 0.0028 0.0183 0.0122 0.0042 0.0095 - > 07/31/2007 -0.0111 0.0255 0.0096 -0.0069 -0.0024 0.0043 > 08/31/2007 -0.0108 -0.0237 -0.0062 -0.0138 -0.0173 -0.0065 > 09/30/2007 0.0197 0.0477 0.0410 0.0331 0.0114 0.0322 > >-- Ing. Mario Valle Data Analysis and Visualization Group | http://www.cscs.ch/~mvalle Swiss National Supercomputing Centre (CSCS) | Tel: +41 (91) 610.82.60 v. Cantonale Galleria 2, 6928 Manno, Switzerland | Fax: +41 (91) 610.82.82
To recover also the date: x<- read.table('d.dat', na.strings='-') x$V1<- as.Date(x$V1, "%m/%d/%Y") Hope it helps mario On 16-Mar-11 06:45, Rahul Kaura wrote:> > > I created a couple of timeSeries objects - when I was merging them , I got an > error. > Looking at the data , I see that one of the time series has > > 06/30/2007 0.0028 0.0183 0.0122 0.0042 0.0095 - > 07/31/2007 -0.0111 0.0255 0.0096 -0.0069 -0.0024 0.0043 > 08/31/2007 -0.0108 -0.0237 -0.0062 -0.0138 -0.0173 -0.0065 > 09/30/2007 0.0197 0.0477 0.0410 0.0331 0.0114 0.0322 > > > The "-" (first row, last column) is getting picked up from excel and is not a > number > > How do I check for this and replace with zero > > > [[alternative HTML version deleted]] >-- Ing. Mario Valle Data Analysis and Visualization Group | http://www.cscs.ch/~mvalle Swiss National Supercomputing Centre (CSCS) | Tel: +41 (91) 610.82.60 v. Cantonale Galleria 2, 6928 Manno, Switzerland | Fax: +41 (91) 610.82.82