[R] behavior of names
Ben Bolker
bolker at zoo.ufl.edu
Tue Dec 6 05:14:09 CET 2005
I find the following ways in which
R attempts to preserve names to
be puzzling and often annoying
x = c(a=1,b=2,c=3)
c(d=x["a"],e=x["b"])
# d.a e.b
# 1 2
list(d=x["a"],e=x["b"])
# $d
# a
# 1
# $e
# b
# 2
(a real-world example: I fit
some parameters with mle(), ending
up with a named vector of coefficients,
and then want to use some or all of
those coefficients as input to another
mle() call -- I have to remove the
names manually.)
Can anyone suggest why this happens/
why it is a good design/whether there
are simple workarounds?
sincerely
Ben Bolker
More information about the R-help
mailing list