logical, instead of a 0-length list).
>
> Best,
> Kevin
>
> On Tue, Nov 16, 2021 at 10:21 AM Bill Dunlap
> wrote:
> >
> > Try adding simplify=FALSE to the call to by().
> >
> > -Bill
> >
> > On Tue, Nov 16, 2021 at 4:04 AM Ofek Shilon
> wrote:
>
Take this toy code:
df <- data.frame(a=seq(10), b=rep(1:2, 5))
df.empty <- subset(df, a>10)
byy <- by(data=df, INDICES=df$b, FUN=function(x) x[1,])
byy.empty <- by(data=df.empty, INDICES=df.empty$b, FUN=function(x) x[1,])
class(byy) # "by"
class(byy.empty) # "by"
is.list(b