[R] Data formart
Amos B. Elberg
amos.elberg at gmail.com
Wed Oct 8 21:20:33 CEST 2014
You can adapt: format(as.Date(paste(Year, sep = "-", ifelse(Year %% 4 == 0, Start, ifelse(Start > 59, Start - 1, Start))), "%Y-%j"), "%b %d”)
But 60% of the dates in your data.frame will then be wrong.
From: Frederic Ntirenganya <ntfredo at gmail.com>
Reply: Frederic Ntirenganya <ntfredo at gmail.com>>
Date: October 8, 2014 at 9:38:34 AM
To: r-help at r-project.org <r-help at r-project.org>>
Subject: [R] Data formart
Dear All,
Change the format of the start and end columns so that data appear as the
day of the year. For instance: Apr 24 rather than 115.
The idea is that I want the non=leap years to be 366 days instead of being
365 days. ie. Each year must have 366 days. for example: in the column
Start2, Apr 18 will be Apr 17.
> head(Samaru)
Year Start End Length Start2 End2
1 1930 108 288 180 Apr 18 Oct 15
2 1931 118 288 170 Apr 28 Oct 15
3 1932 115 295 180 Apr 24 Oct 21
4 1933 156 294 138 Jun 05 Oct 21
5 1934 116 291 175 Apr 26 Oct 18
6 1935 134 288 154 May 14 Oct 15
Any idea is welcome. Thamks!!!!
--
Frederic Ntirenganya
Maseno University,
Kenya.
Mobile:(+254)718492836
Email: fredo at aims.ac.za
https://sites.google.com/a/aims.ac.za/fredo/
[[alternative HTML version deleted]]
______________________________________________
R-help at r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
[[alternative HTML version deleted]]
More information about the R-help
mailing list