[R] how to test for the empty set

Stefan Evert stefan.evert at uos.de
Mon Nov 24 20:07:56 CET 2008


>
> all.equal(x, character(0))  # TRUE
>
> This would seem to be the solution, but am I missing something? and in
> particular, is there an elegant way to check in the case that the mode
> of the vector is not already known?

If you do not care about the mode of the vector, wouldn't simply

	length(x) == 0

do the trick? Or am I missing something?



	


Best regards,
Stefan Evert

[ stefan.evert at uos.de | http://purl.org/stefan.evert ]



More information about the R-help mailing list