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
Hi Peter,
Thanks! This was very helpful and worked perfectly.
Naomi
On Apr 4, 2012, at 4:52 PM, Peter Alspach wrote:
Tena koe Naomi
There are lots of ways to do this. Here are a couple (note I've
made a minor modification to your example):
naomi
C1 C2 C3
1 1 x 1
2 1 x 2
3 1 y
Tena koe Naomi
There are lots of ways to do this. Here are a couple (note I've made a minor
modification to your example):
> naomi
C1 C2 C3
1 1 x 1
2 1 x 2
3 1 y 1
4 1 y 2
5 2 x 1
6 2 x 2
7 2 x 3
8 2 y 1
9 2 y 2
> tapply(naomi[,3], naomi[,1:2], function(x) x[length
3 matches
Mail list logo