Re: [R] Convert list to data frame

2016-02-27 Thread Jeff Newmiller
I think the advice about the file format is an track, but you imply modifying the file as a solution but that is probably not the best approach. Using a decent text editor that shows you what invisible characters are in the file can guide you in adjusting the arguments to read.table. for example

Re: [R] Convert list to data frame

2016-02-27 Thread David Winsemius
> On Feb 27, 2016, at 6:04 AM, > 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, It is already a dataframe. That is the class of object that read.table returns. > I tr

Re: [R] Convert list to data frame

2016-02-27 Thread Karim Mezhoud
To known the format of your object, please use class(Data) str(Data) Be sure to have regular space between strings in your file.txt. Karim On Sat, Feb 27, 2016 at 3:56 PM, Ivan Calandra wrote: > Hi, > > I have seen this question a few days/weeks ago... > > Data.frames are special list, so it's

Re: [R] Convert list to data frame

2016-02-27 Thread Ivan Calandra
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 expla

[R] Convert list to data frame

2016-02-27 Thread asma.rabe
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

Re: [R] Convert list to data frame

2016-02-15 Thread Duncan Murdoch
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 alread

Re: [R] Convert list to data frame

2016-02-15 Thread Sarah Goslee
On Monday, February 15, 2016, wrote: > Hi, > > I read data from file as follows > > Data<-read.table("file.txt",header=T,sep="\t") > > mode(Data) > list Data is a data frame; that's what read.table() produces. A data frame is a special type of list. Take a look at class(Data) > > I want to

[R] Convert list to data frame

2016-02-15 Thread asma . rabe
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

Re: [R] Convert list to data frame while controlling column types

2009-08-24 Thread Alexander Shenkin
On 8/24/2009 2:06 AM, Petr PIKAL wrote: > Hi > > r-help-boun...@r-project.org napsal dne 23.08.2009 17:29:48: > >> On 8/23/2009 9:58 AM, David Winsemius wrote: >>> I still have problems with this statement. As I understand R, this >> should be impossible. I have looked at both you postings and ne

Re: [R] Convert list to data frame while controlling column types

2009-08-24 Thread Petr PIKAL
Hi r-help-boun...@r-project.org napsal dne 23.08.2009 17:29:48: > On 8/23/2009 9:58 AM, David Winsemius wrote: > > I still have problems with this statement. As I understand R, this > should be impossible. I have looked at both you postings and neither of > them clarify the issues. How can you ha

Re: [R] Convert list to data frame while controlling column types

2009-08-23 Thread Alexander Shenkin
On 8/23/2009 9:58 AM, David Winsemius wrote: > I still have problems with this statement. As I understand R, this should be impossible. I have looked at both you postings and neither of them clarify the issues. How can you have blanks or spaces in an R numeric vector? Just because I search numeri

Re: [R] Convert list to data frame while controlling column types

2009-08-23 Thread David Winsemius
On Aug 23, 2009, at 2:47 AM, Alexander Shenkin wrote: On 8/21/2009 3:04 PM, David Winsemius wrote: On Aug 21, 2009, at 3:41 PM, Alexander Shenkin wrote: Thanks everyone for their replies, both on- and off-list. I should clarify, since I left out some important information. My original dat

Re: [R] Convert list to data frame while controlling column types

2009-08-22 Thread Alexander Shenkin
On 8/21/2009 3:04 PM, David Winsemius wrote: > > On Aug 21, 2009, at 3:41 PM, Alexander Shenkin wrote: > >> Thanks everyone for their replies, both on- and off-list. I should >> clarify, since I left out some important information. My original >> dataframe has some numeric columns, which get ch

Re: [R] Convert list to data frame while controlling column types

2009-08-21 Thread David Winsemius
On Aug 21, 2009, at 3:41 PM, Alexander Shenkin wrote: Thanks everyone for their replies, both on- and off-list. I should clarify, since I left out some important information. My original dataframe has some numeric columns, which get changed to character by gsub when I replace spaces with NAs.

Re: [R] Convert list to data frame while controlling column types

2009-08-21 Thread Alexander Shenkin
Thanks everyone for their replies, both on- and off-list. I should clarify, since I left out some important information. My original dataframe has some numeric columns, which get changed to character by gsub when I replace spaces with NAs. Thus, in going back to a dataframe, those (now character

Re: [R] Convert list to data frame while controlling column types

2009-08-21 Thread David Winsemius
On Aug 21, 2009, at 11:47 AM, Alexander Shenkin wrote: Hello all, I have a list which I'd like to convert to a data frame, while maintaining control of the columns' data types (akin to the colClasses argument in read.table). My numeric columns, for example, are getting converted to factors by

Re: [R] Convert list to data frame while controlling column types

2009-08-21 Thread Steve Lianoglou
Hi Allie, On Aug 21, 2009, at 11:47 AM, Alexander Shenkin wrote: Hello all, I have a list which I'd like to convert to a data frame, while maintaining control of the columns' data types (akin to the colClasses argument in read.table). My numeric columns, for example, are getting converted to

[R] Convert list to data frame while controlling column types

2009-08-21 Thread Alexander Shenkin
Hello all, I have a list which I'd like to convert to a data frame, while maintaining control of the columns' data types (akin to the colClasses argument in read.table). My numeric columns, for example, are getting converted to factors by as.data.frame. Is there a way to do this, or will I have