Re: [R] Comparing lengths of different vectors simultaneously

2011-01-31 Thread Henrique Dallazuanna
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

[R] Comparing lengths of different vectors simultaneously

2011-01-31 Thread Megh Dal
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(