Hi.

See
http://stackoverflow.com/questions/1995933/number-of-months-between-two-dates

Andrija


On Thu, Jul 11, 2013 at 11:56 AM, Gallon Li <gallon...@gmail.com> wrote:

> My data are from 2008 to 2010, with repeated measures for same subjects. I
> wish to compute number of months since january 2008.
>
> The data are like the following:
>
> ID date
> 1 4/12/2008
> 1 4/13/2008
> 1 5/11/2008
> 2 3/21/2009
> 2 4/22/2009
> 2 8/05/2009
> ...
>
> the date column are in the format "%m/%d/%y". i wish to obtain
>
> ID month
> 1 4
> 1 4
> 1 5
> 2 15
> 2 16
> 2 20
> ...
>
> also, for the same ID with two identical month, I only want to keep the
> last one. can any expert help with this question?
>
>         [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help@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]]

______________________________________________
R-help@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.

Reply via email to