[R] Convert list to data frame

Ivan Calandra ivan.calandra at univ-reims.fr
Sat Feb 27 15:56:15 CET 2016


Hi,

I have seen this question a few days/weeks ago...

Data.frames are special list, so it's normal.
Read the help for read.table(), especially the "value" section (where 
the output of the function is described). And read also some 
introductory material, where the different data types are explained.

HTH,
Ivan

--
Ivan Calandra, PhD
University of Reims Champagne-Ardenne
GEGENAA - EA 3795
CREA - 2 esplanade Roland Garros
51100 Reims, France
+33(0)3 26 77 36 89
ivan.calandra at univ-reims.fr
--
https://www.researchgate.net/profile/Ivan_Calandra
https://publons.com/author/705639/

Le 27/02/2016 15:04, asma.rabe at gmail.com a écrit :
> Hi,
>
> I  read data from file as follows
>
> Data<-read.table("file.txt",header=T,sep="\t")
>
> mode(Data)
> list
>
> I want to convert data to data frame, I tried the following:
>
> as.data.frame(Data)
> data.frame(Data)
>
> But the Data did not change
>
> When I tried
> as.data.frame(unlist(Data))
>
> The Data converted to a vector not to a data frame. Any idea ?
>
> Thank you in advance
>
>
> Sent from my iPhone
>
> ______________________________________________
> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
> 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.
>



More information about the R-help mailing list