[R] Strange and disturbing bug
Duncan Temple Lang
duncan at research.bell-labs.com
Tue Mar 18 15:28:37 CET 2003
Hi Steve.
This is very much a feature, not a bug, and unless I am mistaken does
not relate to the use of a "two part name" (i.e. x.pair).
The $ operator does partial matching on the names. So fred$x yields
a partial match for fred$x.pair and gives you what you most likely
wanted. Of course, using fred$x.pair makes this more readable in a
function/software, but partial matching is very convenient for
interactive use.
D.
Steve Roberts wrote:
> How about this one? If I set a variable in a data.frame with a two-
> part name including a dot (say y.pair), and if the variable with the
> name of the first part (y) doesn't but I ask for it's value I get the
> value of the two-part name. Ie set fred$x.pair and print the value of
> fred$x it gives me the value I set to fred$x.pair. Weird and
> somewhat disturbing!
> Maybe an example makes it clearer:
>
>
> Dr Steve Roberts
> steve.roberts at man.ac.uk
>
> Senior Lecturer in Medical Statistics,
> CMMCH NHS Trust and University of Manchester Biostatistics Group,
> 0161 275 5192 / 0161 276 5785
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://www.stat.math.ethz.ch/mailman/listinfo/r-help
--
_______________________________________________________________
Duncan Temple Lang duncan at research.bell-labs.com
Bell Labs, Lucent Technologies office: (908)582-3217
700 Mountain Avenue, Room 2C-259 fax: (908)582-3340
Murray Hill, NJ 07974-2070
http://cm.bell-labs.com/stat/duncan
More information about the R-help
mailing list