I got data.frame in the nested list after I split them by given threshold. However, I am going to generate stack bar plot to make data more informative and easy to understand. I think using ggplot2 packages could be good choice, but I am quite new for using this packages, doing this is not intuitive.How can I get stack bar plot for data.frame in the nested list ? Any way getting bar plot, or pie graph for data.frame object easily ? Any idea ?
mini data :
myList <- list(
hola= data.frame( from=seq(1, by=4, len=15), to=seq(3, by=4, len=15), value=sample(30, 15)),
boo = data.frame( from=seq(3, by=7, len=20), to=seq(6, by=7, len=20), value=sample(45, 20)),
meh = data.frame( from=seq(4, by=8, len=25), to=seq(7, by=8, len=25), value=sample(36, 25))
)
helper function :
splitter <- function(mlist, threshold) {
res <- lapply(mlist, function(x) {
splt <- split(x, ifelse(x$value >= threshold, "pass", "fail"))
})
return(res)
}
#' @example
splitMe <- splitter(myList, threshold = 10)
I want to generate stack bar plot, pie graph by using ggplot2 packages. How can I make this happen easily ? Can any one point me how to do this task ?
How can I get stack bar plot for data.frame in the nested list ? How can I achieve my desired output plot ? Thanks a lot