You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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)
}
The text was updated successfully, but these errors were encountered:
I don't use the following function anymore, but it may become handy in the future?
The text was updated successfully, but these errors were encountered: