You may also want to look at the label function (and friends) from the Hmisc package. This gives a way to use short, "correct" names for the variables, but have a longer, more descriptive label to use in plots.
-- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare greg.s...@imail.org 801.408.8111 > -----Original Message----- > From: r-help-boun...@r-project.org [mailto:r-help-boun...@r- > project.org] On Behalf Of Cloudy56 > Sent: Friday, January 09, 2009 11:42 AM > To: r-help@r-project.org > Subject: Re: [R] Maintain Spaces and Parentheses in Variable Names > > > Thank you very much. That certainly worked. Somehow I did not see > that when > reading the help file, nor could I find it via Google search so I > appreciate > your help! -- JC > > > Henrique Dallazuanna wrote: > > > > Try this: > > > > read.table(...., check.names = FALSE) > > > > On Fri, Jan 9, 2009 at 3:56 PM, Cloudy56 <clough.jonat...@gmail.com> > > wrote: > > > >> > >> Is there any way to maintain spaces, slashes, and parentheses in > variable > >> names when reading these into R? > >> > >> Of course, read.table converts these to periods. However, I know > that > >> it's > >> not strictly illegal to have these characters in variable names as I > am > >> able > >> to add them using the "variable editor" portion of the "data > editor." > >> > >> I need to batch produce dozens of histograms for reporting purposes > and > >> my > >> data is loaded with special characters e.g. "Historic Trend (mm/yr)" > >> Adding "Historic.Trend..mm.yr." to my plots is not acceptable for > >> reporting > >> purposes. Do I really need to manually label all of my plots each > time I > >> produce them in R or manually change the variable names in the Data > >> Editor? > >> > >> Any help that anyone may be able to provide to allow me to read data > >> without > >> "corrupting" my variable labels would be appreciated. (Forgive me > if > >> this > >> is a dumb question, first day in R.) > >> -- > >> View this message in context: > >> http://www.nabble.com/Maintain-Spaces-and-Parentheses-in-Variable- > Names-tp21377255p21377255.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. > >> > > > > > > > > -- > > Henrique Dallazuanna > > Curitiba-Paraná-Brasil > > 25° 25' 40" S 49° 16' 22" O > > > > [[alternative HTML version deleted]] > > > > > > ______________________________________________ > > 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. > > > > > > -- > View this message in context: http://www.nabble.com/Maintain-Spaces- > and-Parentheses-in-Variable-Names-tp21377255p21377996.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. ______________________________________________ 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.