--- Begin Message ---
Vickie, try something like this

# Dummy data
lst <- list("This",c("should", "work",
"just"),"fine","I","guess...",c(NA,NA))
names(lst) <- letters[seq(1,length(lst))]
lst

# Arranging
for (i in 1:length(lst)) {
  lst[[i]] <- as.matrix(lst[[i]])
  rownames(lst[[i]]) <- rep(names(lst)[i], nrow(lst[[i]]))
  }

dta <- c()
for (i in 1:length(lst)) dta <- rbind(dta, as.matrix(lst[[i]]))
dta


Hope it helps. Cheers, Filipe


-----Mensagem original-----
De: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org]
Em nome de Vickie S
Enviada em: quarta-feira, 20 de julho de 2011 18:04
Para: r-help@r-project.org
Assunto: [R] Question about converting list items in matrix


Hi friends,
I have got a list where each element might have variable number of
members.
$`4213`
[1] "214077_x_at"

$`164832`
[1] "225996_at" "235977_at"

$`339010`
[1] NA

$`23410`
[1] "221562_s_at" "221913_at"   "49327_at"

$`285386`
[1] "229764_at"

$`2099`
[1] "205225_at"   "211233_x_at" "211234_x_at" "211235_s_at"
[5] "211627_x_at" "215551_at"   "215552_s_at" "217163_at"
[9] "217190_x_at"

I want to integrate this list in a matrix format like this :

4213 "214077_x_at"
164832  "225996_at"
164832 "235977_at"

339010 NA
23410 "221562_s_at"
23410 "221913_at"
23410 "49327_at"
....

Any idea how can I make such type of matrix ?


Thanks,
Vickie




        [[alternative HTML version deleted]]

______________________________________________
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.

--- End Message ---
"This message and its attachments may contain confidential and/or privileged 
information. If you are not the addressee, please, advise the sender 
immediately by replying to the e-mail and delete this message."

"Este mensaje y sus anexos pueden contener información confidencial o 
privilegiada. Si ha recibido este e-mail por error por favor bórrelo y envíe un 
mensaje al remitente."

"Esta mensagem e seus anexos podem conter informação confidencial ou 
privilegiada. Caso não seja o destinatário, solicitamos a imediata notificação 
ao remetente e exclusão da mensagem."
______________________________________________
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.

Reply via email to