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
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
Steve Roberts
2003-Mar-18 15:10 UTC
[R] What a wonderful list (was Strange and disturbing bug)
What a wonderful set of people you are! - I solved by own problem, deleted the message and got 3 replies before I realised I'd hit "send" rather then "delete". Steve. 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