[R] capture numeric(0) with if statement

Gabor Grothendieck ggrothendieck at gmail.com
Tue Jul 24 04:34:23 CEST 2007


Try:

if (identical(test, numeric(0))) ...

On 7/23/07, Alexander.Herr at csiro.au <Alexander.Herr at csiro.au> wrote:
> Hi List,
>
> I am trying to capture the numeric(0) with an if statement,
> unsucessfully:
>
> test<-numeric(0)
>
> if(test == numeric(0)) print("test is", test)
>
> I get: Error in if (test == numeric(0)) print("test is", test) :
>        argument is of length zero
>
> How can I capture the numeric(0) condition?
>
> Any enlightment appreciated
> Cheers
> Herry
>
> ______________________________________________
> 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.
>



More information about the R-help mailing list