Re: [R] how to not match partial names

From: Thomas Lumley <tlumley_at_uw.edu>
Date: Sun, 08 May 2011 11:18:36 +1200

On Sun, May 8, 2011 at 11:09 AM, William Revelle <lists_at_revelle.net> wrote:
> Dear friends,
>
> How do I stop partial matching of list names?
>
> e.g.,
>
> x <- list(AAAA="aaaaa", BBBBB="bbbbb")
> is.null(x$A)   #returns FALSE  even though there is no element A.
>
> if(is.null(x$A))  {result <-  x$BBBB} else {result <- x$A}
> result   #is aaaa even though there is no x$A element
>

x[["A"]]

   -thomas

-- 
Thomas Lumley
Professor of Biostatistics
University of Auckland

______________________________________________
R-help_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Received on Sun 08 May 2011 - 00:21:10 GMT

This quarter's messages: by month, or sorted: [ by date ] [ by thread ] [ by subject ] [ by author ]

All messages

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Sun 08 May 2011 - 02:00:06 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive