From kevinushey at gmail.com  Fri Jan 24 09:03:07 2014
From: kevinushey at gmail.com (Kevin Ushey)
Date: Fri, 24 Jan 2014 00:03:07 -0800
Subject: [Rd] Format an empty data frame
In-Reply-To: <CANROs4eqJQDbHYfYRZQ_xhyXTgVygufkEy_toWM8c+4iifcXXQ@mail.gmail.com>
References: <CANROs4eqJQDbHYfYRZQ_xhyXTgVygufkEy_toWM8c+4iifcXXQ@mail.gmail.com>
Message-ID: <CAJXgQP35T=8Xa0ABgoPsh42FaZGf2w-OR6=nEuytSB6TU-bEAw@mail.gmail.com>

This behaviour is fixed in R-devel (tested with r64727)

> format( data.frame() )
data frame with 0 columns and 0 rows

-Kevin

On Thu, Jan 23, 2014 at 11:59 PM, Yihui Xie <xie at yihui.name> wrote:
> Hi,
>
> Here seems to be a corner case in which format() fails:
>
>> format(data.frame())
> Error in .subset2(x, i, exact = exact) : subscript out of bounds
>
>> sessionInfo()
> R version 3.0.2 (2013-09-25)
> Platform: x86_64-pc-linux-gnu (64-bit)
>
> locale:
>  [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C
> LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8
>  [5] LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8
> LC_PAPER=en_US.UTF-8       LC_NAME=C
>  [9] LC_ADDRESS=C               LC_TELEPHONE=C
> LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C
>
> attached base packages:
> [1] stats     graphics  grDevices utils     datasets  methods   base
>
>
> Regards,
> Yihui
> --
> Yihui Xie <xieyihui at gmail.com>
> Web: http://yihui.name
>
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel



[Rd] Format an empty data frame
Kevin Ushey