Hi , I just imported a large data set from notepad. I want to label the columns in R. I used 'import Dataset' to bring in my data set Now, I would like to label V1,V2,V3 etc?? Thanks -- View this message in context: http://r.789695.n4.nabble.com/Naming-columns-tp4674595.html Sent from the R help mailing list archive at Nabble.com.
Your question prompts more questions than answers. Not sure what "imported from notepad" means (clipboard? delimited how?). Don't know what you obtained in R (what does the str function tell you? What about dput(head(yourdata)))? You really need to tell us what R code you executed and data you gave it for us to understand what happened. Please read the Posting Guide mentioned at the bottom of this message. You would probably also benefit from reading about how to make a reproducible example to illustrate your question. http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example --------------------------------------------------------------------------- Jeff Newmiller The ..... ..... Go Live... DCN:<jdnewmil at dcn.davis.ca.us> Basics: ##.#. ##.#. Live Go... Live: OO#.. Dead: OO#.. Playing Research Engineer (Solar/Batteries O.O#. #.O#. with /Software/Embedded Controllers) .OO#. .OO#. rocks...1k --------------------------------------------------------------------------- Sent from my phone. Please excuse my brevity. Docbanks84 <mbanks3 at partners.org> wrote:>Hi , > >I just imported a large data set from notepad. I want to label the >columns >in R. > >I used 'import Dataset' to bring in my data set >Now, I would like to label V1,V2,V3 etc?? > >Thanks > > > >-- >View this message in context: >http://r.789695.n4.nabble.com/Naming-columns-tp4674595.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.
names(mydatat) <- c("V1","V2","V3") For future reference https://github.com/hadley/devtools/wiki/Reproducibility and/or http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example John Kane Kingston ON Canada> -----Original Message----- > From: mbanks3 at partners.org > Sent: Mon, 26 Aug 2013 14:42:36 -0700 (PDT) > To: r-help at r-project.org > Subject: [R] Naming columns > > Hi , > > I just imported a large data set from notepad. I want to label the > columns > in R. > > I used 'import Dataset' to bring in my data set > Now, I would like to label V1,V2,V3 etc?? > > Thanks > > > > -- > View this message in context: > http://r.789695.n4.nabble.com/Naming-columns-tp4674595.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.____________________________________________________________ FREE 3D EARTH SCREENSAVER - Watch the Earth right on your desktop!
Import data: mydata <- read.table("filename.txt") give following command for column name colnames(mydata) <- c("V1","V2","V3",................) Gyanendra Pokharel University of Guelph Guelph, ON On Mon, Aug 26, 2013 at 5:42 PM, Docbanks84 <mbanks3@partners.org> wrote:> Hi , > > I just imported a large data set from notepad. I want to label the columns > in R. > > I used 'import Dataset' to bring in my data set > Now, I would like to label V1,V2,V3 etc?? > > Thanks > > > > -- > View this message in context: > http://r.789695.n4.nabble.com/Naming-columns-tp4674595.html > Sent from the R help mailing list archive at Nabble.com. > > ______________________________________________ > 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. >[[alternative HTML version deleted]]