[R] Rename Variable and package gdata

Harrell, Frank E f.harrell at Vanderbilt.Edu
Sun Nov 18 14:37:20 CET 2007


The Hmisc package's upData function makes it easy to rename variables, and
at the same time you can provide labels, value labels (factor levels),
units of measurement, and other things.

Frank

> Dear R-helpers,
>
> I hope someone can help me with the following problem:
>
> I derived a variable from many others and produced data.frame:  toktempo
> When I look at the variable name I get:
>
> names(toktempo)
> [1] "otok.V5"
>
> But I want the variable name to be Tempo so I googled around to find info
> about renaming variables.
> I found a webpage which seemed to indicate to me that there was a package
> named gmisc which contained a function called rename and it's syntax
> looked like
> what I wanted.  Another webpage indicated that gmisc is a bundle and there
> are
> four packages: gtools, gdata, gmodels, and gplots.  I think gdata might
> have
> the rename function.  So I did:
>
> chooseCRANmirror()
> install.packages(c("gdata"))
>
> After this, library() shows that I now have gdata:
>
> Packages in library 'C:/PROGRA~1/R/R-23~1.0/library':
>
> base                    The R Base Package
> boot                    Bootstrap R (S-Plus) Functions (Canty)
> class                   Functions for Classification
> cluster                 Cluster Analysis Extended Rousseeuw et al.
> datasets                The R Datasets Package
> foreign                 Read Data Stored by Minitab, S, SAS, SPSS,
> Stata, Systat, dBase, ...
> gdata                   Various R programming tools for data
> manipulation
> graphics                The R Graphics Package
> grDevices               The R Graphics Devices and Support for Colours
> and Fonts
> grid                    The Grid Graphics Package
> KernSmooth              Functions for kernel smoothing for Wand & Jones
> (1995)
> lattice                 Lattice Graphics
> MASS                    Main Package of Venables and Ripley's MASS
> methods                 Formal Methods and Classes
> mgcv                    GAMs with GCV smoothness estimation and GAMMs
> by REML/PQL
> nlme                    Linear and nonlinear mixed effects models
> nnet                    Feed-forward Neural Networks and Multinomial
> Log-Linear Models
>
> But when I do library(gdata) I get:
>
> Error in loadNamespace(i[[1]], c(lib.loc, .libPaths())) :
> there is no package called 'gtools'
> In addition: Warning message:
> package 'gdata' was built under R version 2.3.1
> Error: package/namespace load failed for 'gdata'
>
> And when I do help(rename) I get:
>  help(rename)
> No documentation for 'rename' in specified packages and libraries:
> you could try 'help.search("rename")'
>
> Of course I don't really know if gdata includes something called rename
> but
> I'm most hoping the message from library(gdata) will mean something to
> someone.
>  Or maybe someone has other ideas to help me with my renaming problem.
>
> Many thanks,
> Tom Brotz
>
>
>
> ************************************** See what's new at
> http://www.aol.com
>
> 	[[alternative HTML version deleted]]
>
> ______________________________________________
> 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.
>



More information about the R-help mailing list