I have two lists with different structure:
listA <- list(c(\"a\",\"b\",\"c\"), c(\"d\",\"e\"))
listB <- list(0.05, 0.5)
listA
[[1]]
[1] \"a\" \"b\" \"c\"
Maybe there is a more elegant way that keeps the class numeric
of list2
's elements... But this one works as well
df <- do.call(rbind,mapply(cbind, listA, listB))
df <- as.data.frame(df, stringsAsFactors = FALSE)
df[,2] <- as.numeric(df[,2])
EDIT Way better is Matthew Plourde's solution using Map
aka mapply(data.frame, A=listA, B=listB, SIMPLIFY = FALSE)