-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Labels
enhancementNew feature or requestNew feature or request
Description
I don't use the following function anymore, but it may become handy in the future?
#' Convert Stan data list to original dataframe
#'
#' Not exported. Useful to use with [get_index()] when we only have data_stan.
#'
#' @param data_stan List (output from [prepare_data_lgtd()])
#'
#' @return Dataframe with columns Patient, Time, Score, Label
#'
#' @details This function is designed to use with the Markov Chain model (MC).
#'
#' @noRd
standata_to_df <- function(data_stan) {
stopifnot(is.list(data_stan),
all(c("k_obs", "t_obs", "y_obs", "k_test", "t_test", "y_test") %in% names(data_stan)),
length(data_stan$k_obs) == length(data_stan$t_obs),
length(data_stan$k_obs) == length(data_stan$y_obs),
length(data_stan$k_test) == length(data_stan$t_test),
length(data_stan$k_test) == length(data_stan$y_test))
out <- with(data_stan,
data.frame(Patient = c(k_obs, k_test),
Time = c(t_obs, t_test),
Score = c(y_obs, y_test),
Label = c(rep("Training", length(y_obs)),
rep("Testing", length(y_test)))))
return(out)
}
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request