Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gentlg doesn't work for multiple graphs #13

Closed
shengwei66 opened this issue Jun 1, 2023 · 0 comments
Closed

gentlg doesn't work for multiple graphs #13

shengwei66 opened this issue Jun 1, 2023 · 0 comments
Assignees

Comments

@shengwei66
Copy link
Collaborator

Users have reported that an error is encountered in gentlg when creating the output for multiple graphs. The reprex is below.

Prep Environment

library(dplyr)
library(ggplot2)
library(tidytlg)

adsl <- cdisc_adsl %>%
filter(SAFFL == "Y")

tblid <- "test2plots"

Generate Results

plot1 <- ggplot(data = adsl, aes(x = HEIGHTBL, y = WEIGHTBL)) +
geom_point() +
labs(x = "Baseline Height (cm)",
y = "Baseline Weight (kg)")

create png file of plot1

png("../output/plot1.png", width=2800, height=1800, res=300, type = "cairo")

plot1

dev.off()

plot2 <- ggplot(data = adsl, aes(x = WEIGHTBL, y = HEIGHTBL)) +
geom_point() +
labs(x = "Baseline Weight (kg)",
y = "Baseline Height (cm)")

create png file of plot2

png("../output/plot2.png", width=2800, height=1800, res=300, type = "cairo")

plot2

dev.off()

Output Results

gentlg(tlf = "g",
plotnames = paste0("../output/", c("plot1.png","plot2.png")),
opath = "../output",
plotwidth = 8,
plotheight = 5,
orientation = "landscape",
file = tblid,
title = "Scatter plot")

Error in if (file.exists(plotnames)) { : the condition has length > 1

This used to work in previous version without error.

@elimillera elimillera self-assigned this Jun 9, 2023
elimillera added a commit that referenced this issue Jun 12, 2023
elimillera added a commit that referenced this issue Jun 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants