I created 20 data frames in a loop already. And assigned them in the loop as below
for(x in 1:20){
my_file <- read.table(paste0("file_name",x), head=TRUE) %>%
select(Count, Total) %>%
data.frame()
assign(paste0("my_file_",x), my_file)
}
And I get each data frame just like this: (each data frame has the same Count names with the same sequence but the numbers are different)
Count Total
A 22
B 31
C 45
D 70
How can I make the mosaic plot for each data frame and put them on one page , with the same arrangement as below?
Block A Block B
Block C Block D
Thank you so much for your help!
The details depend on the particular package/function you are using. If you use the base mosaicplot()
function, you can simply employ par(mfrow = c(..., ...))
with a suitable layout. If you are using mosaic()
from vcd
then you can either create your own viewport()
with a grid.layout()
or use the mplot()
function for that purpose. See example("Ord_plot", package = "vcd")
for a worked example.
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.