I am new to R, and I have been running into the following situation
when I mistype a variable name in some code:

> list1 <- list( a=1, b=2 )
> list2 <- list( a=1 )
> list2$b <- list1$c
> list2
$a
[1] 1

I would think at the point where I am trying to reference a field
called "c" -- that does not exist -- in list1, there would be an error
flagged.

Instead, list1$c returns value NULL, and the assignment "list2$b <-
NULL" does not return any error, but also does not create a field
called "b" in list2.

Is there a way to have R flag the reference to field  "c" in list1 as an error?

Thanks,
Harry

______________________________________________
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