expand.grid() (PR#301)

J.C.Rougier@durham.ac.uk J.C.Rougier@durham.ac.uk
Thu, 28 Oct 1999 18:23:06 +0200 (MET DST)


This is a very minor point and I hesitate to call it a bug, but might I
suggest modifying the nargs=1 return statement in expand.grid() from

    if (nargs == 1)
      return(args[[1]])        

to 

    if (nargs == 1)
      return(data.frame(args))

so that the result of expand.grid is always a data frame (as indicated in
the help file).  This also preserves the variable name if it exists.

Cheers, Jonathan.

Jonathan Rougier                       Science Laboratories
Department of Mathematical Sciences    South Road
University of Durham                   Durham DH1 3LE

"[B]egin upon the precept ... that the things we see are to be 
 weighed in the scale with what we know"  (Meredith, 1879, The Egoist)


-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._