On 15/02/2016 7:41 AM, asma.r...@gmail.com wrote:
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
It is already a dataframe. Whoever told you that mode(Data) is the way
to test for that is giving you bad advice. (Probably the same source
that said T always means TRUE.)
There's a function is.data.frame() that does the proper test, i.e.
inherits(Data, "data.frame")
Or you can look at class(Data).
Duncan Murdoch
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
______________________________________________
R-help@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.
______________________________________________
R-help@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.