Re: [R] Changing date format

2014-10-10 Thread John McKown
On Fri, Oct 10, 2014 at 1:32 AM, Frederic Ntirenganya wrote: Please try to not post in HTML. It is one of the forum "rules". > Dear All, > > The following function gives me what I wanted. > The input of function is one value and this push me to use sapply function > to call it. > > Is there a be

Re: [R] Changing date format

2014-10-10 Thread PIKAL Petr
ome data. I do not believe that anybody violates calendar in such a way that all years have 366 days. I may be mistaken but isn’t ?merge function what you really want? Petr From: Frederic Ntirenganya [mailto:ntfr...@gmail.com] Sent: Friday, October 10, 2014 8:33 AM To: Duncan Murdoch Cc: PIK

Re: [R] Changing date format

2014-10-09 Thread Frederic Ntirenganya
= On Thu, Oct 9, 2014 at 3:48 PM, Duncan Murdoch wrote: > On 09/10/2014, 8:27 AM, PIKAL Petr wrote: > > Hi > > > >> -Original Message- > >> From: r-help-boun...@r-project.org [mailto:r-help-bounces@r- > >> project.org] On Behalf Of Frederic Ntireng

Re: [R] Changing date format

2014-10-09 Thread Duncan Murdoch
t; Cc: r-help@r-project.org >> Subject: Re: [R] Changing date format >> >> This idea substract 1 for the all column which is not what i want. >> >> We know that the leap years have 366 days. I don't need to change >> anything on them >> >> the non

Re: [R] Changing date format

2014-10-09 Thread Frederic Ntirenganya
ric Ntirenganya > > Sent: Thursday, October 09, 2014 1:32 PM > > To: Jim Lemon > > Cc: r-help@r-project.org > > Subject: Re: [R] Changing date format > > > > This idea substract 1 for the all column which is not what i want. > > > > We know that t

Re: [R] Changing date format

2014-10-09 Thread PIKAL Petr
Hi > -Original Message- > From: r-help-boun...@r-project.org [mailto:r-help-bounces@r- > project.org] On Behalf Of Frederic Ntirenganya > Sent: Thursday, October 09, 2014 1:32 PM > To: Jim Lemon > Cc: r-help@r-project.org > Subject: Re: [R] Changing date format >

Re: [R] Changing date format

2014-10-09 Thread Frederic Ntirenganya
This idea substract 1 for the all column which is not what i want. We know that the leap years have 366 days. I don't need to change anything on them the non-leap years have 365 days. This is what i want to change to be 366 days rather than 365 days. On Thu, Oct 9, 2014 at 1:07 PM, Jim Lemon wr

Re: [R] Changing date format

2014-10-09 Thread Jim Lemon
On Thu, 9 Oct 2014 12:30:57 PM Frederic Ntirenganya wrote: > Hi Lemon, > > I am using the code you sent. It's correct for the leap years. > What I want to do is to have both leap and no-leap years to have 366 days. > that means the 1st March is day 61 of each year. > This will help me to link it

Re: [R] Changing date format

2014-10-09 Thread Frederic Ntirenganya
Hi Lemon, I am using the code you sent. It's correct for the leap years. What I want to do is to have both leap and no-leap years to have 366 days. that means the 1st March is day 61 of each year. This will help me to link it with Instat for climatic data analysis. On Thu, Oct 9, 2014 at 11:54 A

Re: [R] Changing date format

2014-10-09 Thread Jim Lemon
On Wed, 8 Oct 2014 04:49:02 PM Frederic Ntirenganya wrote: > 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 Star

Re: [R] Changing date format

2014-10-08 Thread Frederic Ntirenganya
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 288180 Apr 18 Oct 15 2 1931 118 288170 Apr 2

Re: [R] Changing date format

2014-10-07 Thread Frederic Ntirenganya
Thanks All. Your idea is useful!!! On Tue, Oct 7, 2014 at 1:01 PM, Jim Lemon wrote: > On Tue, 7 Oct 2014 11:51:34 AM Göran Broström wrote: > > On 2014-10-07 11:27, Jim Lemon wrote: > > > On Tue, 7 Oct 2014 10:32:42 AM Frederic Ntirenganya wrote: > > >> Dear All, > > >> > > >> How can I change th

Re: [R] Changing date format

2014-10-07 Thread Jim Lemon
On Tue, 7 Oct 2014 11:51:34 AM Göran Broström wrote: > On 2014-10-07 11:27, Jim Lemon wrote: > > On Tue, 7 Oct 2014 10:32:42 AM Frederic Ntirenganya wrote: > >> Dear All, > >> > >> How can I change the format of date of day of the year ? for > > > > example r > > > >> (i.e. "17 Apr" rather than

Re: [R] Changing date format

2014-10-07 Thread Göran Broström
On 2014-10-07 11:27, Jim Lemon wrote: On Tue, 7 Oct 2014 10:32:42 AM Frederic Ntirenganya wrote: Dear All, How can I change the format of date of day of the year ? for example r (i.e. "17 Apr" rather than "108"). The following is the type of the dataset I have head(Samaru) Year Start E

Re: [R] Changing date format

2014-10-07 Thread Jim Lemon
On Tue, 7 Oct 2014 10:32:42 AM Frederic Ntirenganya wrote: > Dear All, > > How can I change the format of date of day of the year ? for example r > (i.e. "17 Apr" rather than "108"). > > The following is the type of the dataset I have > > head(Samaru) > Year Start End Length > 1 1930 108 28

[R] Changing date format

2014-10-07 Thread Frederic Ntirenganya
Dear All, How can I change the format of date of day of the year ? for example r (i.e. "17 Apr" rather than "108"). The following is the type of the dataset I have head(Samaru) Year Start End Length 1 1930 108 288180 2 1931 118 288170 3 1932 115 295180 4 1933 156 294138

Re: [R] changing date format in a dataframe

2011-11-16 Thread Milan Bouchet-Valat
Le mercredi 16 novembre 2011 à 06:12 -0800, arunkumar a écrit : > Hi > > I have a data frame and i need to change the date format in it. > my dataframe > > X Date > 1 1/1/2009 > 2 2/1/2009 > 3 3/1/2009 > > I need to change it to 2009-01-01 See ?as.Date. In your case, I think you should use

Re: [R] changing date format in a dataframe

2011-11-16 Thread Mohamed Lajnef
Hi, If the dates are the same format and the same length you can try this : dates<-c("1/1/2009","2/1/2009","3/1/2009") dates_new<-as.Date(paste(substr(dates,1,3),substr(dates,7,8),sep="/"),format="%d/%m/%y"), you can change the format to "%m/%d/%y" Regards M Le 16/11/11 15:12, arunkumar

Re: [R] changing date format in a dataframe

2011-11-16 Thread R. Michael Weylandt
Can you dput() your data frame? There are a different few time objects in R and details might depend which one you have. Though, if it's printing like that, I'd guess it's actually a string that you can convert to a Date using as.Date(, format = XXX) where you can work out the formatting from the d

[R] changing date format in a dataframe

2011-11-16 Thread arunkumar1111
Hi I have a data frame and i need to change the date format in it. my dataframe X Date 1 1/1/2009 2 2/1/2009 3 3/1/2009 I need to change it to 2009-01-01 -- View this message in context: http://r.789695.n4.nabble.com/changing-date-format-in-a-dataframe-tp4076411p4076411.html Sent from the R