Why not use rep instead of gl: levels <- c('BR', 'CNS', 'CO', 'LE', 'ME', 'LC', 'OV', 'PR', 'RE') reps <- c(4, 6, 7, 6, 10, 9, 7, 2, 8) rep(levels, reps)
David On 10 February 2016 at 05:02, hehsham alpukhity via R-help < r-help@r-project.org> wrote: > I am trying to use the function gl (generate levels with different number > of replications), generate different number of replications in each > level.examplei have factor with this levels (BR,CNS ,CO,LE,ME,LC,OV,PR,RE), > and the replications is not the same , i want (4 replication for BR),( 6 > replications for > CNS,7 replications for CO,6 for LE,10 for ME,9 for LC,7 for OV, 2 for PR > ,and 8 for RE).thank you v much . Hisham AL-bukhaiti Ph.D > Student (Information system ) China, changsha,Hunan university. Mobile: > 0068-15 111 4246 91. > [[alternative HTML version deleted]] > > ______________________________________________ > R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see > 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. [[alternative HTML version deleted]] ______________________________________________ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see 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.