Hi,

The following should work:

> x <- paste(paste(data2$V4, data2$V5), data2$V6, sep='.')
> startt <- strptime(x, "%Y-%m-%d %H:%M:%OS")

Regards,
Pascal


2013/4/12 Cat Cowie <cat.e.co...@gmail.com>

> Hi R forum,
>
> Each row of my data (below) show a new contact event between animals.
> In order to ultimately look at the patterns of intervals between
> contacts, I need to calculate a contact end time. The contact starts
> at the date and time shown in V4 and V5, and lasts for the duration
> shown IN SECONDS in V6:
>
>
> > data2<- read.csv(file=file.choose(), header=F, sep=" ")
> > head(data2)
>   V1  V2  V3         V4       V5 V6
> 1  3 PO4 CO1 2011-04-29 07:27:21 28
> 2  3 PO4 CO1 2011-04-24 05:57:39 20
> 3  3 PO4 CO1 2011-04-14 10:29:49  4
> 4  3 PO4 CO1 2011-04-16 07:27:31 63
> 5  3 PO4 CO1 2011-04-18 15:46:20  1
> 6  3 PO4 CO1 2011-04-18 15:45:57  1
>
> To start with I have tried to make the start data and time into one new
> column:
>
> startt<- strptime((paste(data2$V4, data2$V5)), "%d/%m/%Y %H:%M:%S")
>
>
> This executes without any warnings, but returns a full column of NA
> values. It would be great to fix this, and then to know how to
> correctly add column V6 as seconds to the resulting column.
>
>
> The problem is further exacerbated by an error with dput() with this
> data. It's a large dataset of over 9000 rows, and when I call:
>
> dput(head(data2,50))
>
> It returns dput(), but for all the data (i.e. not the first 50 rows).
> This of course does not fit on the workstation screen and therefore I
> cannot find out what class it has assigned to any of the data. The
> times appear sorted, suggesting they are being classed as a factor?
> Sorry I can't provide dput() data!
>
> Thanks, Cat
>
> ______________________________________________
> 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