Re: [R] match rows of data frame

From: jim holtman <jholtman_at_gmail.com>
Date: Fri, 08 Jun 2007 08:16:46 -0400

try:

FiveDaysLater <- A[match(rownames(B),rownames(A))+5,]

On 6/7/07, Alfonso Sammassimo <cincinattikid_at_bigpond.com> wrote:
>
> Hi R-experts,
>
> I have a data frame (A) , and a subset (B) of this data frame. I am trying
> to create a new data frame which gives me all the rows of B, plus the 5th
> next row(occuring in A). I have used the below code, but it gives me all
> 5
> rows after the matching row. I only want the 5th.
>
> FiveDaysLater <- A[c(sapply(match(rownames(B),rownames(A)), seq,
> length=6))),]
>
> Any guidance much appreciated,
> Thankyou.
>
> Alfonso Sammassimo
> Melbourne, Australia.
>
> ______________________________________________
> R-help_at_stat.math.ethz.ch 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.
>

-- 
Jim Holtman
Cincinnati, OH
+1 513 646 9390

What is the problem you are trying to solve?

	[[alternative HTML version deleted]]

______________________________________________
R-help_at_stat.math.ethz.ch 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.
Received on Fri 08 Jun 2007 - 12:27:27 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Fri 08 Jun 2007 - 12:31:45 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.