David Winsemius <dwinsemius <at> comcast.net> writes: > > The strategy of cbind vectors as an argument to data.frame and then > naming them seems wasteful and error prone. Why not: > > z <- data.frame(n=factor(n),y=y) > # all one step, no issues about every element needing to be the same > mode > # and not removing attributes that matrix class imposes. >
And you don't actually need to name the elements if their names will match their symbol in the call, i.e. z <- data.frame(n=factor(n),y) should give identical results. ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.