knitr::opts_chunk$set(echo = FALSE, warning = FALSE, message = FALSE, eval = TRUE)
library(knitr)
library(ISLR)
library(tabplot)
library(tidyverse)
library(tabplot)
library(randomForest)
library(stringr)
library(GGally)
library(forcats)
library(caret)
library(kohonen)
library(Amelia)
library(e1071)

# setwd("C:/Users/erbla/OneDrive/R/multiview shiny")



source( stringr::str_c(getwd(),'/mod_load_data v03.R') )

source( stringr::str_c(getwd(),'/mod_summary v02.R') )

source( stringr::str_c(getwd(), '/mod_clean_data v05.R') )

source( stringr::str_c(getwd(), '/mod_som_map_v01.R') )

source( stringr::str_c(getwd(), '/mod_som_cluster_v01.R') )

source( stringr::str_c(getwd(), '/mod_vis_groups_v02.R') )

source( stringr::str_c(getwd(), '/mod_tree_v03.R') )

source( stringr::str_c(getwd(), '/mod_save_v01.R') )
# this creates an object like input, that can store multiple
# reactive values, this object stores values which we will use
# to signal if certain calculations or processes are finished
# and how often they were run

status = reactiveValues( data = NULL)

status$load     = 'No Data loaded. Select Data and Press Load button!'
status$summary        = NULL
status$clean          = NULL
status$ana            = NULL
status$som            = NULL
status$est_exec_time  = NULL
status$map_trained    = NULL
status$map_loaded     = NULL
status$pca      = 'Ready'
status$imp      = 'Ready'
status$corr     = 'Ready'
status$group_stat = 'Ready'
status$tree     = 'Ready'



renderText(status$load)
renderText(status$summary)
renderText(status$clean)
renderText(status$ana)
renderText(status$som)
renderText(status$est_exec_time)
renderText(status$map_trained)
renderText(status$map_loaded)
#renderText(status$tree)

Background

For a more detailed explanation of the code go to this post, which outlines the concept of this app

Data

Load Data

# load two ui_elements and the save_plot() function
# and the rea_load reactive element which returns 
# the data

mod_load_data_ui()

rea_load = mod_load_rea(input, status)

renderText( status$load )
data = params$data

rea_load = reactive({

  data

})

Clean Data

mod_clean_ui(rea_load)

renderText( status$clean )

rea_clean = mod_clean_rea(input, status, rea_load)

Summary

mod_summary_ui(rea_clean)

Start Analysis

mod_ana_ui(rea_clean, select_grouping_var = F)

renderText( status$ana )

rea_ana   = mod_ana_rea(input, status, rea_clean)

SOM

Train Map

Boxcox-transformed values are used by default

rea_trans_som = mod_trans_som_rea(rea_ana)


mod_som_map_ui()

mod_som_map_exec_time_out(rea_trans_som
                          , input
                          , status)


rea_trained_som = mod_train_map_som_rea(rea_trans_som
                                        , rea_clean
                                        , input
                                        , status)


renderText(
  status$est_exec_time
)

renderText(
  status$map_trained
)

renderText(
  status$map_loaded
)


mod_save_map_som_rea(rea_trained_som
                     ,input
                     ,status
                     )


rea_som = mod_load_map_rea(rea_trained_som
                           , input
                           , status)

Expand Map

Vis Map

mod_som_mao_plot(input, rea_som)

Cluster Map

rea_dist = mod_som_cluster_dist( rea_som )

Optimal No Cluster

mod_som_cluster_opt_no_clust( input, rea_dist )

Cluster

mod_som_cluster_ui(input)

rea_clust = mod_som_cluster_rea(input
                               , status
                               , rea_som
                               , rea_dist
                               )

renderText(status$clust)

mod_som_cluster_plot(input
                     , rea_clust
                     , rea_som)

Vis Clusters

rea_new_data = mod_som_clust_2_data(rea_clust)

mod_vis_groups_ui(rea_new_data, 'cluster')

mod_vis_groups_render_no_obs(input, rea_new_data)

mod_vis_groups_render_numericals(input, rea_new_data)

mod_vis_groups_render_categoricals(input, rea_new_data)

Tree

mod_tree_UI(input, status, rea_new_data )

renderPrint( str(rea_new_data()) )

rea_tree = mod_tree_rea(input, status, rea_new_data)

mod_tree_plot(input, status, rea_tree)

mod_tree_UI_plot()

mod_tree_prune_plot(input, rea_tree, rea_new_data)

Save Clusters

mod_save(input, rea_new_data)


erblast/oetteR documentation built on May 27, 2019, 12:11 p.m.