We use R 4.0.5, lattice 0.20-38, MacOS 10.14.5.
library("lattice")
xyplot(Ozone ~ Temp | Month,
layout=c(1,5),
data=airquality
)
We got the below figure based on this code.
We want to change the name of each figure "Month" to the number of Month. The composite (damy) image is shown below. How should we do?
Change the month
column to factor.
library(lattice)
lattice::xyplot(Ozone ~ Temp | Month,
layout=c(1,5),
data = transform(airquality, Month = factor(match(Month, unique(Month))))
)
Note that in data Month
value is from 5 to 9 but since you want labels from 1 to 5 we use match
and unique
to get that.