Search code examples
rbwplot

How to make a bwplot for different vectors lenght


HI i trying to make one bwplot (it must be bwplot from Lattice) for differnt vectors lenghts.

xx1 <- rnorm(20, mean = 3, sd = 3.6) #20
xx2 <- rpois(40, lambda = 3.5)
xx3 <- rchisq(31, df = 5, ncp = 0) #31

Solution

  • This is easier to do once you have created a data.frame with your three groups:

    library(lattice)
    df <- data.frame(x=c(xx1, xx2, xx3), group=factor(c(rep("xx1", length(xx1)), rep("xx2", length(xx2)), rep("xx3", length(xx3)))))
    bwplot(x~group, df)
    

    enter image description here