Skip to content
Prev 345976 / 398502 Next

Converting list to character

Or just modify your aggregate() command:
+        YEAR=mydata$YEAR), FUN=paste0, collapse=", ")
ID YEAR              x
1   986 2008         GR.3.8
2  1251 2008 GR.3.1, GR.3.8
3  1801 2008         GR.3.8
4    11 2009         GR.3.7
5   986 2009         GR.3.8
6  1251 2009 GR.3.1, GR.3.8
7  1801 2009         GR.3.8
8    11 2010         GR.3.7
9   460 2010         GR.3.1
10  986 2010         GR.3.8
11 1251 2010 GR.3.1, GR.3.8
12 1801 2010         GR.3.8
13  460 2011         GR.3.1
14  986 2011         GR.3.8
15 1251 2011 GR.3.1, GR.3.8
16 1801 2011         GR.3.8

-------------------------------------
David L Carlson
Department of Anthropology
Texas A&M University
College Station, TX 77840-4352



-----Original Message-----
From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org] On Behalf Of Lee, Chel Hee
Sent: Tuesday, November 25, 2014 11:23 AM
To: Massimiliano Tripoli; r-help at r-project.org
Subject: Re: [R] Converting list to character

 > do.call("rbind", TAB$x)
    [,1]     [,2]
1  "GR.3.8" "GR.3.8"
2  "GR.3.1" "GR.3.8"
4  "GR.3.8" "GR.3.8"
5  "GR.3.7" "GR.3.7"
6  "GR.3.8" "GR.3.8"
7  "GR.3.1" "GR.3.8"
9  "GR.3.8" "GR.3.8"
10 "GR.3.7" "GR.3.7"
11 "GR.3.1" "GR.3.1"
12 "GR.3.8" "GR.3.8"
13 "GR.3.1" "GR.3.8"
15 "GR.3.8" "GR.3.8"
16 "GR.3.1" "GR.3.1"
17 "GR.3.8" "GR.3.8"
18 "GR.3.1" "GR.3.8"
20 "GR.3.8" "GR.3.8"
 >

Is this what you are looking for?  I hope this helps.

Chel Hee Lee
On 11/25/2014 6:07 AM, Massimiliano Tripoli wrote:
______________________________________________
R-help at r-project.org 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.