Hi Mark.
Have a look at the commands:
merge
and
cbind
I believe they may hold the key.
I hope this helps :-)
Tal
On Mon, May 4, 2009 at 5:38 AM, Mark Na <mtb954@gmail.com> wrote:
> Dear R-helpers,
>
> I have a dataframe called "trackpoints" with several columns
including
> a column called "time", eg:
>
> > trackpoints
> time
> 1 12:00:00
> 2 12:00:01
> 3 12:00:02
> .
> .
> .
> 298 12:04:57
> 299 12:04:58
> 300 12:04:59
>
> I also have a dataframe called "data" that contains columns
called
> "ID", "start" and "stop", eg:
>
> > data
> ID start stop
> 1 1 12:00:00 12:01:30
> 2 2 12:02:16 12:03:01
> 3 3 12:03:58 12:04:31
>
> I wish to make a dataframe called "extracted" containing only the
rows
> in "trackpoints" with a value of "time" bounded by the
times in
> data$start and data$stop and a column called "ID" containing the
value
> from data$ID, eg:
>
> > extracted
> Time ID
> 1 12:00:00 1
> 2 12:00:01 1
> 3 12:00:02 1
> .
> .
> .
> 89 12:01:28 1
> 90 12:01:29 1
> 91 12:01:30 1
>
> I have the vague notion that I might have to loop this, but I think it
> would be cleaner to use logical subscripts, if possible.
> I'd appreciate any help you might be able to provide.
>
> Thanks! Mark Na
>
> ______________________________________________
> 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.
>
--
----------------------------------------------
My contact information:
Tal Galili
Phone number: 972-50-3373767
FaceBook: Tal Galili
My Blogs:
http://www.r-statistics.com/
http://www.talgalili.com
http://www.biostatistics.co.il
[[alternative HTML version deleted]]