Saving list as tab del file
1
0
Entering edit mode
@marco-blanchette-1817
Last seen 10.3 years ago
An embedded and charset-unspecified text was scrubbed... Name: not available Url: https://stat.ethz.ch/pipermail/bioconductor/attachments/20060809/ 03e1e9f0/attachment.pl
• 374 views
ADD COMMENT
0
Entering edit mode
Seth Falcon ★ 7.4k
@seth-falcon-992
Last seen 10.3 years ago
Marco Blanchette <mblanche at="" berkeley.edu=""> writes: > Dear all, > > Again, I have one more question that will sound very basic to you R > aficionados. Consider sending this sort of question to R-help as it has nothing BioC specific... > I have a list of several columns containing different number of items as in: > > aList = list(C1=c(1:10), C2=c(15:35)) Are all elements the same length? If not, is the assumption that you want to pad the end of short vectors with NA? We'll use a helper from Biobase to make this BioC specific ;-) library("Biobase") length(unique(listLen(aList))) == 1 You could make a matrix like this: mat <- do.call(cbind, aList) write.table(mat) If lengths are not equal... lens <- listLen(aList) nRows <- max(lens) bList <- lapply(aList, function(x) { if (length(x) != nRows) c(x, rep(NA, nRows - length(x))) else x }) + seth
ADD COMMENT

Login before adding your answer.

Traffic: 625 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6