dat <- list(random_sequence_generation = structure(c(H = 2L, L = 19L,
U = 9L), .Dim = 3L, .Dimnames = structure(list(c("H", "L", "U"
)), .Names = ""), class = "table"), allocation_concealment = structure(c(L = 13L,
U = 17L), .Dim = 2L, .Dimnames = structure(list(c("L", "U")), .Names = ""), class = "table"),
blinding_of_participants = structure(c(H = 30L), .Dim = 1L, .Dimnames = structure(list(
"H"), .Names = ""), class = "table"), blinding_of_personnel = structure(c(H = 28L,
U = 2L), .Dim = 2L, .Dimnames = structure(list(c("H", "U"
)), .Names = ""), class = "table"), blinding_of_outcome_assessor = structure(c(H = 17L,
L = 8L, U = 5L), .Dim = 3L, .Dimnames = structure(list(c("H",
"L", "U")), .Names = ""), class = "table"), incomplete_outcome_data = structure(c(H = 10L,
L = 20L), .Dim = 2L, .Dimnames = structure(list(c("H", "L"
)), .Names = ""), class = "table"))
flatten_list<-function (mydata) {
result <- plyr::ldply(lapply(mydata, function(x) {
data.frame(x, stringsAsFactors = FALSE)
}))
return(result)
}
res<-flatten_list(lapply(dat, prop.table))
reshape(res,idvar=".id",timevar="Var1",direction="wide")
и это вывод не уверен, что это правильно.это?
.id Freq.H Freq.L Freq.U
1 random_sequence_generation 0.06666667 0.6333333 0.30000000
4 allocation_concealment NA 0.4333333 0.56666667
6 blinding_of_participants 1.00000000 NA NA
7 blinding_of_personnel 0.93333333 NA 0.06666667
9 blinding_of_outcome_assessor 0.56666667 0.2666667 0.16666667
12 incomplete_outcome_data 0.33333333 0.6666667 NA