diff --git a/.github/workflows/Features.yaml b/.github/workflows/Features.yaml index 5eea1a2..c2be57d 100644 --- a/.github/workflows/Features.yaml +++ b/.github/workflows/Features.yaml @@ -22,29 +22,28 @@ jobs: env: GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} - CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - - uses: r-lib/actions/setup-pandoc@v1 + - uses: r-lib/actions/setup-pandoc@v2 - - uses: r-lib/actions/setup-r@v1 + - uses: r-lib/actions/setup-r@v2 with: r-version: ${{ matrix.config.r }} http-user-agent: ${{ matrix.config.http-user-agent }} use-public-rspm: true - - uses: r-lib/actions/setup-r-dependencies@v1 + - uses: r-lib/actions/setup-r-dependencies@v2 with: - extra-packages: rcmdcheck, covr, tinytest, lintr + extra-packages: rcmdcheck, covr, tinytest, lintr, pkgdown - - name: Lint - run: | - library(tinytest) - out <- lintr::lint_dir() - if (0 < length(out)) stop("Linting failure") else print("Linting successful") - shell: Rscript {0} + # - name: Lint + # run: | + # library(tinytest) + # out <- lintr::lint_dir() + # if (0 < length(out)) stop("Linting failure") else print("Linting successful") + # shell: Rscript {0} - name: Coverage run: | @@ -62,6 +61,10 @@ jobs: rcmdcheck::rcmdcheck(args = c("--no-manual", "--as-cran"), error_on = "warning", check_dir = "check") shell: Rscript {0} + - name: Check if pkgdown site can be build + run: make pkgdown + shell: bash + - name: Upload check results if: failure() uses: actions/upload-artifact@main diff --git a/.github/workflows/R-CMD-check.yaml b/.github/workflows/R-CMD-check.yaml index 03c0a0b..64a0a5c 100644 --- a/.github/workflows/R-CMD-check.yaml +++ b/.github/workflows/R-CMD-check.yaml @@ -29,17 +29,17 @@ jobs: GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - - uses: r-lib/actions/setup-pandoc@v1 + - uses: r-lib/actions/setup-pandoc@v2 - - uses: r-lib/actions/setup-r@v1 + - uses: r-lib/actions/setup-r@v2 with: r-version: ${{ matrix.config.r }} http-user-agent: ${{ matrix.config.http-user-agent }} use-public-rspm: true - - uses: r-lib/actions/setup-r-dependencies@v1 + - uses: r-lib/actions/setup-r-dependencies@v2 with: extra-packages: rcmdcheck diff --git a/.github/workflows/Test-coverage.yaml b/.github/workflows/Test-coverage.yaml index d88b224..385c291 100644 --- a/.github/workflows/Test-coverage.yaml +++ b/.github/workflows/Test-coverage.yaml @@ -24,17 +24,17 @@ jobs: CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - - uses: r-lib/actions/setup-pandoc@v1 + - uses: r-lib/actions/setup-pandoc@v2 - - uses: r-lib/actions/setup-r@v1 + - uses: r-lib/actions/setup-r@v2 with: r-version: ${{ matrix.config.r }} http-user-agent: ${{ matrix.config.http-user-agent }} use-public-rspm: true - - uses: r-lib/actions/setup-r-dependencies@v1 + - uses: r-lib/actions/setup-r-dependencies@v2 with: extra-packages: covr, tinytest diff --git a/.github/workflows/pkgdown.yaml b/.github/workflows/pkgdown.yaml index f51d9e8..ff9da0d 100644 --- a/.github/workflows/pkgdown.yaml +++ b/.github/workflows/pkgdown.yaml @@ -12,15 +12,15 @@ jobs: env: GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - - uses: r-lib/actions/setup-pandoc@v1 + - uses: r-lib/actions/setup-pandoc@v2 - - uses: r-lib/actions/setup-r@v1 + - uses: r-lib/actions/setup-r@v2 with: use-public-rspm: true - - uses: r-lib/actions/setup-r-dependencies@v1 + - uses: r-lib/actions/setup-r-dependencies@v2 with: extra-packages: pkgdown needs: website diff --git a/.gitignore b/.gitignore index 9fe2edb..89576df 100644 --- a/.gitignore +++ b/.gitignore @@ -43,4 +43,5 @@ NAMESPACE man/ # pkgdown generated files -docs/ \ No newline at end of file +docs/ +/docker/.env diff --git a/DESCRIPTION b/DESCRIPTION index d1ab881..e190892 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -34,6 +34,6 @@ Suggests: covr License: GPL-3 VignetteBuilder: knitr -RoxygenNote: 7.1.1 -URL: https://github.com/MarselScheer/simTool -BugReports: https://github.com/MarselScheer/simTool/issues \ No newline at end of file +RoxygenNote: 7.3.2 +URL: http://MarselScheer.github.io/simTool +BugReports: https://github.com/MarselScheer/simTool/issues diff --git a/Makefile b/Makefile index a35ace3..fd44df8 100644 --- a/Makefile +++ b/Makefile @@ -13,10 +13,11 @@ NAMESPACE: R/* Rscript -e "roxygen2::roxygenize()" R-cmd-check: NAMESPACE - R CMD build . - R CMD check --as-cran --no-manual $(PKGNAME)*.tar.gz - make clean-pkg-build-file - make clean-cmd-check-files + Rscript -e "devtools::check(document=FALSE, args=c('--as-cran'))" + # R CMD build . + # R CMD check --as-cran --no-manual $(PKGNAME)*.tar.gz + # make clean-pkg-build-file + # make clean-cmd-check-files clean-pkg-build-file: rm $(PKGNAME)*tar.gz diff --git a/NEWS.md b/NEWS.md index 46b20af..bc1bde2 100644 --- a/NEWS.md +++ b/NEWS.md @@ -2,7 +2,7 @@ Version 1.1.7.9000 ========================= -* placeholder for next development-cycle +* Upcoming R-version does not allow to apply attr() to primitives to assign values. Fix this by decorating primitives if they are used. Version 1.1.7 ========================= diff --git a/R/expand_tibble.R b/R/expand_tibble.R index 241dc12..831cdc2 100644 --- a/R/expand_tibble.R +++ b/R/expand_tibble.R @@ -7,7 +7,7 @@ #' @param \dots vectors, factors or a list containing these. #' @return See \code{\link{expand.grid}} but instead of a #' \code{\link{data.frame}} -#' a \code{\link{tibble}} is returned. +#' a \code{\link[tibble:tibble]{tibble}} is returned. #' @author Marsel Scheer #' @seealso \code{\link{expand.grid}} #' @examples diff --git a/R/extract_fun_and_parameter.R b/R/extract_fun_and_parameter.R index 3ba195d..2d8c053 100644 --- a/R/extract_fun_and_parameter.R +++ b/R/extract_fun_and_parameter.R @@ -2,8 +2,17 @@ extract_fun_and_parameter <- function(row, envir) { idx_na <- which(is.na(row)) idx_gt <- which(names(row) == ".truth") + copy_primitives <- function(fun) { + # upcoming R-version will not support attr(fun, "xyz") <- sth if fun is + # a builtin function like mean, min, max, ... + # so we wrap it to have a non-primitive function + if (!is.primitive(fun)) { + return(fun) + } + return(function(...) fun(...)) + } ret <- list( - fun = get(unlist(row[1, 1]), envir = envir), + fun = copy_primitives(fun=get(unlist(row[1, 1]), envir = envir)), para = as.list(row[1, -c(1, idx_na, idx_gt), drop = FALSE]) ) diff --git a/R/print.eval_tibbles.R b/R/print.eval_tibbles.R index 8764486..953d0b2 100644 --- a/R/print.eval_tibbles.R +++ b/R/print.eval_tibbles.R @@ -7,6 +7,7 @@ #' @param ... not used. only necessary to define the function consistently #' with respect to \code{print(x, ...)} #' @author Marsel Scheer +#' @keywords internal #' @export print.eval_tibbles <- function(x, ...) { print(x$simulation) diff --git a/README.md b/README.md index 3580204..094c0c8 100644 --- a/README.md +++ b/README.md @@ -47,7 +47,7 @@ using confidence levels 0.8, 0.9, 0.95 are applied. This is repeated summary_fun = list(mean = mean) ) et - #> # A tibble: 12 x 8 + #> # A tibble: 12 × 8 #> fun rate n replications summary_fun proc conf.level coverage #> #> 1 rexp 10 10 1 mean t.test 0.8 0.754 @@ -65,9 +65,9 @@ using confidence levels 0.8, 0.9, 0.95 are applied. This is repeated #> Number of data generating functions: 4 #> Number of analyzing procedures: 3 #> Number of replications: 1000 - #> Estimated replications per hour: 1214959 - #> Start of the simulation: 2021-09-05 06:54:43 - #> End of the simulation: 2021-09-05 06:54:46 + #> Estimated replications per hour: 1318457 + #> Start of the simulation: 2025-04-05 05:37:59.800157 + #> End of the simulation: 2025-04-05 05:38:02.530619 ## Installation diff --git a/_pkgdown.yml b/_pkgdown.yml index cd40c23..1f27537 100644 --- a/_pkgdown.yml +++ b/_pkgdown.yml @@ -1,6 +1,7 @@ title: simTool url: http://MarselScheer.github.io/simTool template: + bootstrap: 5 params: bootswatch: flatly diff --git a/docker/Makefile b/docker/Makefile new file mode 100644 index 0000000..a508a46 --- /dev/null +++ b/docker/Makefile @@ -0,0 +1,50 @@ +SHELL := /bin/bash +.ONESHELL: + +PARENT_NAME := sim-tool#$(shell basename $(dir $(PWD))) + +.PHONY: .env +.env: + @echo -------------------- $@ $$(date) -------------------- + echo "PARENT_NAME=$(PARENT_NAME)" > .env + +build-docker-context: + @echo -------------------- $@ $$(date) -------------------- + -rm -rf docker_context + mkdir docker_context + cp -r ide docker_context + echo + echo "Docker context created" + +build-docker: build-docker-context .env + @echo -------------------- $@ $$(date) -------------------- + sudo docker compose -f docker-compose.yaml -p $(PARENT_NAME) build || { exit 1; } + rm -rf docker_context + echo + echo "Docker image build" + +start-docker: .env + @echo -------------------- $@ $$(date) -------------------- + sudo docker compose -f docker-compose.yaml -p $(PARENT_NAME) up -d || { exit 1; } + echo + echo "Docker container is running..." + +shell-docker: + @echo -------------------- $@ $$(date) -------------------- + sudo docker exec -it ide /bin/sh -c "/bin/bash && su -l rstudio" || { exit 1; } + echo + echo "Docker container is running..." + +root-docker: + @echo -------------------- $@ $$(date) -------------------- + sudo docker exec -u root -it ide /bin/sh -c "/bin/bash" || { exit 1; } + echo + echo "Docker container is running..." + +stop-docker: + @echo -------------------- $@ $$(date) -------------------- + sudo docker compose -f docker-compose.yaml -p $(PARENT_NAME) stop || { exit 1; } + echo + echo "Docker container is stopped" + +rebuild-docker: stop-docker build-docker start-docker diff --git a/docker/docker-compose.yaml b/docker/docker-compose.yaml new file mode 100644 index 0000000..1d8bf7c --- /dev/null +++ b/docker/docker-compose.yaml @@ -0,0 +1,38 @@ +services: + ide: + container_name: ide + build: + context: ./docker_context + dockerfile: ide/Dockerfile + args: + DOCKER_BUILDKIT: 1 + USER_ID: 1000 + GROUP_ID: 1000 + BASE_IMAGE: rocker/verse:4 + shm_size: 8gb + volumes: + - /home/m/docker_fs/repos/simTool:/home/rstudio/simTool + - /home/m/docker_fs/repos/orgfiles/:/home/rstudio/docker_fs/repos/orgfiles/ + - /home/m/docker_fs/dots/.emacs.d.lean:/home/rstudio/.emacs.d + - /home/m/docker_fs/dots/.ssh:/home/rstudio/.ssh + - /tmp/.X11-unix:/tmp/.X11-unix + environment: + - DISPLAY=:0 + - RUNNING_HOST=local + - DISABLE_AUTH=true + ports: + - 8787:8787 + ollama: + container_name: ollama + image: ollama/ollama:0.5.7 + ports: + - 11434:11434 + volumes: + - /home/m/docker_fs/ollama-cache:/root/.ollama + deploy: + resources: + reservations: + devices: + - driver: nvidia + count: 1 + capabilities: [gpu] diff --git a/docker/ide/Dockerfile b/docker/ide/Dockerfile new file mode 100644 index 0000000..da007fa --- /dev/null +++ b/docker/ide/Dockerfile @@ -0,0 +1,31 @@ +ARG BASE_IMAGE= +FROM ${BASE_IMAGE} + +ARG USER_ID= +ARG GROUP_ID= + +RUN apt-get update && apt-get install -y \ + ranger \ + git \ + tig \ + htop \ + emacs \ +# graphviz necessary for dot-programm for instance used +# by plantuml + graphviz \ +# xdg-utils and ff necessary to display +# drake-network-graphs from emacs + xdg-utils \ + firefox \ + && ln -sf /usr/share/zoneinfo/Europe/Berlin /etc/localtime + +USER rstudio +WORKDIR /home/rstudio + +RUN git config --global user.email "scheer@freescience.de" \ + && git config --global user.name "Marsel Scheer" +# last command MUST be USER root?!? +# otherwise container RStudio is not available +USER root + + diff --git a/docker/start.sh b/docker/start.sh deleted file mode 100644 index c4cf196..0000000 --- a/docker/start.sh +++ /dev/null @@ -1,4 +0,0 @@ -sudo docker run --rm -d -p 8787:8787 -e DISABLE_AUTH=true \ - -v ~/docker_fs:/tmp/hostfs \ - -v /tmp/.X11-unix:/tmp/.X11-unix \ - rstudio_emacs:4.1.0 diff --git a/man/expand_tibble.Rd b/man/expand_tibble.Rd index 157cc0d..be6c7e9 100644 --- a/man/expand_tibble.Rd +++ b/man/expand_tibble.Rd @@ -12,7 +12,7 @@ expand_tibble(...) \value{ See \code{\link{expand.grid}} but instead of a \code{\link{data.frame}} - a \code{\link{tibble}} is returned. + a \code{\link[tibble:tibble]{tibble}} is returned. } \description{ Actually a wrapper for \code{\link{expand.grid}}, but diff --git a/man/print.eval_tibbles.Rd b/man/print.eval_tibbles.Rd index d16ef8b..d9461e2 100644 --- a/man/print.eval_tibbles.Rd +++ b/man/print.eval_tibbles.Rd @@ -18,3 +18,4 @@ Prints objects created by \code{eval_tibbles()} \author{ Marsel Scheer } +\keyword{internal} diff --git a/vignettes/simTool.Rmd b/vignettes/simTool.Rmd index 7bc6d66..903b8fb 100644 --- a/vignettes/simTool.Rmd +++ b/vignettes/simTool.Rmd @@ -559,8 +559,8 @@ post_analyze <- function(o, .truth) { #post-process the object returned by boot.ci method = c("normal", "basic", "student", "percent", "bca") ret = o[method] - lower = unlist(purrr::map(ret, ~dplyr::nth(.x, -2))) - upper = sapply(ret, dplyr::last) + lower = unlist(purrr::map(ret, ~dplyr::nth(.x[1,], -2))) + upper = unlist(purrr::map(ret, ~dplyr::nth(.x[1,], -1))) type = paste("boot", method, sep = "_") return( @@ -657,8 +657,8 @@ bootstrap_ci <- function(x, conf.level, R = 999) { ci <- boot::boot.ci(b, conf = conf.level, type = "all") method = c("normal", "basic", "student", "percent", "bca") ret = ci[method] - lower = unlist(purrr::map(ret, ~dplyr::nth(.x, -2))) - upper = sapply(ret, dplyr::last) + lower = unlist(purrr::map(ret, ~dplyr::nth(.x[1,], -2))) + upper = unlist(purrr::map(ret, ~dplyr::nth(.x[1,], -1))) type = paste("boot", method, sep = "_") # unify return