#' Calculate descriptive statistics of simulated PK parameters
#'
#' \code{bsfnDescstat} will calculate descriptive statistics of simulated PK parameters
#'
#' @return The descriptive statistics of pharmacokinetic parameters
#' @param bsfnPkparamData data frame generated by bsfnPkparam function
#' @export
#' @examples
#' bsfnDescstat(bsfnPkparam(20,500))
#' bsfnDescstat(bsfnPkparamMulti(20,500))
#' bsfnDescExample <- cbind(bsfnDescstat(bsfnPkparam(20,500)),
#' bsfnDescstat(bsfnPkparam(50,500))[,2])
#' colnames(bsfnDescExample)[2:3] <- c('20 kg', '50 kg')
#' bsfnDescExample
#' @import dplyr
#' @seealso \url{https://asancpt.github.io/bsfnsim}
bsfnDescstat <- function(bsfnPkparamData){
bsfnPkparamData %>%
gather(param, value, -subjid) %>%
group_by(param) %>%
summarise_at(vars(value), funs(mean, sd, min, max)) %>%
mutate(value = sprintf('%0.2f (%0.2f) [%0.2f-%0.2f]', mean, sd, min, max)) %>%
select(`PK parameters`= param, `value: mean (sd) [min-max]`= value)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.