[Rd] bad variable names when printing a data frame containing (PR#10732)
p.dalgaard at biostat.ku.dk
p.dalgaard at biostat.ku.dk
Sat Feb 9 09:50:04 CET 2008
timh at insightful.com wrote:
> library(glmpath)
> data(heart.data)
> # heart.data is a list, $y a vector, $x a matrix
> data <- data.frame(x=3DI(heart.data$x), y =3D heart.data$y)
> =20
>> data[1:2,]
>> =20
> x.1 x.2 x.3 x.4 x.5 x.6 x.7 x.8 x.9 y
> 1 160 12 5.73 23.11 1 49 25.3 97.2 52 1
> 2 144 0.01 4.41 28.61 0 55 28.87 2.06 63 1
> =20
>> dimnames(heart.data$x)[[2]]
>> =20
> [1] "sbp" "tobacco" "ldl" "adiposity" "famhist" "typea"=
=20
> [7] "obesity" "alcohol" "age" =20
>
> Note that the printed variable names do not use the column names
> of the matrix.
>
> In contrast, in S-PLUS the names are used; the printout begins:
> x.sbp x.tobacco x.ldl x.adiposity x.famhist x.typea x.obesity x.alc=
ohol=20
> =20
The reason seems to be that format.AsIs is losing dimnames. That could=20
be easily fixed -- unless I'm overlooking something?
--=20
O__ ---- Peter Dalgaard =D8ster Farimagsgade 5, Entr.B
c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K
(*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327=
918
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk) FAX: (+45) 35327=
907
More information about the R-devel
mailing list