Displaying 1 result from an estimated 1 matches for "renamecol".
2000 Jun 25
1
renaming columns
...tically-named variables. The datasets
are more useful to me with informative variable names. I know that I can
rename variables using the following command:
dimname(dataset[[2]][index.of.variable.to.be.renamed]<-new.variable.name
If I want to do this inside a function (say something I call RenameCol)
what is the best way to communicate the new.variable.name back to the
calling frame (e.g.)
RenameCol<-function(dframe, index, newname)
{
#code to make certain there *are* dimnames
dimname(dframe[[2]][index]<-newname
invisible()
return(dframe)
}
The above code works in both SPlus and...