#' Checks the input arguments of the path_model() function
#'
#' Checks each input argument in sequence, whilst suppressing errors, to allow for one-step checking of arguments.
#'
#' @param data
#' @param connection_matrix
#' @param variables_in_block
#' @param block_names
#' @param estimators
#' @return A list of lists of errors and warnings respectively that indicate
#' what is wrong with the arguments that are entered into the path_model function.
#' @export
check_arguments <- function(data, connection_matrix, variables_in_block,
block_names,
estimators
#component_selection="auto", n_comps=NULL,
#sub_blocks=FALSE, sub_block_assignment=NULL, sub_block_scaling_method=NULL
#preprocessing settings: standardizing, mean-centering, {Assign per block, include scaling for categorical variables and spectra}
#input_variable_type: assigns what type each different variable has
#bootstrap="FALSE", bootstrap_iter=NULL
){
error_list <- c()
warning_list <- c()
#Is the graph a DAG?
dag_results <- verify_dag(connection_matrix)
error_list <- c(error_list, dag_results["error_list"])
warning_list <- c(warning_list, dag_results["warning_list"])
#Is data numeric?
if(!is.numeric(data)){
error_list <- c(error_list, "The data matrix contains non-numerical data.")
}
#Give warning if both block_names or rownames and/or colnames connection_matrix are not supplied.
#Check if data is matrix, dataframe or tidyverse equivalents
if(!(is.matrix(data) || is.data.frame(data))){
error_list <- c(error_list, "Input data must be a matrix, dataframe or a tidyverse dataframe equivalent.")
}
#Check whether connection_matrix, variables_in_block and block_names refer to the same number of blocks.
#NaN checking and warnings
#Are all variables assigned? Are all named variables in the data?
#Are all paired optional parameters set if one is set?
are_valid = TRUE
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.