Sometimes getting a file into R can seem like the longest part of the project :(
Okay I seem to have misread your first message. If I understand you correctly the file vcl is being read in? It is only when you try to attach the file that you have the problem? If this is so, have a look at vcl. Try head(vcl) str((vcl) class(vcl) and see if you can display the file (head()) and get some idea of the structure from str() and class() --- On Mon, 9/21/09, A Singh <aditi.si...@bristol.ac.uk> wrote: > From: A Singh <aditi.si...@bristol.ac.uk> > Subject: Re: [R] Working around 256 byte variable names? + trouble opening > large file > To: "John Kane" <jrkrid...@yahoo.ca>, r-help@r-project.org, "A Singh" > <aditi.si...@bristol.ac.uk> > Received: Monday, September 21, 2009, 4:19 PM > Dear John, > > I did just try to do that, and it is still returning the > same error when I > try to attach the csv file.. > > > vc1<-read.table("P:\\R\\Everything-I.csv",header=T, > sep=" ", dec=".", > na.strings=NA, strip.white=T) > > attach(vc1) > Error in attach(vc1) : variable names are limited to 256 > bytes > > Each variable name is only 5 to 6 characters long, but I'm > sure you're > right about R reading the entire header line as one > variable. > I cannot figure out though, how to stop it from doing so. > > sep=" ", or sep="," do not seem to work either, though I > don't know if it > is the right thing to be trying. > > > > --On 21 September 2009 13:11 -0700 John Kane <jrkrid...@yahoo.ca> > wrote: > > > Well the first suspicious thing seems to be the > 256 byte variable names. > > Do you really have a 256 byte variable name? If so, > why? It sounds like > > R is reading the entire header line as one variable. > > > > Why not try exporting the Exce file as a csv file and > loading that? > > > > > > > > > > --- On Mon, 9/21/09, A Singh <aditi.si...@bristol.ac.uk> > wrote: > > > >> From: A Singh <aditi.si...@bristol.ac.uk> > >> Subject: [R] Working around 256 byte variable > names? + trouble opening > >> large file To: r-help@r-project.org > >> Received: Monday, September 21, 2009, 4:04 PM > >> Dear R users, > >> > >> I am trying to read in a file with 105 columns, > and when > >> trying to attach it, get an error as follows: > >> > >> > > vc1<-read.table("P:\\R\\Everything-I.txt", > >> header=T, sep=" ", dec=".", > >> na.strings=NA, strip.white=T) > >> > attach(vc1) > >> Error in attach(vc1) : variable names are limited > to 256 > >> bytes > >> > >> Is there a way to get around this, and make R > accept the > >> given variable names? Or will I have to shorten > them? > >> > >> > >> Also, when I try to read in a much larger file > with 430 > >> columns, I get the error: > >> > >> Error in scan(file, what, nmax, sep, dec, quote, > skip, > >> nlines, na.strings, : > >> line 397 did not have 431 elements > >> > >> Is it that R isn't dealing too well with > >> Excel-converted-to-text files? Is it a function of > file > >> size? > >> > >> I have double-checked the 430 column file and all > data > >> seems to be in place. > >> > >> > >> Thanks for your help! > >> > >> Aditi > >> > >> > >> > >> > >> ---------------------- > >> A Singh > >> aditi.si...@bristol.ac.uk > >> School of Biological Sciences > >> University of Bristol > >> > >> ______________________________________________ > >> 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. > >> > > > > > > > __________________________________________________________________ > > Be smarter than spam. See how smart SpamGuard is at > giving junk email the > > boot with the All-new Yahoo! Mail. Click on > Options in Mail and switch > > to New Mail today or --------- > A Singh > aditi.si...@bristol.ac.uk > School of Biological Sciences > University of Bristol > > > > > __________________________________________________________________ The new Internet Explorer® 8 - Faster, safer, easier. Optimized for Yahoo! G ______________________________________________ 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.