Hi, How to get all list item to one string variable. example a[1]="abc" b[1]="def" output="abc def" Thanks B.Purushothaman -- View this message in context: http://r.789695.n4.nabble.com/How-to-get-all-list-item-to-one-string-variable-tp4636283.html Sent from the R help mailing list archive at Nabble.com.
With paste(). On Thursday, July 12, 2012, purushothaman wrote:> Hi, > > How to get all list item to one string variable. > > example > > a[1]="abc" > b[1]="def" > > output="abc def" > > Thanks > B.Purushothaman > > -- > View this message in context: > http://r.789695.n4.nabble.com/How-to-get-all-list-item-to-one-string-variable-tp4636283.html > Sent from the R help mailing list archive at Nabble.com. > > ______________________________________________ > R-help@r-project.org <javascript:;> 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. >-- Sarah Goslee http://www.stringpage.com http://www.sarahgoslee.com http://www.functionaldiversity.org [[alternative HTML version deleted]]
Hi,
What you did is equivalent to, but more complicated (and slower as well
I guess) than:
paste(a, collapse="")
Ivan
--
Ivan CALANDRA
Universit? de Bourgogne
UMR CNRS/uB 6282 Biog?osciences
6 Boulevard Gabriel
21000 Dijon, FRANCE
+33(0)3.80.39.63.06
ivan.calandra at u-bourgogne.fr
http://biogeosciences.u-bourgogne.fr/calandra
Le 12/07/12 14:54, arun.gurubaramurugeshan a ?crit :
Try this...
a<-c("abc","def","ghi","klm","nop","qrs","tuv","wxyz")
b<-data.frame()
for (i in 1:length(a)){
b<-paste(b,a[i],sep="")
}
print(b)
Thanks
Arun
---