Re: [R] Selection with changing number of columns

2010-07-06 Thread Peter Alspach
r-help-boun...@r- > project.org] On Behalf Of Kunzler, Andreas > Sent: Tuesday, 6 July 2010 8:34 p.m. > To: r-help@r-project.org > Subject: [R] Selection with changing number of columns > > Dear list, > > I'm looking for a way to select rows of a data.frame with chang

Re: [R] Selection with changing number of columns

2010-07-06 Thread Henrique Dallazuanna
Try this: d[colSums(d == 9)] On Tue, Jul 6, 2010 at 5:33 AM, Kunzler, Andreas wrote: > Dear list, > > I'm looking for a way to select rows of a data.frame with changing number > of columns (constraint) involved. > > Assume a data (d) structure like > > > Var.1 Var.2 Var.3 > 9 2 1 >

Re: [R] Selection with changing number of columns

2010-07-06 Thread Allan Engelhardt
I'm not sure your question completely makes sense, but perhaps this will help: set.seed(1) d<- data.frame(matrix(floor(runif(100, max=10)), 10)) # Example data d[apply(d == 9, 1, any), ] # Select rows with 9 in any column ## Or more generally: d[ , c(1, 2, 3)] == c(2, 2, 9)

[R] Selection with changing number of columns

2010-07-06 Thread Kunzler, Andreas
Dear list, I'm looking for a way to select rows of a data.frame with changing number of columns (constraint) involved. Assume a data (d) structure like Var.1 Var.2 Var.3 9 2 1 2 9 5 1 2 1 I know the number of involved columns. Is there a way to generate th