Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
86 commits
Select commit Hold shift + click to select a range
25a4f19
remove freezePane
Jun 10, 2022
054ab06
Change server data access to local files
larnsce Aug 2, 2022
536449e
Adjust Arial capitalization
larnsce Aug 2, 2022
90440b3
Merge branch 'fix-issue-33' of https://github.com/larnsce/statR into dev
tlorusso Aug 2, 2022
b10766d
update documentation
tlorusso Aug 2, 2022
a64d930
test
Nov 15, 2022
418d756
deactivate unused palettes
Nov 15, 2022
b47c537
various changes
Jan 31, 2023
899f1f9
changed documentation
Jan 31, 2023
bcff83a
Merge pull request #50 from statistikZH/feature_new_colors
alexandrawu Feb 1, 2023
49da0ed
page update
Feb 8, 2023
114b161
last adjustments
Feb 9, 2023
fec0676
last changes
Feb 22, 2023
f918a0a
last changes
Feb 22, 2023
6fd549e
update
tlorusso Mar 1, 2023
cda28d5
Increment version number to 2.2.0
tlorusso Mar 1, 2023
15c9429
changes documented
tlorusso Mar 1, 2023
56a0250
update documentation
tlorusso Mar 1, 2023
af9e44b
udpate documentation
tlorusso Mar 1, 2023
d29a258
Merge branch 'feature_new_colors' into dev
tlorusso Mar 1, 2023
9fb3ce8
add github action
tlorusso Mar 1, 2023
406ddfe
update
tlorusso Mar 1, 2023
8b9a560
switch to v2
tlorusso Mar 1, 2023
60d8849
github action badge added
tlorusso Mar 1, 2023
a515750
update
tlorusso Mar 1, 2023
169579c
Bugfix: error when providing path to logo. See https://github.com/sta…
May 5, 2023
2f4fb25
Fix for Issue https://github.com/statistikZH/statR/issues/53; some re…
May 5, 2023
cd7c8d0
Compacted code, standardized checks on input & format, documentation WIP
May 8, 2023
212133e
Improved documentation (use of @keyword internal for documentation of…
thomas-fischer42 May 9, 2023
45f077d
Documentation, examples
May 9, 2023
9e93797
Improved documentation; examples checked
May 10, 2023
2653e4d
Moved default info for STAT ZH into separate Rscript (not exported); …
May 11, 2023
fb28208
Documentation; started to unify insert_worksheet and insert_worksheet_mh
May 12, 2023
fcb8cbd
Daily commit; reorganized insert_worksheet() for better legibility
May 15, 2023
cadbdd0
Simplified and cleaned up functions; renamed and reworked helper func…
May 16, 2023
c9a91c0
No more errors in examples
May 17, 2023
1d812fc
Daily commit; insert_index_sheet is now exported, as well as a functi…
May 22, 2023
f9c4156
Daily commit; Positions of content in xlsx are now relative.
May 26, 2023
e4f75d5
All output functions working
May 30, 2023
3b6e4f0
Updated documentation; removed unused code
May 30, 2023
23828d8
Daily commit
May 31, 2023
76e1b2c
All examples working, no warnings, one note
Jun 1, 2023
67d5779
Exported some common arguments into global options (mainly prefixes).
Jun 5, 2023
f01a0da
Merge pull request #54 from statistikZH/polishing
tlorusso Jun 15, 2023
44345ad
Bugfix: dynamic column for contact info. Added author to DESCRIPTION
Jul 3, 2023
939a33b
Increment version number to 2.3.0
Jul 3, 2023
448789a
Implemented user configuration based on yaml package (new dependency)…
Jul 12, 2023
ad2cd17
Fixed naming issue with global options
Jul 12, 2023
fafb432
Attempt at fixing the workflow; updated NEWS.md; preliminary updates …
Jul 12, 2023
e3830e4
Hotfix: malformed path on Windows systems
Jul 14, 2023
16a3e11
Added example to writeUserConfig
Jul 14, 2023
a870b3d
Version -> 2.3.1
Jul 24, 2023
7e27a37
Merge branch 'master' into dev
Thomas-Caspar-Fischer Jul 24, 2023
5da6bdc
Hotfix: configs not being detected
Jul 31, 2023
7bcbbfb
Bumped patch number
Jul 31, 2023
8c4cea8
Merge branch 'master' into dev
Thomas-Caspar-Fischer Jul 31, 2023
bd8d6d0
Rework stat r (#59)
Thomas-Caspar-Fischer Jan 26, 2024
b1ae573
Merge branch 'master' into dev
Thomas-Caspar-Fischer Jan 26, 2024
5e53120
Attempt to fix GitHub actions failing
Jan 29, 2024
19413e1
Diagnostic line to return content of config dir in package
Jan 29, 2024
ad48f68
Diagnosing GitHub Actions Workflow
Jan 29, 2024
77d6620
Diagnosing GitHub Action Checks #3
Jan 29, 2024
f4d7fe3
Added .yaml extension to default config (in code and tests); added wo…
Thomas-Caspar-Fischer Feb 5, 2024
956fe22
adjust user config
Feb 6, 2024
4e9adce
adjust documentation
Feb 6, 2024
f4be251
resolve merge conflict
Feb 6, 2024
9da35fb
remove load function
Feb 6, 2024
5937d37
adjust example
Feb 6, 2024
ecb66a4
debug
Feb 6, 2024
41fed44
debug
Feb 6, 2024
a242c8b
adjust documentation
Feb 6, 2024
0677676
Fix: user configuration values not being used for some fields when se…
Feb 7, 2024
b40b4de
Increment version number to 2.4.1
Feb 7, 2024
ab4e202
Fix: typos, language in Vignette Excel-Tabellen.Rmd
Feb 8, 2024
f44d5bd
Fix: error on running devtools::build_site(), exporting readUserConfig()
Feb 9, 2024
dc32fb8
update packagedown
Feb 21, 2024
85f8d07
Merge branch 'dev' of https://github.com/statistikZH/statR into dev
Feb 21, 2024
74add9a
update documentation
Feb 27, 2024
b00085e
resolve merge conflict
Feb 27, 2024
512df65
recreate pkgdown
Feb 27, 2024
c064cee
Regenerated GitHub Pages
Feb 27, 2024
b405e7b
Pkgdown troubleshooting
Feb 27, 2024
dc921c5
Added a separate field in config for TOC title. Default config now ta…
Apr 2, 2024
8a73c36
Merge pull request #67 from statistikZH/issue_66
ThomasKnecht Apr 8, 2024
162d72d
Fix: R version is now being tracked correctly in the config store, an…
Apr 9, 2024
709856e
Fix: incomplete replacement string for regex substitute
Apr 9, 2024
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
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
.Rhistory
.RData
inst/doc
docs
*.xlsx
sqlnet.log
/doc/
Expand Down
1 change: 1 addition & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ importFrom(methods,is)
importFrom(openxlsx,addStyle)
importFrom(openxlsx,makeHyperlinkString)
importFrom(openxlsx,writeFormula)
importFrom(purrr,reduce2)
importFrom(rlang,":=")
importFrom(rlang,.data)
importFrom(scales,manual_pal)
Expand Down
2 changes: 1 addition & 1 deletion R/insert_index_sheet.R
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ insert_index_sheet <- function(
3:18, style_subtitle(), "source")

### Table of content caption
writeText(wb, sheetname, getOption("statR_index_title"),
writeText(wb, sheetname, getOption("statR_index_toc_title"),
namedRegionLastRow(wb, sheetname, "source") + 3,
3, style_indextitle(), "toc")

Expand Down
9 changes: 5 additions & 4 deletions R/output_xlsx.R
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
#' in inches (1 inch = 2.54 cm), or a list of the same length as `datasets`
#' @param index_title Title to be put on the index sheet.
#' @param index_source Source to be shown below the index title.
#' @param index_toc_title Title shown above the table of content.
#' @param metadata_sheet A list with named elements 'title', 'source', and 'text'.
#' Intended for conveying long-form information. Default is NULL, not included.
#' @param overwrite Overwrites the existing excel files with the same file name.
Expand Down Expand Up @@ -124,12 +125,12 @@
datasetsXLSX <- function(
file, datasets, sheetname = NULL, title = NULL, source = NULL,
metadata = NULL, grouplines = NULL, group_names = NULL, plot_width = NULL,
plot_height = NULL, index_title = NA, index_source = NA, logo = NA,
contactdetails = NA, homepage = NA, openinghours = NA, auftrag_id = NULL,
plot_height = NULL, index_title = NA, index_source = NA, index_toc_title = NA,
logo = NA, contactdetails = NA, homepage = NA, openinghours = NA, auftrag_id = NULL,
author = "user", metadata_sheet = NULL, overwrite = TRUE, config = "default") {


get_user_config(config, c(index_title, index_source, logo,
get_user_config(config, c(index_title, index_source, index_toc_title, logo,
contactdetails, homepage, openinghours))

# "Optional" input arguments
Expand Down Expand Up @@ -178,7 +179,7 @@ datasetsXLSX <- function(
sheetname <- verifyInputSheetnames(sheetname)

wb <- openxlsx::createWorkbook()
insert_index_sheet(wb, sheetname = "Index", title = index_title,
insert_index_sheet(wb, sheetname = "Index", title = getOption("statR_index_title"),
auftrag_id = auftrag_id, logo = logo,
contactdetails = getOption("statR_contactdetails"),
homepage = getOption("statR_homepage"),
Expand Down
82 changes: 43 additions & 39 deletions R/user_config.R
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,7 @@ initUserConfigStore <- function(store_path = "~/.config/R/statR") {

}


addUserConfig(store_path = store_path)

}


Expand All @@ -47,12 +45,16 @@ addUserConfig <- function(name = "default", path = NULL,
store_path = "~/.config/R/statR") {

store_file <- file.path(store_path, "statR_profile.csv")
configs <- readUserConfigStore(store_path)

if(!file.exists(store_file)){
lib_path <- dirname(dirname(system.file(package = "statR")))
current_path <- configs[configs$config_name == name, "config_path"]
default_path <- system.file("extdata/config/default.yaml", package = "statR")

if (!file.exists(store_file)){
initUserConfigStore(store_path)
}

configs <- readUserConfigStore(store_path)
if (is.null(path) && name != "default") {
stop("Kein Pfad zu config file angegeben")
}
Expand All @@ -62,22 +64,30 @@ addUserConfig <- function(name = "default", path = NULL,
}

if (name == "default" && is.null(path)) {
path <- system.file("extdata/config/default.yaml", package = "statR")

if (length(current_path) == 0) {
path <- default_path

} else if (grepl(lib_path, current_path)) {
curr_vers <- paste0(version$major, ".", gsub(".[0-9]+$", "", version$minor))
path <- gsub("[0-9.]+/statR/extdata/config/",
paste0(curr_vers, "/", "statR/extdata/config/"), current_path)
updateUserConfig("default", path, store_path)
}
}

if (name == "default" & "default" %in% configs$config_name){
if (name == "default" && "default" %in% configs$config_name){
return("Alles bereit")
}

if (name %in% configs$config_name){

if (configs[configs$config_name == name, "config_path"] == path){
if (current_path == path){
stop("Diese Konfiguration existiert bereits! Verwende die ",
"updateUserConfig()-Funktion um den Pfad zu aendern.")

} else {
stop("Der Konfigurationsname: ",
configs[configs$config_name == name, "config_name"],
stop("Der Konfigurationsname: ", name,
" existiert bereits. Setze einen neuen Pfad mit der ",
"updateUserConfig()-Funktion")
}
Expand All @@ -95,18 +105,22 @@ addUserConfig <- function(name = "default", path = NULL,
#' @inheritParams initUserConfigStore
#' @export
updateUserConfig <- function(name, path, store_path = "~/.config/R/statR"){
if (!is.null(path) && !file.exists(path)) {
stop("No config file found at ", path)
}

configs <- readUserConfigStore(store_path)

configs[configs$config_name == name, "config_path"] <- path
if (name == "default") {
curr_vers <- paste0(version$major, ".", gsub(".[0-9]+$", "", version$minor))
path <- gsub("[0-9.]+/statR/extdata/config/",
paste0(curr_vers, "/", "statR/extdata/config/"), path)
}

out <- configs
if (!is.null(path) && !file.exists(path)) {
stop("No config file found at ", path)
}

configs[configs$config_name == name, "config_path"] <- path
store_file <- file.path(store_path, "statR_profile.csv")
write.table(out, store_file, row.names = FALSE, sep = ",")
write.table(configs, store_file, row.names = FALSE, sep = ",")
}

#' Loeschen eines Konfigurations-Eintrages
Expand Down Expand Up @@ -145,55 +159,45 @@ readUserConfig <- function(name = "default", store_path = "~/.config/R/statR") {
}






#' Extrahiert Defaults aus User Config und ersetzt Werte
#' @param config Name der User Config
#' @param params_to_check Vektor mit Parametern
#' @importFrom purrr reduce2
#' @keywords internal
get_user_config <- function(config, params_to_check){

initUserConfigStore()

user_config <- readUserConfig(config)

out <- unlist(user_config, recursive = FALSE)

names(out) <- gsub(".*\\.", "", names(out))

config_name <- tail(paste0("statR_", substitute(params_to_check)), -1)


user_config <- purrr::reduce2(params_to_check, config_name, ~ replace_by_parameter(..1, ..2, ..3), .init = out)

user_config <- purrr::reduce2(params_to_check, config_name,
~ replace_by_parameter(..1, ..2, ..3),
.init = out)
options(user_config)


if(!("statR_contactdetails" %in% names(user_config))){
if (!("statR_contactdetails" %in% names(user_config))){
user_config$statR_contactdetails <- inputHelperContactInfo()

options(user_config)
}



}


#' Ersetzt Werte in aktiver Config mit gesetzten Parametern
#' @param yaml_file Inhalt der aktiven Config
#' @param parameter Wert des Parameters
#' @param config_param_name Name des Parameters
#' @keywords internal
replace_by_parameter <- function(yaml_file, parameter, config_param_name) {

if (!is.na(parameter)) {
if(config_param_name %in% names(yaml_file)){
yaml_file[config_param_name] <- parameter
} else {
yaml_file$add <- parameter

new_names <- c(head(names(yaml_file),-1), config_param_name)

names(yaml_file) <- new_names
}

}

return(yaml_file)
}


1 change: 1 addition & 0 deletions docs/.nojekyll
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

3 changes: 3 additions & 0 deletions docs/404.html

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

3 changes: 3 additions & 0 deletions docs/LICENSE.html

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

Loading