Displaying 3 results from an estimated 3 matches for "data_strptim".
Did you mean:
data_strptime
2016 Apr 11
2
Query about use of format in strptime
...0 0.00
2007 11 19 2 30 0.00
2007 11 19 3 0 0.00
2007 11 19 3 30 0.00
2007 11 19 4 0 0.00
2007 11 19 4 30 0.00
...
whth semi-hourly data.
I need to deal with date so I used strptime:
Snow$data_factor <- as.factor(paste(Snow$year, Snow$month, Snow$day, Snow$hh, Snow$mm, sep="-"))
Snow$data_strptime <- strptime(Snow$data_factor, format = "%Y-%m-%d-%H-%M")
It gives me
year month day hh mm hs data_factor data_strptime
1 2007 11 19 0 0 0 2007-11-19-0-0 2007-11-19 00:00:00
2 2007 11 19 0 30 0 2007-11-19-0-30 2007-11-19 00:30:00
3 2007 11 19 1 0...
2016 Apr 11
0
Query about use of format in strptime
Hi Stefano,
As the help page says:
"The default for the format methods is "%Y-%m-%d %H:%M:%S" if any
element has a time component which is not midnight, and "%Y-%m-%d"
otherwise. This is because when the result is printed, it uses the
default format. If you want a specified output representation:
format(strptime(init_day, format="%Y-%m-%d-%H-%M"),"%Y-%M-%d
2016 Apr 11
3
Query about use of format in strptime
Dear R-list users,
I need to use strptime because I have to deal with date with hours and minutes.
I read the manual for strptime and I also looked at many examples, but when I try to apply it to my code, I always encounter some problems.
I try to change the default format, with no success. Why? How can I change the format?
1.
init_day <- as.factor("2015-02-24-00-30")