[R] Need help on date calculation

2010-07-12 Thread Daniel Murphy
...@gmail.com To: Bogaso Christofer bogaso.christo...@gmail.com Cc: r-help@r-project.org Subject: Re: [R] Need help on date calculation Message-ID: aanlktimp7z4hhwn-qabdmeeigiyfn0um_aymsn5dx...@mail.gmail.com Content-Type: text/plain; charset=ISO-8859-1 On Sat, Jul 10, 2010 at 3:34 PM, Bogaso

[R] Need help on date calculation

2010-07-10 Thread Bogaso Christofer
Hi all, please see my code: library(zoo) a - as.yearmon(March-2010, %B-%Y) b - as.yearmon(May-2010, %B-%Y) nn - (b-a)*12 # number of months in between them nn [1] 2 as.integer(nn) [1] 1 What is the correct way to find the number of months between a and b, still retaining

Re: [R] Need help on date calculation

2010-07-10 Thread Gabor Grothendieck
On Sat, Jul 10, 2010 at 3:17 PM, Bogaso Christofer bogaso.christo...@gmail.com wrote: Hi all, please see my code: library(zoo) a - as.yearmon(March-2010, %B-%Y) b - as.yearmon(May-2010, %B-%Y) nn - (b-a)*12   # number of months in between them nn [1] 2 as.integer(nn) [1] 1

Re: [R] Need help on date calculation

2010-07-10 Thread Gabor Grothendieck
On Sat, Jul 10, 2010 at 3:07 PM, Gabor Grothendieck ggrothendi...@gmail.com wrote: On Sat, Jul 10, 2010 at 3:17 PM, Bogaso Christofer bogaso.christo...@gmail.com wrote: Hi all, please see my code: library(zoo) a - as.yearmon(March-2010, %B-%Y) b - as.yearmon(May-2010, %B-%Y) nn -

Re: [R] Need help on date calculation

2010-07-10 Thread Bogaso Christofer
Thanks Gabor for your input. However my question is, is your solution general for any value of a and b? -Original Message- From: Gabor Grothendieck [mailto:ggrothendi...@gmail.com] Sent: 11 July 2010 00:42 To: Bogaso Christofer Cc: r-help@r-project.org Subject: Re: [R] Need help on date

Re: [R] Need help on date calculation

2010-07-10 Thread David Winsemius
On Jul 10, 2010, at 3:17 PM, Bogaso Christofer wrote: Hi all, please see my code: library(zoo) a - as.yearmon(March-2010, %B-%Y) b - as.yearmon(May-2010, %B-%Y) nn - (b-a)*12 # number of months in between them nn [1] 2 as.integer(nn) [1] 1 What is the correct way to find the

Re: [R] Need help on date calculation

2010-07-10 Thread Gabor Grothendieck
On Sat, Jul 10, 2010 at 3:34 PM, Bogaso Christofer bogaso.christo...@gmail.com wrote: Thanks Gabor for your input. However my question is, is your solution general for any value of a and b? #1 and #2 are general. For #3 I think there is a possibility you might in general have to do the same

Re: [R] Need help on date calculation

2010-07-10 Thread Gabor Grothendieck
On Sat, Jul 10, 2010 at 3:17 PM, Gabor Grothendieck ggrothendi...@gmail.com wrote: On Sat, Jul 10, 2010 at 3:34 PM, Bogaso Christofer bogaso.christo...@gmail.com wrote: Thanks Gabor for your input. However my question is, is your solution general for any value of a and b? #1 and #2 are

Re: [R] Need help on date

2007-09-20 Thread Arun Kumar Saha
This mail is continuation of my previous one. i have some raw data from Excel which was carried to R: data = read.delim(file=clipboard, header=T) data Date Price 1 09/01/05 365 2 09/02/05 360 3 09/03/05 360 4 09/05/05 370 5 09/06/05 370 6 09/08/05 365 7 09/09/05 365 8

Re: [R] Need help on date

2007-09-19 Thread Gabor Grothendieck
If you are interested in regular expressions you may also be interested in a solution using the gsubfn package. Here x is the input character string, re is Jeffrey's regular expression and strapply applies the regular expression to x calling the function which is represented in formula notation