can anyone tell me how to import a text file in R? the text file I want to import is a large file, about 800MB in size. Thanks in advance. I tried using the following data<-read.table("file",header=T,sep="\t") -- View this message in context: http://r.789695.n4.nabble.com/import-text-file-into-R-tp2241525p2241525.html Sent from the R help mailing list archive at Nabble.com.
dhanush wrote:> can anyone tell me how to import a text file in R? the text file I want to > import is a large file, about 800MB in size. Thanks in advance. > > I tried using the following > > data<-read.table("file",header=T,sep="\t") > >And what happened?? Your specification is incomplete, as we don't know what your text file looks like. Is it CSV, etc.? How much memory does your system have?
That sounds like a good plan. What went wrong? You're more likely to get an answer if you tell us what your problem/question actually is. Sarah On Thu, Jun 3, 2010 at 7:32 AM, dhanush <dhana.sa at gmail.com> wrote:> > can anyone tell me how to import a text file in R? the text file I want to > import is a large file, about 800MB in size. Thanks in advance. > > I tried using the following > > data<-read.table("file",header=T,sep="\t") >-- Sarah Goslee http://www.functionaldiversity.org
What does the text look like? --- On Thu, 6/3/10, dhanush <dhana.sa at gmail.com> wrote:> From: dhanush <dhana.sa at gmail.com> > Subject: [R] import text file into R > To: r-help at r-project.org > Received: Thursday, June 3, 2010, 7:32 AM > > can anyone tell me how to import a text file in R? the text > file I want to > import is a large file, about 800MB in size. Thanks in > advance. > > I tried using the following > > data<-read.table("file",header=T,sep="\t") > > > -- > View this message in context: http://r.789695.n4.nabble.com/import-text-file-into-R-tp2241525p2241525.html > Sent from the R help mailing list archive at Nabble.com. > > ______________________________________________ > R-help at 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. >
You may want to try read.delim if you are having troubles with read.table. Jim -----Original Message----- From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org] On Behalf Of dhanush Sent: Thursday, June 03, 2010 4:33 AM To: r-help at r-project.org Subject: [R] import text file into R can anyone tell me how to import a text file in R? the text file I want to import is a large file, about 800MB in size. Thanks in advance. I tried using the following data<-read.table("file",header=T,sep="\t") -- View this message in context: http://r.789695.n4.nabble.com/import-text-file-into-R-tp2241525p2241525. html Sent from the R help mailing list archive at Nabble.com. ______________________________________________ R-help at 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.
On 06/03/2010 09:32 PM, dhanush wrote:> > can anyone tell me how to import a text file in R? the text file I want to > import is a large file, about 800MB in size. Thanks in advance. > > I tried using the following > > data<-read.table("file",header=T,sep="\t") > >Hi dhanush, If the problem is with read.table, maybe: # "whatlist" is a list of data types defining what # is in each line of data - see the help page data<-scan("file",skip=1,sep="\t",what=whatlist) will get it in for you. Jim