Re: [R] Idioms for empty dataframes

2007-10-01 Thread Thomas Lumley
On Mon, 1 Oct 2007, Ranjan Bagchi wrote: > I'm fairly new to R, coming from a programming background -- it's quite > nice to work with dataframes, though, as opposed to explicit iteration. > > One thing I've found, which is surprising is that zero-length dataframes > seem to cause errors: It's no

[R] Idioms for empty dataframes

2007-10-01 Thread Ranjan Bagchi
I'm fairly new to R, coming from a programming background -- it's quite nice to work with dataframes, though, as opposed to explicit iteration. One thing I've found, which is surprising is that zero-length dataframes seem to cause errors: > t <- data.frame(bob=c(100)) > order(t$bob) [1] 1 > t1