[R] row.names are dropped when extracting one column ?
Marc Schwartz
MSchwartz at medanalytics.com
Tue Mar 2 20:06:39 CET 2004
On Tue, 2004-03-02 at 11:59, ryszard.czerminski at pharma.novartis.com
wrote:
> Apparently row names are dropped when I extract
> single column from a data frame. Why this behaviour ?
>
> > y <- as.matrix(df[,1:2]); length(row.names(y))
> [1] 324
> > y <- as.matrix(df[,1:1]); length(row.names(y))
> [1] 0
>
> Best regards,
>
> Ryszard
Please see R-FAQ 7.7:
"Why do my matrices lose dimensions?"
HTH,
Marc Schwartz
More information about the R-help
mailing list