Skip to content

column names in matrix vs. data frame in R 1.8

2 messages · White.Denis@epamail.epa.gov, Douglas Bates

#
Is the difference in behavior below, introduced in 1.8, inconsistent or,
at least, undesirable?  I couldn't find this in the NEWS.

On the one hand,
[1] "break" "next"

On the other,
[1] "break." "next."

thanks,
Denis
#
White.Denis at epamail.epa.gov writes:
Works fine if you don't use keywords as column names
[1] "foo" "bar"

The difference in the result for your example has to do with an extra
step in the second case to obtain a legitimate name that can be used
with the $ operator.  R generates a syntax error for

a$break

but not for 

a$break.