Skip to content

Commit 8a3a0bf

Browse files
committed
ClAdd open=FALSE arg to codebook INNOV-326
1 parent d30fbda commit 8a3a0bf

File tree

3 files changed

+16
-7
lines changed

3 files changed

+16
-7
lines changed

NEWS.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## crunchtabs 1.4.2
2+
3+
- INNOV-326 writeCodeBookLatex should not open by default. Add function argument open = FALSE. This avoids a situation in non-interactive sessions where the process would otherwise be stuck as it attempts to open a GTK program from a bash session.
4+
15
## crunchtabs 1.4.1
26

37
- Multiple adjustments for tracking report edge cases

R/writeCodeBookLatex.R

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
#' "c", "l", or "r". Default position is left aligned tables.
2222
#' @param path The path to place .tex and .pdf files.
2323
#' @param logging Leave logs in the working directory, defaults to FALSE
24+
#' @param open Should the resulting PDF be opened? Defaults to FALSE
2425
#' @param filename A string. The desired basename of the resulting file with no extension
2526
#' (i.e, "mycodebook")
2627
#' @param ... Additional arguments passed to \link[kableExtra]{kable_styling} Unused.
@@ -30,8 +31,8 @@ writeCodeBookLatex <- function(
3031
ds, url = NULL, pdf = TRUE, title = NULL, subtitle = NULL,
3132
table_of_contents = FALSE, sample_desc = NULL, field_period = NULL,
3233
preamble = NULL, suppress_zero_counts = FALSE, appendix = TRUE,
33-
logo = NULL, position = NULL, path = NULL, filename = NULL,
34-
logging = FALSE, ...) {
34+
logo = NULL, position = NULL, path = NULL,
35+
logging = FALSE, open = FALSE, filename = NULL, ...) {
3536
if (!is.null(crunch::weight(ds))) {
3637
stop(paste(
3738
"Codebooks are designed to work with whole numbers. Your dataset is",
@@ -236,7 +237,8 @@ writeCodeBookLatex <- function(
236237
file.remove(file.path(getwd(), files))
237238
}
238239
}
239-
240-
file.open(pdfname)
240+
if(open) {
241+
file.open(pdfname)
242+
}
241243
}
242244
}

man/writeCodeBookLatex.Rd

Lines changed: 6 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)