Re: [R] Selecting obs within groups defined by 2 variables

2012-04-04 Thread Rui Barradas
Hello, > > The by function does not seem to allow two variables in the Indices > argument: > Yes it does, but you must use a list of variables. (Read the help for 'by': INDICESa factor or a list of factors, each of length nrow(data).) mydata <- read.table(text=" C1 C2 C3 1 x 1 1 x 2 1

Re: [R] Selecting obs within groups defined by 2 variables

2012-04-04 Thread Naomi Sugie
spach -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org ] On Behalf Of Naomi Sugie Sent: Thursday, 5 April 2012 8:21 a.m. To: r-help@r-project.org Subject: [R] Selecting obs within groups defined by 2 variables Hello, I am relatively new to R, and I am t

Re: [R] Selecting obs within groups defined by 2 variables

2012-04-04 Thread Peter Alspach
ehalf Of Naomi Sugie Sent: Thursday, 5 April 2012 8:21 a.m. To: r-help@r-project.org Subject: [R] Selecting obs within groups defined by 2 variables Hello, I am relatively new to R, and I am trying to select the last observation within a group, where the group is defined by two variables. One of

[R] Selecting obs within groups defined by 2 variables

2012-04-04 Thread Naomi Sugie
Hello, I am relatively new to R, and I am trying to select the last observation within a group, where the group is defined by two variables. One of the variables is a date. In the below example, C3 varies within C2, which varies within C1. I need to select the last observation in C3 for 4