Re: [R] if else statement in loop

2014-09-29 Thread PIKAL Petr
e(1:3, .Label = c("samas4", "samas5", "samas6" ), class = "factor")), .Names = c("FID", "IID"), class = "data.frame", row.names = c(NA, -3L)) > -Original Message- > From: Kate Ignatius [mailto:kate.ignat...@g

Re: [R] if else statement in loop

2014-09-29 Thread Kate Ignatius
Ooops, I edited the code wrong to make it more easier for interpretation and got X and Y's mixed up. Try this: for(i in length(1:(nrow(X{ Y$IID1new <- ifelse((as.character(Y[,2]) == as.character(X[,i]) & Y$IID1new != ''), as.character(as.matrix(X[,(nrow(X)+i)])),'') } The second should

Re: [R] if else statement in loop

2014-09-28 Thread PIKAL Petr
Hi Please, be more clear in what do you want. I get many errors trying your code and your explanation does not help much. > for(i in length(1:(2*nrow(X{ + Y$IID1new <- ifelse((as.character(Y[,2]) == as.characterXl[,i]) & X$IID1new != '') , as.character(as.matrix(X[,(2*nrow(X)+i)])),'')