FAQ Database Discussion Community


differences between subsetting POSIXlt and POSIXct in R

r,timestamp,posixct,subsetting,posixlt
DATA v1 <- c("2015-01-05 15:00:00", "2015-01-05 15:45:00", "2015-01-05 15:00:30") OPERATIONS v2 <- strptime(v1, '%Y-%m-%d %H:%M:%S') str(v2) POSIXlt[1:3], format: "2015-01-05 15:00:00" "2015-01-05 15:45:00" "2015-01-05 15:00:30" v3 <- v2[!v2$min] # create v3 from v2 eliminating min != 00 RESULT (successful subsetting) str(v3) POSIXlt[1:2], format: "2015-01-05 15:00:00" "2015-01-05 15:00:30" Now creating v4 by...

R help converting char to POSIXlt

r,datetime,time,strptime,posixlt
I am having a lot of problems converting a char data.frame into a POSIXlt. This is my str output: 'data.frame': 5846 obs. of 5 variables: $ date : Factor w/ 184 levels "1/1/2015","1/10/2015",..: 31 31 31 31 31 31 31 31 31 31 ... $ time : Factor w/ 680...

Reading a string column in xlsx with date and time values

r,datetime,xlsx,posixct,posixlt
I am reading a .xlsx file using R. One of the columns is called "Date" and it has the following format: "20/10/2014 12:00:00 am". However, when I read the file using R's xlsx package, the value becomes 41932-- class factor. How can I read the entire column as a string...