I have a list of lists, I want to boxplot it by grouping it by names.
Here is the resume of my data:
eg: I want 4 box: LB, SD, LI and RN.
Is that possible or do I have to convert it to dataframe?
We need to stack the list into a dataframe , then plot:
#example data, list has duplicated names x <- list(aa = 1:3, aa = 6:8, bb = 4:8, cc = 5:10) boxplot(values ~ ind, data = stack(x))
You can make it in this way too:
my_boxplot <- do.call(boxplot, list(list(aa = runif(15, min=0, max=1), bb = runif(15, min=-1, max=2), cc = runif(15, min=1, max=4), dd = runif(15, min=-3, max=7))))
But why you don't want to convert list into data frame? With ggplot2 you can make cooler visuals.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.