[R] (no subject)

arun smartpink111 at yahoo.com
Mon Aug 20 14:59:32 CEST 2012


Hi,
Try this:
dat1<-read.table(text="
1   0  1
2   1  2
3   0  3
4   1  4
5   0  5
6   1  6
7   0  7
8   1  8
9   0  9
10  1 10 
",sep="",header=FALSE)
 dat2<-dat1[,-1]
combn((subset(dat2,V2==0))$V3,2)
     [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
[1,]    1    1    1    1    3    3    3    5    5     7
[2,]    3    5    7    9    5    7    9    7    9     9

A.K.



----- Original Message -----
From: Dikán Szabolcs András <dikanszabolcs at freemail.hu>
To: R-help at r-project.org
Cc: 
Sent: Sunday, August 19, 2012 8:14 PM
Subject: [R] (no subject)

Dear R Users! I'm new in R! I've got a data.frame. For example:a<-data.frame(cbind(  0:1,   1:10))   X1 X2
1   0  1
2   1  2
3   0  3
4   1  4
5   0  5
6   1  6
7   0  7
8   1  8
9   0  9
10  1 10 Firstly i want to create combinations from  X2, for example:combn(a$X2,2) It's ok, butsecondly I would like to get combinations from those X2 numbers only , where X1= 0. Could you help me? Thanks!          
    [[alternative HTML version deleted]]

______________________________________________
R-help at 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.





More information about the R-help mailing list