Hello,

I have a data frame :

> linkptpn[1:6,]
   pedigree id fa mo sex status rs3789604 rs3811021 rs1217413 ss38346942
1         1  1  0  0   1      2
2         1  2  0  0   2      2
3         1  3  1  2   2      3       3/3       2/2       3/3        4/4
4         1  4  1  2   2      3       3/3       2/4       3/3        2/2
5         2  1  0  0   1      2
6         2  2  0  0   2      3

I would like to use write.table :

> write.table(linkptpn, "/home/biostat/david/genetique/linkptpn.csv")
Erreur dans write.table(x, file, nrow(x), p, rnames, sep, eol, na, dec,
as.integer(quote),  :
    type 'list' indisponible dans 'EncodeElement'

R says that my variables are 'list'. Indeed :

> apply(linkptpn, 2, class)
  pedigree         id         fa         mo        sex     status  rs3789604

    "list"     "list"     "list"     "list"     "list"     "list"     "list"

 rs3811021  rs1217413 ss38346942  rs1217388 ss38346943  rs1310182 ss38346944

    "list"     "list"     "list"

I would like to transform everything into a pure data.frame. I tried :

> apply(linkptpn, 2, unlist)
or
> apply(linkptpn, 2, as.data.frame)
or
linkptpn2 <- data.frame(unlist(linkptpn$pedigree), unlist(linkptpn$id),
unlist(linkptpn$fa), unlist(linkptpn$mo), unlist(linkptpn$sex),
unlist(linkptpn$status), unlist(linkptpn$rs3789604),
unlist(linkptpn$rs3811021),unlist( linkptpn$rs1217413),
unlist(linkptpn$ss38346942))

But it doesn't work. The first and the second solution gives me another
list, and the third doesn't work because of missing data.

Do you have any idea to do this ?
-- 
David

        [[alternative HTML version deleted]]

______________________________________________
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

Reply via email to