Skip to content

Commit

Permalink
lintr: lint_dir cleaning
Browse files Browse the repository at this point in the history
  • Loading branch information
Gero1999 committed Dec 3, 2024
1 parent 9f7fb16 commit 0da010b
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 21 deletions.
2 changes: 1 addition & 1 deletion R/create_c0_impute_column.R
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ create_c0_impute <- function(mydata) {
mydata_with_int <- merge(
x = mydata$conc$data,
y = mydata$dose$data[, group_columns]
) %>%
) %>%
merge(mydata$intervals)

# Process imputation strategy based on each interval
Expand Down
37 changes: 18 additions & 19 deletions R/format_data.R
Original file line number Diff line number Diff line change
Expand Up @@ -80,16 +80,16 @@ create_dose <- function(df_conc,
dplyr::ungroup()
}

mydata = readRDS("inst/shiny/mydata3")
mydata <- readRDS("inst/shiny/mydata3")

#' Create Dose Intervals Dataset
#'
#' This function creates a dataset with dose intervals and specified pharmacokinetic parameters.
#'
#' @param df_dose A PKNCAdose object. Default from the app is `mydose`.
#' @param params A character vector specifying the pharmacokinetic parameters to include. Default is `c("aucinf.obs", "aucint.last", "auclast", "cmax", "half.life", "tmax")`.
#' @param start_from_last_dose If start of the interval should be based on dose start (TIME) or actual C1 (AFRLT).
#'
#' @param params A character vector specifying the pharmacokinetic parameters to include.
#' @param start_from_last_dose Logical defining if start is at time of last dose or C1.
#'
#' @return A data frame containing the dose intervals and specified pharmacokinetic parameters.
#'
#' @details
Expand All @@ -108,26 +108,25 @@ mydata = readRDS("inst/shiny/mydata3")
#'
#' @import dplyr
#' @export
create_dose_intervals <- function(mydose = mydose,
params = c("aucinf.obs", "aucint.last", "auclast", "cmax",
create_dose_intervals <- function(mydose = mydose,
params = c("aucinf.obs", "aucint.last", "auclast", "cmax",
"half.life", "tmax", "lambda.z", "lambda.z.n.points",
"r.squared", "adj.r.squared", "lambda.z.time.first"),
start_from_last_dose = TRUE
){

start_from_last_dose = TRUE) {

# Based on dose times create a data frame with start and end times
dose_intervals <- mydose$data %>%
group_by(!!!syms(unname(unlist(mydose$columns$groups)))) %>%
dplyr::arrange(!!sym( mydose$columns$time)) %>%
mutate(start = if (start_from_last_dose) !!sym( mydose$columns$time) else AFRLT,
end = lead(!!sym( mydose$columns$time),
default = Inf)) %>%
ungroup() %>%
select(start, end, unname(unlist(mydose$columns$groups)), DOSNO) %>%
group_by(!!!syms(unname(unlist(mydose$columns$groups)))) %>%
dplyr::arrange(!!sym(mydose$columns$time)) %>%
mutate(start = if (start_from_last_dose) !!sym(mydose$columns$time) else !!sym("AFRLT"),
end = lead(!!sym(mydose$columns$time),
default = Inf)) %>%
ungroup() %>%
select(start, end, unname(unlist(mydose$columns$groups)), DOSNO) %>%

# Create logical columns with the TRUE and as names params argument
mutate(!!!setNames(rep(TRUE, length(params)), params)) %>%
mutate(!!!setNames(rep(TRUE, length(params)), params)) %>%

# Identify the intervals as the base ones for the NCA analysis
mutate(type_interval = "main")

Expand Down
2 changes: 1 addition & 1 deletion inst/shiny/tabs/nca.R
Original file line number Diff line number Diff line change
Expand Up @@ -422,7 +422,7 @@ observeEvent(input$nca, {
)
)
mydata(mydata)

}

# Perform NCA on the profiles selected
Expand Down

0 comments on commit 0da010b

Please sign in to comment.