[R] is.null doesn't work
jim holtman
jholtman at gmail.com
Fri Jul 13 03:47:46 CEST 2007
'v' appears to be a list:
> v=c(`-`,`+`,1,`^`,`^`,NA,NA,"X",9,"X",2)
> i2=16
> v[i2]
[[1]]
NULL
> str(v)
List of 11
$ :function (e1, e2)
$ :function (e1, e2)
$ : num 1
$ :function (e1, e2)
$ :function (e1, e2)
$ : logi NA
$ : logi NA
$ : chr "X"
$ : num 9
$ : chr "X"
$ : num 2
because you used backquotes(`) on the '-'; notice the difference:
> str(c(`-`,1))
List of 2
$ :function (e1, e2)
$ : num 1
> str(c('-',1))
chr [1:2] "-" "1"
>
On 7/12/07, Atte Tenkanen <attenka at utu.fi> wrote:
> Hi,
>
> What's wrong here?:
>
> > v=c(`-`,`+`,1,`^`,`^`,NA,NA,"X",9,"X",2)
> > i2=16
> > v[i2]
> [[1]]
> NULL
>
> > is.null(v[i2])
> [1] FALSE
>
> Is it a bug or have I misunderstood something?
>
> Atte Tenkanen
> University of Turku, Finland
>
> ______________________________________________
> R-help at stat.math.ethz.ch 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.
>
--
Jim Holtman
Cincinnati, OH
+1 513 646 9390
What is the problem you are trying to solve?
More information about the R-help
mailing list