On Sun, May 8, 2011 at 11:09 AM, William Revelle <li...@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@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.

Reply via email to