R: Quatro gráficos de barras de treliça lado a lado na janela 2x2?

Código em que eu gostaria de fazer gráficos de barras 2x2 lado a lado, de modo que o valor máximo do eixo y fosse o mesmo em todos e

ylabel comumxlabel comumlendas comunstítulo comumcada gráfico de barras com sua própria legendalinha separadora entre cada gráfico de barras como na Fig. 2

Código

# Wanted output 2x2 barchart where top column Ite. 1 and Ite. 2 and row-names female and male
# http://www.magesblog.com/2012/12/changing-colours-and-legends-in-lattice.html

require("lattice")

f<-function(x) as.double(as.character(x))   #factors converted to vectors http://stackoverflow.com/a/40680020/54964

data.female <- structure(list(N11.1 = structure(c(3L, 3L), .Label = c("", "0.0", 
"1.0", "N11"), class = "factor"), N22.1 = structure(c(2L, 2L), .Label = c("", 
"0.0", "2.0", "N22"), class = "factor"), N33.1 = structure(c(2L, 
2L), .Label = c("", "0.0", "N33"), class = "factor"), N44.1 = structure(2:3, .Label = c("", 
"0.0", "0.1", "0.2", "N44"), class = "factor"), N21.1 = structure(c(2L, 
2L), .Label = c("", "0.0", "N21"), class = "factor"), N31.1 = structure(c(2L, 
2L), .Label = c("", "0.0", "N31"), class = "factor"), N32.1 = structure(c(5L, 
7L), .Label = c("", "0.0", "10.8", "11.0", "12.0", "17.0", "20.9", 
"22.8", "24.0", "3.0", "4.0", "44.0", "N32"), class = "factor")), .Names = c("N11.1", 
"N22.1", "N33.1", "N44.1", "N21.1", "N31.1", "N32.1"), row.names = c("Sinus", 
"Arr/AHB"), class = "data.frame")

data.male <- structure(list(N11.1 = structure(c(3L, 3L), .Label = c("", "0.0", 
"1.0", "N11"), class = "factor"), N22.1 = structure(c(2L, 2L), .Label = c("", 
"0.0", "2.0", "N22"), class = "factor"), N33.1 = structure(c(2L, 
2L), .Label = c("", "0.0", "N33"), class = "factor"), N44.1 = structure(c(2L, 
2L), .Label = c("", "0.0", "0.1", "0.2", "N44"), class = "factor"), 
    N21.1 = structure(c(2L, 2L), .Label = c("", "0.0", "N21"), class = "factor"), 
    N31.1 = structure(c(2L, 2L), .Label = c("", "0.0", "N31"), class = "factor"), 
    N32.1 = structure(c(11L, 9L), .Label = c("", "0.0", "10.8", 
    "11.0", "12.0", "17.0", "20.9", "22.8", "24.0", "3.0", "4.0", 
    "44.0", "N32"), class = "factor")), .Names = c("N11.1", "N22.1", 
"N33.1", "N44.1", "N21.1", "N31.1", "N32.1"), row.names = c("Sinus", 
"Arr/AHB"), class = "data.frame")

ID<-c("Sinus","Arr/AHB")

tl <- "female"
barchart(f(N11.1)+f(N22.1)+f(N33.1)+f(N44.1)+f(N21.1)+f(N31.1)+f(N32.1) ~ ID,
         data=data.female,
         auto.key=list(space='right'), 
         ylim=c(0,50),
     beside=TRUE,
     ylab = "Number of cases", 
     xlab = "Population/Sample",
     main = tl
         )
tl <- "male"
barchart(f(N11.1)+f(N22.1)+f(N33.1)+f(N44.1)+f(N21.1)+f(N31.1)+f(N32.1) ~ ID,
         data=data.male,
         auto.key=list(space='right'),
         ylim=c(0,50),
     beside=TRUE,
     ylab = "Number of cases", 
     xlab = "Population/Sample",
     main = tl 
         )

# Just repeat two barcharts more to get 2x2 example
tl <- "female"
barchart(f(N11.1)+f(N22.1)+f(N33.1)+f(N44.1)+f(N21.1)+f(N31.1)+f(N32.1) ~ ID,
         data=data.female,
         auto.key=list(space='right'), 
         ylim=c(0,50),
     beside=TRUE,
     ylab = "Number of cases", 
     xlab = "Population/Sample",
     main = tl
         )
tl <- "male"
barchart(f(N11.1)+f(N22.1)+f(N33.1)+f(N44.1)+f(N21.1)+f(N31.1)+f(N32.1) ~ ID,
         data=data.male,
         auto.key=list(space='right'),
         ylim=c(0,50),
     beside=TRUE,
     ylab = "Number of cases", 
     xlab = "Population/Sample",
     main = tl 
         )

Fig. 1 Saída de corrente separada, Fig. 2 Estrutura de saída desejada, Fig. 3 Saída do código de barras do usuário 20650

R: 3.3.1
SO: Debian 8.5

questionAnswers(1)

yourAnswerToTheQuestion