[R] names.data.frame?
Leonard Mada
|eo@m@d@ @end|ng |rom @yon|c@eu
Wed Nov 3 19:35:58 CET 2021
Dear List members,
Is there a way to access the default names() function?
I tried the following:
# Multi-variable polynomial
p = data.frame(x=1:3, coeff=1)
class(p) = c("pm", class(p));
names.pm = function(p) {
# .Primitive("names")(p) # does NOT function
# .Internal("names")(p) # does NOT function
# nms = names.default(p) # does NOT exist
# nms = names.data.frame(p) # does NOT exist
# nms = names(p); # obvious infinite recursion;
nms = names(unclass(p));
}
Alternatively:
Would it be better to use dimnames.pm instead of names.pm?
I am not fully aware of the advantages and disadvantages of dimnames vs
names.
Sincerely,
Leonard
More information about the R-help
mailing list