[Rd] constructing empty data.frames [RFC]

Martin Maechler Martin Maechler <maechler@stat.math.ethz.ch>
Mon, 25 Sep 2000 09:48:16 +0200


somewhat `esoteric' problem/bug :

## Constructing an empty data.frame  (e.g. for later rbind()ing), works with

data.frame(a = 1[-1])
## or
data.frame(a = 1[-1], b = "c"[-1])

## but {these give warnings, but *work* with S+ (5.1)
##      giving the NULL data.frame, i.e. the same as data.frame()
##      --- which I don't like either: NULL should behave as numeric(0) here!}:
data.frame(a = NULL)         # fails with R
data.frame(a = NULL, b= NULL)# fails


---------- 

This is really a request for comment.
In my opinion I should get data.frames with 1 or 2 columns and 0 rows in
all cases.  R fails completely, and S+ (5.1) gives the NULL.

I'd like to fix R such that  `` NULL behaves as numeric(0) '' in this
situation. 

Comments?

Martin Maechler <maechler@stat.math.ethz.ch>	http://stat.ethz.ch/~maechler/
Seminar fuer Statistik, ETH-Zentrum  LEO D10	Leonhardstr. 27
ETH (Federal Inst. Technology)	8092 Zurich	SWITZERLAND
phone: x-41-1-632-3408		fax: ...-1228			<><
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-devel-request@stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._