Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
27 changes: 15 additions & 12 deletions .github/workflows/Features.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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: |
Expand All @@ -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
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/R-CMD-check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/Test-coverage.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/pkgdown.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,5 @@ NAMESPACE
man/

# pkgdown generated files
docs/
docs/
/docker/.env
6 changes: 3 additions & 3 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -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
RoxygenNote: 7.3.2
URL: http://MarselScheer.github.io/simTool
BugReports: https://github.com/MarselScheer/simTool/issues
9 changes: 5 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
=========================
Expand Down
2 changes: 1 addition & 1 deletion R/expand_tibble.R
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
11 changes: 10 additions & 1 deletion R/extract_fun_and_parameter.R
Original file line number Diff line number Diff line change
Expand Up @@ -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])
)

Expand Down
1 change: 1 addition & 0 deletions R/print.eval_tibbles.R
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
#> <chr> <dbl> <int> <int> <chr> <chr> <dbl> <dbl>
#> 1 rexp 10 10 1 mean t.test 0.8 0.754
Expand All @@ -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

Expand Down
1 change: 1 addition & 0 deletions _pkgdown.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
title: simTool
url: http://MarselScheer.github.io/simTool
template:
bootstrap: 5
params:
bootswatch: flatly

Expand Down
50 changes: 50 additions & 0 deletions docker/Makefile
Original file line number Diff line number Diff line change
@@ -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
38 changes: 38 additions & 0 deletions docker/docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -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]
31 changes: 31 additions & 0 deletions docker/ide/Dockerfile
Original file line number Diff line number Diff line change
@@ -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


4 changes: 0 additions & 4 deletions docker/start.sh

This file was deleted.

2 changes: 1 addition & 1 deletion man/expand_tibble.Rd

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

1 change: 1 addition & 0 deletions man/print.eval_tibbles.Rd

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

8 changes: 4 additions & 4 deletions vignettes/simTool.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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
Expand Down