Hi!
I'm sure there's an easier way, but that works for me:
test_list <- list(c("ABC","5","0"),
c("DEF","10","1")) ##just a part of
your example, think about using dput() to create a copy/pastable example
test_df <- t(as.data.frame(test_list)[-1,])
rownames(test_df) <- t(as.data.frame(test_list)[1,])
HTH,
Ivan
Le 9/6/2010 13:41, rajeshj@cse.iitm.ac.in a écrit :> Hi,
> I have a list which looks like this...
>> str(y)
> List of 10
> $ : chr [1:4] "ABCD" "5" "0" "1"
> $ : chr [1:4] "DEF" "15" "1" "16"
> $ : chr [1:4] "AAA" "2" "17" "8"
> $ : chr [1:4] "SSS" "15" "25" "1"
> $ : chr [1:4] "III" "15" "26" "4"
> $ : chr [1:4] "OPQ" "7" "30" "4"
> $ : chr [1:4] "TYR" "14" "34" "8"
> $ : chr [1:4] "IRTS" "15" "42"
"1"
> $ : chr [1:4] "LLL" "15" "43" "2"
> $ : chr [1:4] "AQW" "3" "45" "4"
>
> I need to create a dataframe whose row names are chr[1] of each vector..ie
ABCD,DEF,AAA ETC. how can I do this?
> [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help@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.
>
--
Ivan CALANDRA
PhD Student
University of Hamburg
Biozentrum Grindel und Zoologisches Museum
Abt. Säugetiere
Martin-Luther-King-Platz 3
D-20146 Hamburg, GERMANY
+49(0)40 42838 6231
ivan.calandra@uni-hamburg.de
**********
http://www.for771.uni-bonn.de
http://webapp5.rrz.uni-hamburg.de/mammals/eng/mitarbeiter.php
[[alternative HTML version deleted]]