[AniMov] Re: problem in R

Clément Calenge calenge at biomserv.univ-lyon1.fr
Thu Feb 10 13:33:19 CET 2005


Hello,

>we have a problem in using R.
>We have tried to make analyses with our data but when we use the date since
>2000 the commands didn't work.
>For example, if we use a file like this
>id  x  y       date
>739 39100 42560 051204
>799 39100 42570 051204
>908 39100 42570 051204
>
>when we import it in R it is changed in
>
>      id         x          y        date
>1  739 39100 42560 51204
>2  799 39100 42570 51204
>3  908 39100 42570 51204
>
>and so we can't do anayses.
>Do you have any suggestions to solve this problem?
>Thank you very much for your help!


Use the argument "colClasses" of read.table.
For example, if your data are in a file named
locs.txt, import your data with:

a <- read.table("locs.txt", header = TRUE,
                 colClasses = c("numeric",
                 "numeric", "numeric",
                 "character"))

And then you can convert the column date
to the format POSIXt with:

a$date <- as.POSIXct( strptime(a$date, format = "%y%m%d") )

Hope this helps,


Clément

======================================
Clément CALENGE
LBBE - UMR CNRS 5558 - Université Claude Bernard Lyon 1 - FRANCE
tel. (+33) 04.72.43.27.57
fax. (+33) 04.72.43.13.88
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.faunalia.com/pipermail/animov/attachments/20050210/579e18b1/attachment.html


More information about the AniMov mailing list