Stephan
Try:
tapply(y[,2], y[,1], function(x) any(x==5))
Peter Alspach
> -Original Message-
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On Behalf Of Stephan Lindner
> Sent: Thursday, 20 November 2008 7:48 a.m.
> To: [EMAIL PROTECTED]
> Subject:
Try this:
sapply(tapply(y[,2],na.omit(y[,1]), `==`, 5), any)
On Wed, Nov 19, 2008 at 4:47 PM, Stephan Lindner <[EMAIL PROTECTED]> wrote:
>
> Dear all,
>
>
> A quick question which I somehow cannto figure out: I want to apply
> the function "any" to subsets of a dataset in order to create a vecto
Dear all,
A quick question which I somehow cannto figure out: I want to apply
the function "any" to subsets of a dataset in order to create a vector
with TRUE/FALSE values, depending on whether a subset has the number
5. I.e.,
y <- matrix(c(1,2,3,3,4,5,5,6,6,7,5,1,1,3,5,NA,5,1,1,3),ncol=2)
> y
3 matches
Mail list logo