transposeList <- function(aList) {What's a better way to do this?
if (length(aList) == 0) {
return(c())
}
colNames <- names(aList[[1]])
result <- replicate(length(colNames), list())
names(result) <- colNames
rowNames <- names(aList)
for (row in rowNames) {
for (col in colNames) {
result[[col]][[row]] = aList[[row]][[col]]
}
}
return(result)
}