[R] Selection with changing number of columns

Kunzler, Andreas a.kunzler at bzaek.de
Tue Jul 6 10:33:50 CEST 2010


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 at bzaek.de 



More information about the R-help mailing list