#' Title
#'
#' @param workdir workdir
#'
#' @return asdf
#' @export
#'
#' @import readr
#' @import tibble
#' @import dplyr
#' @importFrom rstudioapi getSourceEditorContext
#' @examples
metarExperiment_enthera <- function(workdir = NULL) {
# Setting working directory
if (is.na(workdir)) {
message("Using RStudio hardcoded WD variable")
rstudioapi::getSourceEditorContext()$path %>% ## maybe better with here::here()
setwd()
} else {
workdir %>%
setwd()
}
# Load data RData
if (!file.exists("CatalogMapping/IGC/igc.RData")) {
stop(str_c("CatalogMapping/IGC/igc.RData not exists in ", workdir))
}
load("CatalogMapping/IGC/igc.RData")
dataTable <- as_tibble(dataTable)
metadata_df <- as_tibble(metadata)
# Load categorical variables
if (!file.exists("Metadata/CategoricalVariables.txt")) {
stop(str_c("Metadata/CategoricalVariables.txt not exists in ", workdir))
} else {
categorical_vals <- read_delim("Metadata/CategoricalVariables.txt", delim = '\t',
col_names = c("CategoricalVariable", "PaletteName"))
}
# Load numeric and longitudinal variables
if (file.exists("Metadata/NumericalVariables.txt")) {
message("Reading numerical variables")
numeric_vals <- read_delim("Metadata/NumericalVariables.txt", delim = '\t',
col_names = c("NumericalVariable", "PaletteName"))
} else {
numeric_vals <- NULL
}
if (file.exists("Metadata/LongitudinalVariables.txt")) {
message("Reading longitudonal variables")
longitudinal_vals <- read_delim("Metadata/LongitudinalVariables.txt", delim = '\t',
col_names = c("LongitudinalVariable", "LinkVariable",
"GroupVariable", "Breakpoints"))
} else {
longitudinal_vals <- NULL
}
mre <- list(dataTable = dataTable,
metadata_df = metadata_df,
categorical_vals = categorical_vals,
numeric_vals = numeric_vals,
longitudinal_vals = longitudinal_vals)
# Cleaning env and return
rm(list = ls()[-grep('mre', ls())])
return(mre)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.