Skip to content

Date handling in R is hard to understand

6 messages · Alemu Tadesse, Bert Gunter, Jim Lemon +2 more

#
Have a look at the "lubridate" package. It claims to try to make
dealing with dates easier.


-- Bert
On Fri, Nov 8, 2013 at 11:41 AM, Alemu Tadesse <alemu.tadesse at gmail.com> wrote:

  
    
#
Hi Mihretu,
Can you grep for "AM" or "PM"? If so build your format string depending 
upon whether one of these exists in the date string.

Jim
On 11/09/2013 06:41 AM, Alemu Tadesse wrote:
#
I agree w/ lubridate.    I also would like to mention that   "date handling" 
is amazingly difficult in ALL computer languages, not just R.  Take a stroll
through sites like thedailywtf.com to see how quickly people get into
tarpits full of thorns when trying to deal with leap years, weeks vs month
ends, etc.   



Bert Gunter wrote

            

            
--
View this message in context: http://r.789695.n4.nabble.com/Date-handling-in-R-is-hard-to-understand-tp4680070p4680125.html
Sent from the R help mailing list archive at Nabble.com.
1 day later
#
Hi
rbind/cbind can use data.frame method which add any column specific format. However with "normal" method, it results in matrix which has to have common type of data in all columns (actually matrix is only vector with dimensions).
'data.frame':   153 obs. of  7 variables:
 $ ozone  : int  41 36 12 18 NA 28 23 19 8 NA ...
 $ solar.r: int  190 118 149 313 NA NA 299 99 19 194 ...
 $ wind   : num  7.4 8 12.6 11.5 14.3 14.9 8.6 13.8 20.1 8.6 ...
 $ temp   : int  67 72 74 62 56 66 65 59 61 69 ...
 $ month  : int  5 5 5 5 5 5 5 5 5 5 ...
 $ day    : int  1 2 3 4 5 6 7 8 9 10 ...
 $ 1:153  : int  1 2 3 4 5 6 7 8 9 10 ...

Regards
Petr