r-Help Community
Never mine figured it out just use the "as.POSIXct" function
Jeff
I need to convert a date-time field (column) but I'm losing the time when
I convert using ..
tsData <- myData[,10, drop=FALSE]
tsData$date_time <- as.Date(tsData$date_time, format="%m/%d/%y %H:%M"
Hello,
as.Date() outputs an object of class "Date", you want an object of class
c("POSIXt", "POSIXct"). Use as.POSIXct().
Hope this helps,
Rui Barradas
Às 16:04 de 08/05/19, reichm...@sbcglobal.net escreveu:
r-Help Community
I need to convert a date-time field (column) but I'm losing
r-Help Community
I need to convert a date-time field (column) but I'm losing the time when
I convert using ..
tsData <- myData[,10, drop=FALSE]
tsData$date_time <- as.Date(tsData$date_time, format="%m/%d/%y %H:%M")
head(tsData)
date_time
1
2013-06-20
On 03.12.2010 16:31, Alexander Salim wrote:
Hi all,
I have a dataset called ,dataSet1'. The time column is given in a numeric
code beginning with the year and ending with the minutes. Frist I tried the
strptime() function to solve the problem. It gave me just the date back (and
not the date an
Hi all,
I have a dataset called ,dataSet1'. The time column is given in a numeric
code beginning with the year and ending with the minutes. Frist I tried the
strptime() function to solve the problem. It gave me just the date back (and
not the date and time). There is also the ISOdatetime function
chron uses:
- separate arguments for date and time -- not a single one as you have
- a separate system for the codes, not the % codes of Date and POSIXt classes
If you want to specify the date and time all as one string
rather than two arguments, use as.chron instead of
chron -- as.chron does use
what am I doing wrong?
chron(as.character(f), format=c(dates="%m/%d/%y", times="%h:%m"))
f <- structure(c(51L, 60L, 66L, 87L, 90L, 115L, 23L, 35L, 37L, 6L,
12L, 55L, 84L, 96L, 109L, 17L, 29L, 41L, 3L, 74L, 94L, 102L,
30L, 8L, 46L, 69L, 107L, 15L, 25L, 39L, 1L, 71L, 95L, 19L, 56L,
62L, 76L, 85L, 9
7 matches
Mail list logo