Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ export(col_borders)
export(freq)
export(generate_results)
export(gentlg)
export(get_file_name)
export(insert_empty_rows)
export(nested_freq)
export(no_borders)
export(replace_na_with_blank)
Expand Down
2 changes: 2 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# tidytlg 0.11.0.9000

- Exported functions `get_file_name()` and `insert_empty_rows()`.

# tidytlg 0.11.0

- Fixed RTF landscape tag (#54).
Expand Down
6 changes: 4 additions & 2 deletions R/getFileName.R
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,12 @@
#'
#' @author Steven haesendonckx {shaesen2@@its.jnj.com}
#'
#' @return The file path up untill the program's name.
#' @return The file path up until the program's name.
#' @param file name of the file
#'
#' @noRd
#' @export
#' @examples
#' get_file_name()
get_file_name <- function() {
##### If run from MCD BATCH\
file_name <- get_file_name_batch(commandArgs(trailingOnly = FALSE))
Expand Down
18 changes: 14 additions & 4 deletions R/insert_empty_rows.R
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,29 @@
#'
#' @details
#' `gentlg` allows for formatting the input table based on formatting columns
#' (see [gentlg()]). One of the formatting mechanisms is empty row insertion. This
#' function inserts the empty rows based on the `newrows` column in the data
#' frame. The new rows are inserted before the rows with value `1` in the
#' (see [gentlg()]). One of the formatting mechanisms is empty row insertion.
#' This function inserts the empty rows based on the `newrows` column in the
#' data frame. The new rows are inserted before the rows with value `1` in the
#' `newrows` column.
#'
#' @param huxme `data.frame` The input data frame.
#' @param newrows `integer` A numeric vector specifying where the new rows
#' should be inserted.
#'
#' @return A data frame with added new empty rows.
#' @keywords internal
#' @export
#'
#' @examples
#' df <- iris[1:10, ]
#' df <- as.data.frame(apply(df, 2, as.character))
#' df$newrows <- c(0, 1, 0, 1, 1, 0, 0, 0, 0, 0)
#' insert_empty_rows(df)
insert_empty_rows <- function(huxme, newrows = huxme$newrows) {
if (is.null(newrows)) {
return(huxme)
}
assertthat::assert_that(is.data.frame(huxme))
assertthat::assert_that(is.numeric(newrows))
assertthat::assert_that(nrow(huxme) == length(newrows))

format_columns <- c("row_type", "anbr", "indentme", "roworder", "newrows")
Expand Down
42 changes: 11 additions & 31 deletions inst/WORDLIST
Original file line number Diff line number Diff line change
@@ -1,28 +1,5 @@
<<<<<<< HEAD
TLG
TLGs
tlf
tidyverse
Tidyverse
dataframe
RTF
HTML
SDTM
PHUSE
ORCID
Papadopoulou
Sheng
Janssen
CDISC
BMI
JNJ
jnj
||||||| 91bb692
=======
BMI
CDISC
HTML
JNJ
Janssen
ORCID
PHUSE
Expand All @@ -33,15 +10,18 @@ Sheng
TLG
TLGs
Tidyverse
dataframe
Timepoint
Vectorized
envsetup
funder
getFileName
haesendonckx
hardcoded
huxtable
jnj
neighbouring
ppapadop
preprocessed
shaesen
tidyverse
tlf
neighbouring
hardcoded
funder
huxtable
envsetup
>>>>>>> 8341e0b
vectorized
24 changes: 24 additions & 0 deletions man/get_file_name.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 12 additions & 4 deletions man/insert_empty_rows.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading