[R] Read in data table, change columns from factors

Rich Shepard r@hep@rd @end|ng |rom @pp|-eco@y@@com
Thu Jul 19 01:07:18 CEST 2018


On Wed, 18 Jul 2018, David Winsemius wrote:

> I would not destroy the possibility of using the original values:

David,

   What are the benefits of keeping date and time as factors?

>> allyears$myDate <- as.Date(as.character(allyears$date))
>> allyears$myTime <- as.POSIXct(paste(allyears$date, allyears$time))

   The latter command is not working on the full (402415 rows in the allyears
data set):

allyears$myTime <- as.POSIXct(paste(allyears$date, allyears$time))
Error in as.POSIXlt.character(x, tz, ...) :
   character string is not in a standard unambiguous format

> It's spelled `as.numeric`,

   Ah, I missed that. Thank you.

> ... but I'm having difficulty thinking about what sort of elevation (or would
> that be "depth") would be be measured by "-3762938880000000369098752".

   I also was curious about that figure and grep doesn't find it in the
original data file so I've no idea where R-3.5.0 came up with it.

   I'll read more about the POSIX datetime functions.

Thanks again,

Rich




More information about the R-help mailing list