Skip to content

Commit

Permalink
bugfix: distribution_repeater() if number_of_events = 1
Browse files Browse the repository at this point in the history
  • Loading branch information
mrustl committed Oct 15, 2018
1 parent 5943096 commit f9b4704
Show file tree
Hide file tree
Showing 41 changed files with 172 additions and 173 deletions.
3 changes: 2 additions & 1 deletion DESCRIPTION
Expand Up @@ -23,10 +23,11 @@ Imports:
EnvStats,
ggplot2
License: MIT + file LICENSE
Encoding: UTF-8
LazyLoad: yes
URL: http://kwb-r.github.io/kwb.qmra/
BugReports: https://github.com/KWB-R/kwb.qmra/issues
RoxygenNote: 6.0.1
RoxygenNote: 6.1.0
Suggests:
knitr,
ggrepel,
Expand Down
2 changes: 2 additions & 0 deletions NEWS.md
Expand Up @@ -2,6 +2,8 @@

* current development version

* bugfix: distribution_repeater(), works now if number_of_events == 1

# [kwb.qmra 0.1.1](https://github.com/KWB-R/kwb.qmra/releases/tag/v.0.1.1)

* version developed within DEMOWARE project and also released on [Zenodo](https://zenodo.org/record/154111)
Expand Down
16 changes: 10 additions & 6 deletions R/random_distribution.R
Expand Up @@ -16,18 +16,22 @@ distribution_repeater <- function(number_of_repeatings = 10,
number_of_events = 365,
func,
... ) {

repl_tmp <- vapply(seq_len(number_of_repeatings),
function(x) {func(n = number_of_events,
...)},FUN.VALUE = numeric(number_of_events))

if(number_of_events == 1) repl_tmp <- t(repl_tmp)

repl <- sapply(1:number_of_repeatings,
function(x) {func(n = number_of_events,
...)}) %>%
repl <- repl_tmp %>%
as.data.frame() %>%
cbind(eventID = 1:number_of_events )
colnames(repl) <- c(1:number_of_repeatings, "eventID")
cbind(eventID = seq_len(number_of_events))
colnames(repl) <- c(seq_len(number_of_repeatings), "eventID")

repl_list <- tidyr::gather_(data = repl,
key_col = "repeatID",
value_col = "values",
gather_cols = as.character(1:number_of_repeatings))
gather_cols = as.character(seq_len(number_of_repeatings)))

repl_list$repeatID <- as.integer(repl_list$repeatID)

Expand Down
62 changes: 31 additions & 31 deletions docs/articles/doseresponse.html

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

Binary file modified docs/articles/doseresponse_files/figure-html/unnamed-chunk-4-1.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion docs/articles/general.html

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

2 changes: 0 additions & 2 deletions docs/articles/index.html

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

2 changes: 1 addition & 1 deletion docs/articles/installation.html

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

0 comments on commit f9b4704

Please sign in to comment.