Message-ID: <9F092C320C170B4793FC721A68E0EB890FAB4761@CMS12-01.campus.gla.ac.uk>
Date: 2017-06-15T15:41:14Z
From: Massoud Boroujerdi
Subject: is.null(mylist[1]) and is.null(mylist$a) returns different values
In-Reply-To: <20170615113300.30538@web005.roc2.bluetie.com>
I think look at the manual
Is.null(mylist[[1]])
Will work
-----Original Message-----
From: R-help [mailto:r-help-bounces at r-project.org] On Behalf Of ce
Sent: 15 June 2017 16:33
To: r-help at r-project.org
Subject: [R] is.null(mylist[1]) and is.null(mylist$a) returns different values
Hi
I have a list :
mylist <- list( a = NULL, b = 1, c = 2 )
> mylist[1]
$a
NULL
> is.null(mylist[1])
[1] FALSE
> is.null(mylist$a)
[1] TRUE
why? I need to use mylist[1]
______________________________________________
R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see 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.