[R] DROP OBSErVATIONs IN A GROUP
Ben Bolker
bbolker at gmail.com
Wed Jun 29 22:51:12 CEST 2011
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.
More information about the R-help
mailing list