[R] converting to time series object : ts - package:stats

Peter Dalgaard p.dalgaard at biostat.ku.dk
Mon Jun 26 17:30:20 CEST 2006


Sachin J <sachinj.2006 at yahoo.com> writes:

> Hi Gabor,
>    
>   You are correct. The real problem is with read.csv. I am not sure why? My data looks 
>    
>   V1,V2,V3
> 11.08,21.73,13.08
> 7.08,37.73,6.08
> 7.08,11.73,21.08
....
> > read.csv("C:/Data.csv",header=TRUE,sep=",",na.strings="NA",
> > dec=",", strip.white=TRUE)

If that's how it looks, then dec="," is wrong. It sets the decimal
separator, so expects 11,08 etc. You want dec=".". In general, having
sep and dec set to the same value is asking for trouble, and you
didn't actually need to depart from the default settings, except for
the strip.white bit.

-- 
   O__  ---- Peter Dalgaard             Øster Farimagsgade 5, Entr.B
  c/ /'_ --- Dept. of Biostatistics     PO Box 2099, 1014 Cph. K
 (*) \(*) -- University of Copenhagen   Denmark          Ph:  (+45) 35327918
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk)                  FAX: (+45) 35327907



More information about the R-help mailing list