Vote count:
0
I write some code to get back the row.names of a clustering result going from 1 to 16. That's working but that's a lot of lines as you can see :
Factor1 <- row.names(subset(res.uc.df, uc.seed17 == 1))
Factor2 <- row.names(subset(res.uc.df, uc.seed17 == 2))
Factor3 <- row.names(subset(res.uc.df, uc.seed17 == 3))
Factor4 <- row.names(subset(res.uc.df, uc.seed17 == 4))
Factor5 <- row.names(subset(res.uc.df, uc.seed17 == 5))
Factor6 <- row.names(subset(res.uc.df, uc.seed17 == 6))
Factor7 <- row.names(subset(res.uc.df, uc.seed17 == 7))
Factor8 <- row.names(subset(res.uc.df, uc.seed17 == 8))
Factor9 <- row.names(subset(res.uc.df, uc.seed17 == 9))
Factor10 <- row.names(subset(res.uc.df, uc.seed17 == 10))
Factor11 <- row.names(subset(res.uc.df, uc.seed17 == 11))
Factor12 <- row.names(subset(res.uc.df, uc.seed17 == 12))
Factor13 <- row.names(subset(res.uc.df, uc.seed17 == 13))
Factor14 <- row.names(subset(res.uc.df, uc.seed17 == 14))
Factor15 <- row.names(subset(res.uc.df, uc.seed17 == 15))
Factor16 <- row.names(subset(res.uc.df, uc.seed17 == 16))
So, I just write my very first loop to reduce the number of lines and optimize the code but sadly that's not working.
Factor=NULL
for(i in 1:16) {
Factor[i] <- row.names(subset(res.uc.df, uc.seed17 == i))
}
Can someone point out the mistake I made ?
asked 3 mins ago
Get back the row names using a loop
Aucun commentaire:
Enregistrer un commentaire