Dear Ophelia,
     If your dataframe is already in memory, simply write
    as.character(rep(dat[,1],dat[,2]) , 
to finish the task.

Aegiinte        3
Agonperu      3
Aiouimpr       2
Albiniop        2
Albisubd       1
..................
else, you may try the following code, if your data is saved on the disk.

dat <- read.csv("dat2.csv")
writeLines(as.character(rep(dat[,1],dat[,2])), "Lines.csv")

Hope these commands will help.

best,
Jinlong


2010-12-06 



Jinlong Zhang 
Ph.D.Candidate
State Key Laboratory for Vegetation and Environmental Change,
Institute of Botany, The Chinese Academy of Sciences
Nanxincun 20,Xiangshan, Beijing 100093
E-mails: 
zhangjl@ibcas.ac.cn
jinlongzhang01@gmail.com




发件人： Ophelia Wang 
发送时间： 2010-12-06  16:51:21 
收件人： r-sig-ecology 
抄送： 
主题： [R-sig-eco] Converting species counts into species list 
 
Hello,
I have a list of species and abundance that looks like this:
Aegiinte        3
Agonperu      3
Aiouimpr       2
Albiniop        2
Albisubd       1
..................
And I need to convert these two columns into a column in which each
cell represents an individual of a articular species:
Aegiinte
Aegiinte
Aegiinte
Agonperu
Agonperu
Agonperu
Aiouimpr
Aiouimpr
Albiniop
Albiniop
Albisubd
.........
Can someone help me to develop a script to do the conversion?
Thanks a lot!
Ophelia
_______________________________________________
R-sig-ecology mailing list
R-sig-ecology@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-ecology

	[[alternative HTML version deleted]]

