After converting the coefficients in POSIXCT format, and then applying the date and time format, I want to change the difference between the dates and the two positions pos1 and pos2.
However, when I do this for a specific item, I get the correct answer in the console, but when I perform the operation as a whole, the console displays only the number, and also the date frame reflects these numbers, as you can see.
How can I get the clock in a DataFrame when I try to make a difference? I am using lubridate package, is there any function for this?
Here is an example of code / image data in RStudio describing it
CR_Date <- data.frame(
pos1="2014-07-01 00:00:00",
pos2=c("2014-07-01 00:00:00","2014-07-01 10:15:00")
)
CR_Date[] <- lapply(CR_Date,as.POSIXct)
CR_Date
CR_Date$pos2[2] - CR_Date$pos1[2]
CR_Date$hours <- CR_Date$pos2 - CR_Date$pos1

source
share