0

Could you help me finding a mistake in this code. It produces .jpg files, but all of them have the same size and no content (white, empty, nothing). What I did wrong?

Data:

v1 <- runif(100,1,6); v2 <- runif(100,1,6); v3 <- runif(100,1,6)
data <- data.frame(v1,v2,v3); data <- round(data, digits = 0)

Needed package: sjPlot

Code:

for (i in 1:length(names(data))) {
  jpeg(paste0("plot_",names(data)[i],".jpg"),
       width = 166, height = 80, units = "mm", pointsize = 12,
       res = 300, quality = 90)
  plot_frq(data[,i],title = "", axis.title = "", show.prc = TRUE, show.n = FALSE, show.axis.values = FALSE,
          axis.labels = c("strongly agree","agree","disagree","strongly disagree", "I don't know"))
  dev.off()
}

Regards, Maciej.

Maciej B.
  • 373
  • 1
  • 4
  • 13

0 Answers0