[R] request/suggestion: modified names
ggrothendieck at gmail.com
Fri Jul 1 01:38:38 CEST 2005
On 6/30/05, Ritter, Christian C GSMCIL-GSTMS/2
<christian.ritter at shell.com> wrote:
> For some time now I use a modified version of names (extract direction) of the following type:
> function (x,filter="^")
> Has anyone already written a version which goes the other way (that is, which allows assignment of the type Names(x,filter)<-...). Naive versions are obvious, but I think something would have to be done to check validity. So if anyone has already done it for me, I would be very happy if you could share it. Such a function would be quite useful when working with large data frames (as I typically do) and need to edit names in a convenient way.
> Wouldn't the filter argument make sense in general, that is in "names" and not only in a custom version "Names"?
This is not a direct answer to your question, as stated, but
if what is desired is really a method to do ad hoc editing
(as opposed to renaming columns on a programmatic basis) then
one can use 'fix':
irish <- head(iris) # test data
At this point a spreadsheet pops up and one can edit the
header directly in a GUI. (I am on Windows XP -- not sure if this
works on other OSes). Exit the spreadsheet and its done.
This can alternately be done in JGR, a front end to R. Press ctrl-B to
access the object browser. Pick out your data frame and a spreadsheet
will popup. Right click the column name and choose Rename.
More information about the R-help