Try this:

d[colSums(d == 9)]

On Tue, Jul 6, 2010 at 5:33 AM, Kunzler, Andreas <a.kunzler@bzaek.de> 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
> 2       9       5
> 1       2       1
>
> I know the number of involved columns.
>
> Is there a way to generate the following selection automatically (maybe for
> loop), so that it makes no difference if there are two or ten columns
> involved.
>
> Selection:
> d[d$Var.1==9 | d$Var.1==9 | d$Var.1==9  ,]
>
>
> Does anybody know a way?
>
> Thanks
>
> Mit freundlichen Grüßen
>
> Andreas Kunzler
> ____________________________
> Bundeszahnärztekammer (BZÄK)
> Chausseestraße 13
> 10115 Berlin
>
> Tel.: 030 40005-113
> Fax:  030 40005-119
>
> E-Mail: a.kunzler@bzaek.de
>
> ______________________________________________
> R-help@r-project.org 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.
>



-- 
Henrique Dallazuanna
Curitiba-Paraná-Brasil
25° 25' 40" S 49° 16' 22" O

	[[alternative HTML version deleted]]

