Try this:
length(unique(sapply(list(rnorm(4), rnorm(5), rnorm(6)), length))) == 1
On Mon, Jan 31, 2011 at 5:14 PM, Megh Dal wrote:
> I am looking for an elegant way how I can test the equality of lengths of
> multiple vectors.
>
> For example, this is working fine:
>
> > length(rnorm(4)) == len
I am looking for an elegant way how I can test the equality of lengths of
multiple vectors.
For example, this is working fine:
> length(rnorm(4)) == length(rnorm(5))
[1] FALSE
However this is not:
> length(rnorm(4)) == length(rnorm(5)) == length(rnorm(6))
Error: unexpected '==' in "length(rnorm(
2 matches
Mail list logo