Hi Group, I am having a strange problem for this simple task. I am using read.table to read a plan 3 column CSV file . the file is getting read . But the first column has datetime in the csv file in the following format: 20110221.114041 But this is being read as 20110221 only . the time portion (decimal is missing) in the data frame Any idea why? Thanks, Santosh [[alternative HTML version deleted]]
> I am using read.table to read a plan 3 column CSV file . the file is getting > read . > > But the first column has datetime in the csv file in the following format: > 20110221.114041 > > But this is being read as 20110221 only . the time portion (decimal is > missing) in the data frameMy guess is that ist does get read correctly but you only see part of the actual number because R will usually not print all available digits. Example:> a <- 20110221.114041 > a[1] 20110221> options("digits")$digits [1] 7> format(a, digits=7)[1] "20110221"> format(a, digits=20)[1] "20110221.114041" cu Philipp -- Dr. Philipp Pagel Lehrstuhl f?r Genomorientierte Bioinformatik Technische Universit?t M?nchen Wissenschaftszentrum Weihenstephan Maximus-von-Imhof-Forum 3 85354 Freising, Germany http://webclu.bio.wzw.tum.de/~pagel/
Use colClasses to specify that the column is character so you don't lose any significance. You are close to the 15 digits of significance for a floating point number. On Tue, Feb 22, 2011 at 6:08 AM, Santosh Srinivas <santosh.srinivas at gmail.com> wrote:> Hi Group, > > > > I am having a strange problem for this simple task. > > > > I am using read.table to read a plan 3 column CSV file . the file is getting > read . > > But the first column has datetime in the csv file in the following format: > 20110221.114041 > > > > But this is being read as 20110221 only . the time portion (decimal is > missing) in the data frame > > > > Any idea why? > > > > Thanks, > > Santosh > > > > > ? ? ? ?[[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. >-- Jim Holtman Data Munger Guru What is the problem that you are trying to solve?