[R] z.test for dataframe

R. Michael Weylandt michael.weylandt at gmail.com
Wed Oct 17 13:23:21 CEST 2012


On Wed, Oct 17, 2012 at 7:45 AM, Balqis <aehan3616 at gmail.com> wrote:
> Sep=cbind(kIp,k02p,k04p,k07p)
> Sep=as.data.frame(Sep)
>

I see Rui has already taken a stab at your question, but I just want
to chime in to say the preceeding is really a terrible idiom. It would
be much _much_ better to write

Sep = data.frame(klp, k02p, k04p, k07p)

data.frame() is the function for making data.frames(). If you cbind()
things together, you usually wind up with a matrix which requires all
its elements to be of one type. This, of course, defeats the entire
point of data frames which is to allow different columns to have
different points.

Cheers,
Michael




More information about the R-help mailing list