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

Rich Shepard r@hep@rd @end|ng |rom @pp|-eco@y@@com
Thu Jul 19 22:21:54 CEST 2018


On Thu, 19 Jul 2018, David Winsemius wrote:

> I took the code that I offered earlier and replaced allyears with wy2018:

>        date  time    elev     myDate              myTime
> 1 2017-10-01 00:00 290.298 2017-10-01 2017-10-01 00:00:00
> 2 2017-10-01 00:30 290.301 2017-10-01 2017-10-01 00:30:00
> 3 2017-10-01 01:00 290.304 2017-10-01 2017-10-01 01:00:00
> 4 2017-10-01 01:30 290.295 2017-10-01 2017-10-01 01:30:00
> 5 2017-10-01 02:00 290.292 2017-10-01 2017-10-01 02:00:00
> 6 2017-10-01 02:30 290.289 2017-10-01 2017-10-01 02:30:00
> 7 2017-10-01 03:00 290.289 2017-10-01 2017-10-01 03:00:00
> 8 2017-10-01 03:30 290.289 2017-10-01 2017-10-01 03:30:00
> 9 2017-10-01 04:00 290.280 2017-10-01 2017-10-01 04:00:00
>
>> str(wy2018)
> 'data.frame':	9 obs. of  5 variables:
> $ date  : Factor w/ 1 level "2017-10-01": 1 1 1 1 1 1 1 1 1
> $ time  : Factor w/ 9 levels "00:00","00:30",..: 1 2 3 4 5 6 7 8 9
> $ elev  : num  290 290 290 290 290 ...
> $ myDate: Date, format: "2017-10-01" "2017-10-01" ...
> $ myTime: POSIXct, format: "2017-10-01 00:00:00" "2017-10-01 00:30:00" ...

David,

   Thank you. I see the results in the dataframe structure although I still
don't understand all the reasons. The 'myTime' column confirms what I
thought: that there is no separate time data type. I'll use what you taught
me an move on with the analyses.

Best regards,

Rich




More information about the R-help mailing list