Skip to content

Commit

Permalink
statR version 2.4.1 (#60)
Browse files Browse the repository at this point in the history
Version 2.4.1
* redesigned user configurations
* further modularized the functions used to generate worksheets
* revised vignette on creating excel files & regenerated pkgdown

Co-authored-by: tknecht <thomas.knecht@statistik.ji.ktzh.ch>
  • Loading branch information
Thomas-Caspar-Fischer and tknecht committed Feb 9, 2024
1 parent 26fe963 commit ad5d24b
Show file tree
Hide file tree
Showing 265 changed files with 5,813 additions and 9,704 deletions.
11 changes: 7 additions & 4 deletions .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,13 @@
^\.Rproj\.user$
^LICENSE\.md$
^pkgdown$
^docs$
^man-roxygen$
^index\.html$
^vignettes$
^\.github$
^_pkgdown\.yml$

^doc$
^docs$
^Meta$
^tests/testthat/test_env
^tests/testthat/test_out
^index\.html$
^vignettes$
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,7 @@
.RData
inst/doc
docs
*.xlsx
sqlnet.log
/doc/
/Meta/
10 changes: 5 additions & 5 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: statR
Title: statR
Version: 2.3.2
Version: 2.4.1
Authors@R: as.person(c(
"Andrea Schnell <andrea.schnell@statistik.ji.zh.ch> [aut]",
"Michelle Donzallaz <michelle.donzallaz@statistik.ji.zh.ch> [aut]",
Expand All @@ -13,8 +13,7 @@ Description: statR beinhaltet eine Reihe von Funktionen mit denen unter anderem
Depends: R (>= 3.3.0)
License: GPL-3
Encoding: UTF-8
LazyData: true
RoxygenNote: 7.2.1
RoxygenNote: 7.2.3
Imports:
dplyr,
ggplot2,
Expand All @@ -35,11 +34,12 @@ Suggests:
knitr,
tidyr,
rmarkdown,
ggrepel,
magrittr,
downloader,
zip,
sf,
dichromat,
ggrepel
ggrepel,
testthat (>= 3.0.0)
VignetteBuilder: knitr
Config/testthat/edition: 3
31 changes: 27 additions & 4 deletions NAMESPACE
Original file line number Diff line number Diff line change
@@ -1,13 +1,27 @@
# Generated by roxygen2: do not edit by hand

export(aXLSX)
export(addUserConfig)
export(add_attribute)
export(add_group_names)
export(add_grouplines)
export(add_metadata)
export(add_plot_size)
export(add_sheetname)
export(add_source)
export(add_title)
export(datasetsXLSX)
export(display)
export(display.statcol.all)
export(extract_attribute)
export(extract_attributes)
export(flush_left)
export(getActiveConfigName)
export(getUserConfigs)
export(initUserConfigStore)
export(inputHelperContactInfo)
export(inputHelperHomepage)
export(insert_header)
export(insert_hyperlinks)
export(insert_index_hyperlinks)
export(insert_index_sheet)
export(insert_metadata_sheet)
export(insert_worksheet)
Expand All @@ -17,10 +31,11 @@ export(interpolate2)
export(quickXLSX)
export(quick_sum)
export(readUserConfig)
export(setActiveConfig)
export(removeUserConfig)
export(splitXLSX)
export(theme_stat)
export(writeUserConfig)
export(updateUserConfig)
export(writeText)
export(zhpal)
importFrom(dplyr,"%>%")
importFrom(ggplot2,aes)
Expand All @@ -38,10 +53,18 @@ importFrom(ggplot2,unit)
importFrom(grDevices,"colorRampPalette")
importFrom(graphics,"rect")
importFrom(methods,is)
importFrom(openxlsx,addStyle)
importFrom(openxlsx,makeHyperlinkString)
importFrom(openxlsx,writeFormula)
importFrom(rlang,":=")
importFrom(rlang,.data)
importFrom(scales,manual_pal)
importFrom(stats,median)
importFrom(stats,na.omit)
importFrom(stats,quantile)
importFrom(stats,sd)
importFrom(utils,head)
importFrom(utils,read.table)
importFrom(utils,stack)
importFrom(utils,tail)
importFrom(utils,write.table)
38 changes: 38 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,41 @@
# statR 2.4.1
* The store file for user configurations is no longer initialized as part of
.onload() as this caused issues during package installation. Instead, the
configuration is selected during calls to quickXLSX etc through the config
argument.

# statR 2.4.0
* User configuration files are now stored at path pointed to by
tools::R_user_dir. This eliminates the problem that configuration files would
be lost on updates
* Deprecated and removed inputHelperSource, inputHelperMetadata, and associated
global options. If multiple sources need to be shown in one row, users should
create the string via paste() or similar functions.
* Fixed an issue where Excel Worksheets created using datasetsXLSX could become
corrupted.
* When defining a second header (either by numeric index or variable name at
the beginning of a block) are now properly merged and centered. Last block
terminates at the final column of the dataset.
* splitXLSX is now based on datasetsXLSX.
* When including images with datasetsXLSX, users can now specify a title,
source, and metadata.
* Users can now attach an additional metadata sheet in datasetsXLSX.
* insert_worksheet allows users to leave the source and metadata arguments at
NULL. In these instances, the function no longer includes an empty row.
* Reworked datasetsXLSX to allow a tidyverse-like workflow where titles,
sources, metadata, etc. are attached as attributes to objects (see examples).
* As part of this syntax, users can more easily control how sources and
metadata are displayed. add_source() and add_metadata() both take prefix and
collapse as input.
* insert_hyperlinks now (formally) allows users to point to external files.

## Problems
* Found an issue where output .xlsx is considered corrupt by Excel when using
sheetnames with special characters or spaces. The reason is that sheetnames
are used to construct named regions. The resulting illegal names don't cause
issues in R, but are detected and removed by Microsoft Excel. To ensure that
warnings aren't accidentally shown,

# statR 2.3.2

## Bugfix
Expand Down
48 changes: 0 additions & 48 deletions R/aXLSX.R

This file was deleted.

37 changes: 21 additions & 16 deletions R/checks.R
Original file line number Diff line number Diff line change
@@ -1,22 +1,27 @@
#' checkGroupOptionCompatibility()
#' Check if image is an implemented plot type
#'
#' @description Check if group_names and grouplines match
#' @param group_names A character vector with group names
#' @param grouplines A character or integer vector of columns to put grouplines at
#' @keywords internal
#' @noRd
checkGroupOptionCompatibility <- function (group_names, grouplines){
if (any(!is.na(group_names)) & all(is.na(grouplines))) {
stop("For a second header, the grouplines must be specified")
}
}

#' checkImplementedPlotType()
#'
#' @description Check if image is an implemented plot type
#' @param image Any R object
#' @keywords internal
#' @noRd
checkImplementedPlotType <- function(image) {
length(setdiff(class(image), c("gg", "ggplot", "histogram"))) == 0

valid_objects <- c("gg", "ggplot", "histogram", "character")

correct_object_type <- inherits(image, valid_objects)

if (!correct_object_type) {
return(FALSE)

} else if (is.character(image)) {

if (!(grepl("(.jpeg|.jpg|.png|.bmp)$", image))) {
return(FALSE)
}

if (!file.exists(image)) {
warning("Image ", image, " not found!")
}
}

return(TRUE)
}

0 comments on commit ad5d24b

Please sign in to comment.