Hi,
to achieve a matrix or data frame like you are looking for, I would use
> cbind(unlist(FOO), unlist(FRED))
[,1] [,2]
[1,] 1 5
[2,] 2 6
[3,] 3 7
[4,] 4 8
If your point was to achive suitable row and col names, I would perhaps use
dimnames()<- You may consider giving a new name for unlisted variables,
e.g.
foo <- unlist(FOO)
fred <- unlist(FRED)
and then you get colnames in your dataframe.
Perhaps it helps.
Ott
On Fri, 23 Aug 2002, Ko-Kang Kevin Wang wrote:
|Hi,
|
|Suppose I have two lists. The first list is called FOO while the second
|is called FRED.
|
|Say FOO looks (I've simplifed it) like:
| [[1]]
| [,1]
| [1,] 1
| [2,] 2
|
| [[2]]
| [,1]
| [1,] 3
| [2,] 4
|while FRED looks like:
| [[1]]
| [,1]
| [1,] 5
| [2,] 6
|
| [[2]]
| [,1]
| [1,] 7
| [2,] 8
|
|Can I turn this list into a dataframe which looks like:
| FOO FRED
| theta1.1 1 5
| theta2.1 2 6
| theta1.2 3 7
| theta2.2 4 8
|or something close to this form?
|
|In fact what I will have some 20 rows with something like:
| theta1.1
| theta2.1
| theta1.2
| theta2.2
| theta1.3
| theta2.3
| .
| .
| .
|
|However, I'm not sure how to achieve this.
|
|Thanks in advance for the help
|
|Cheers,
|
|Kevin
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !) To: r-help-request at
stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._