content
stringlengths 0
14.9M
| filename
stringlengths 44
136
|
---|---|
tabPanel('Home', value = 'tab_home_analyze', icon = icon('home'),
navlistPanel(id = 'navlist_home',
well = FALSE,
widths = c(2, 10),
source('ui/ui_rfm_home.R', local = TRUE)[[1]]
)
) | /scratch/gouwar.j/cran-all/cranData/xplorerr/inst/app-rfm/ui/ui_home.R |
tabPanel('RFM', value = 'tab_rfm', icon = icon('sitemap'),
navlistPanel(id = 'navlist_rfm',
well = FALSE,
widths = c(2, 10),
source('ui/ui_rfm_score_transaction.R', local = TRUE)[[1]],
source('ui/ui_rfm_customer_1.R', local = TRUE)[[1]],
source('ui/ui_rfm_customer_2.R', local = TRUE)[[1]],
source('ui/ui_rfm_heat_map.R', local = TRUE)[[1]],
source('ui/ui_rfm_bar_chart.R', local = TRUE)[[1]],
source('ui/ui_rfm_histogram.R', local = TRUE)[[1]],
source('ui/ui_rfm_scatter_plot.R', local = TRUE)[[1]]
)
) | /scratch/gouwar.j/cran-all/cranData/xplorerr/inst/app-rfm/ui/ui_rfm.R |
tabPanel('Bar Chart', value = 'tab_rfm_barchart',
fluidPage(
fluidRow(
column(6, align = 'left',
h4('RFM Bar Chart'),
p("Examine the distribution of monetary scores for the different
combinations of frequency and recency scores.")
)
),
hr(),
fluidRow(
br(),
br(),
column(2),
column(8, align = 'center',
plotOutput('plot_barchart', height = '500px') %>%
withSpinner()
),
column(2)
)
)
)
| /scratch/gouwar.j/cran-all/cranData/xplorerr/inst/app-rfm/ui/ui_rfm_bar_chart.R |
tabPanel('Customer Data - I', value = 'tab_rfm_customer_score',
# check box for transcation or customer data
fluidPage(
fluidRow(
column(6, align = 'left',
h4('RFM Analysis'),
p('Recency, frequency and monetary value analysis for customer level data i.e. each row represents
transactions of a customer and the data includes the number of days since the last transaction.')
),
column(6, align = 'right',
actionButton(inputId='rvsp1', label="Help", icon = icon("question-circle"),
onclick ="window.open('https://rfm.rsquaredacademy.com/reference/rfm_table_customer.html', '_blank')")
)
),
hr(),
fluidRow(
column(2, align = "right",
br(),
h5("Unique ID:")
),
column(2, align = "left",
selectInput("rfm_customer_id_c", label = '',
choices = "", selected = "", width = '150px'
),
bsTooltip("rfm_customer_id_c", "Select the variable representing the unique id of the customer.",
"bottom", options = list(container = "body")
)
),
column(2, align = "right",
br(),
h5("Orders:")
),
column(2, align = "left",
selectInput("rfm_n_transactions_c", label = '',
choices = "", selected = "", width = '150px'
),
bsTooltip("rfm_n_transactions_c", "Select the variable representing the number of orders/purchases.",
"bottom", options = list(container = "body")
)
),
column(2, align = "right",
br(),
h6("Days since last transaction:")
),
column(2, align = "left",
selectInput("rfm_recency_days_c", label = '',
choices = "", selected = "", width = '150px'
),
bsTooltip("rfm_recency_days_c", "Select the variable representing the days since last transaction.",
"bottom", options = list(container = "body")
)
)
),
fluidRow(
column(2, align = "right",
br(),
h5("Revenue:")
),
column(2, align = "left",
selectInput("rfm_total_revenue_c", label = '',
choices = "", selected = "", width = '150px'
),
bsTooltip("rfm_total_revenue_c", "Select the variable representing the total revenue from the customer.",
"bottom", options = list(container = "body")
)
),
column(2, align = "right",
br(),
h5("Analysis Date:")
),
column(2, align = "left",
dateInput("rfm_analysis_date_c", label = '', width = '150px'),
bsTooltip("rfm_analysis_date_c", "Select the date of analysis.",
"bottom", options = list(container = "body")
)
),
column(2, align = "right",
br(),
h5("Recency Bins:")
),
column(2, align = "left",
numericInput("rfm_recency_bins_c", label = '',
min = 1, step = 1, value = 5, width = '150px'
),
bsTooltip("rfm_recency_bins_c", "Specify the number of bins for recency.",
"bottom", options = list(container = "body")
)
)
),
fluidRow(
column(2, align = "right",
br(),
h5("Frequency Bins:")
),
column(2, align = "left",
numericInput("rfm_frequency_bins_c", label = '',
min = 1, step = 1, value = 5, width = '150px'
),
bsTooltip("rfm_frequency_bins_c", "Specify the number of bins for frequency.",
"bottom", options = list(container = "body")
)
),
column(2, align = "right",
br(),
h5("Monetary Bins:")
),
column(2, align = "left",
numericInput("rfm_monetary_bins_c", label = '',
min = 1, step = 1, value = 5, width = '150px'
),
bsTooltip("rfm_monetary_bins_c", "Specify the number of bins for monetary value",
"bottom", options = list(container = "body")
)
)
),
br(),
fluidRow(
column(12, align = "center",
actionButton(inputId = 'submit_rfm_customer_score', label = 'Submit', width = '120px', icon = icon('check')),
bsTooltip("submit_rfm_customer_score", "Click here to view RFM score.",
"bottom", options = list(container = "body"))
)
),
fluidRow(
br(),
dataTableOutput('rfm_customer_score_out') %>%
withSpinner()
)
)
) | /scratch/gouwar.j/cran-all/cranData/xplorerr/inst/app-rfm/ui/ui_rfm_customer_1.R |
tabPanel('Customer Data - II', value = 'tab_rfm_customer_score_2',
# check box for transcation or customer data
fluidPage(
fluidRow(
column(6, align = 'left',
h4('RFM Analysis'),
p('Recency, frequency and monetary value analysis for customer level data i.e. each row represents
transactions of a customer and the data includes the date of the latest transaction.')
),
column(6, align = 'right',
actionButton(inputId='rvsp1', label="Help", icon = icon("question-circle"),
onclick ="window.open('https://rfm.rsquaredacademy.com/reference/rfm_table_customer_2.html', '_blank')")
)
),
hr(),
fluidRow(
column(2, align = "right",
br(),
h5("Unique ID:")
),
column(2, align = "left",
selectInput("rfm_customer_id_c_2", label = '',
choices = "", selected = "", width = '150px'
),
bsTooltip("rfm_customer_id_c_2", "Select the variable representing the unique id of the customer.",
"bottom", options = list(container = "body")
)
),
column(2, align = "right",
br(),
h5("Orders:")
),
column(2, align = "left",
selectInput("rfm_n_transactions_c_2", label = '',
choices = "", selected = "", width = '150px'
),
bsTooltip("rfm_n_transactions_c_2", "Select the variable representing the number of orders/purchases.",
"bottom", options = list(container = "body")
)
),
column(2, align = "right",
br(),
h6("Latest Transaction Date:")
),
column(2, align = "left",
selectInput("rfm_order_date_c", label = '',
choices = "", selected = "", width = '150px'
),
bsTooltip("rfm_order_date_c", "Select the variable representing the date of the latest order/transaction.",
"bottom", options = list(container = "body")
)
)
),
fluidRow(
column(2, align = "right",
br(),
h5("Revenue:")
),
column(2, align = "left",
selectInput("rfm_total_revenue_c_2", label = '',
choices = "", selected = "", width = '150px'
),
bsTooltip("rfm_total_revenue_c_2", "Select the variable representing the total revenue from the customer.",
"bottom", options = list(container = "body")
)
),
column(2, align = "right",
br(),
h5("Analysis Date:")
),
column(2, align = "left",
dateInput("rfm_analysis_date_c_2", label = '', width = '150px'),
bsTooltip("rfm_analysis_date_c_2", "Select the date of analysis.",
"bottom", options = list(container = "body")
)
),
column(2, align = "right",
br(),
h5("Recency Bins:")
),
column(2, align = "left",
numericInput("rfm_recency_bins_c_2", label = '',
min = 1, step = 1, value = 5, width = '150px'
),
bsTooltip("rfm_recency_bins_c_2", "Specify the number of bins for recency.",
"bottom", options = list(container = "body")
)
)
),
fluidRow(
column(2, align = "right",
br(),
h5("Frequency Bins:")
),
column(2, align = "left",
numericInput("rfm_frequency_bins_c_2", label = '',
min = 1, step = 1, value = 5, width = '150px'
),
bsTooltip("rfm_frequency_bins_c_2", "Specify the number of bins for frequency.",
"bottom", options = list(container = "body")
)
),
column(2, align = "right",
br(),
h5("Monetary Bins:")
),
column(2, align = "left",
numericInput("rfm_monetary_bins_c_2", label = '',
min = 1, step = 1, value = 5, width = '150px'
),
bsTooltip("rfm_monetary_bins_c_2", "Specify the number of bins for monetary value",
"bottom", options = list(container = "body")
)
)
),
br(),
fluidRow(
column(12, align = "center",
actionButton(inputId = 'submit_rfm_customer_score_2', label = 'Submit', width = '120px', icon = icon('check')),
bsTooltip("submit_rfm_customer_score_2", "Click here to view RFM score.",
"bottom", options = list(container = "body"))
)
),
fluidRow(
br(),
dataTableOutput('rfm_customer_score_out_2') %>%
withSpinner()
)
)
) | /scratch/gouwar.j/cran-all/cranData/xplorerr/inst/app-rfm/ui/ui_rfm_customer_2.R |
tabPanel('Heat Map', value = 'tab_rfm_heatmap',
fluidPage(
fluidRow(
column(6, align = 'left',
h4('RFM Heatmap'),
p("The heat map shows the average monetary value for different
categories of recency and frequency scores. Higher scores of frequency and
recency are characterized by higher average monetary value as indicated by
the darker areas in the heatmap.")
)
),
hr(),
fluidRow(
br(),
br(),
column(2),
column(8, align = 'center',
plotOutput('plot_heatmap', height = '500px') %>%
withSpinner()
),
column(2)
)
)
)
| /scratch/gouwar.j/cran-all/cranData/xplorerr/inst/app-rfm/ui/ui_rfm_heat_map.R |
tabPanel('Histogram', value = 'tab_rfm_histogram',
fluidPage(
fluidRow(
column(6, align = 'left',
h4('Histograms'),
p("Histograms of recency, frequency and monetary value.")
)
),
hr(),
fluidRow(
br(),
br(),
column(2),
column(8, align = 'center',
plotOutput('plot_histogram', height = '500px') %>%
withSpinner()
),
column(2)
)
)
)
| /scratch/gouwar.j/cran-all/cranData/xplorerr/inst/app-rfm/ui/ui_rfm_histogram.R |
tabPanel("Home", value = "tab_rfm_home",
fluidPage(
fluidRow(
column(12, align = 'center',
h3('What type of data do you have?')
)
),
br(),
br(),
fluidRow(
column(3),
column(4, align = 'center',
h4('Transaction Level Data'),
p('Each row represents a transaction/order.')
),
column(2, align = 'left',
br(),
actionButton(
inputId = 'click_transaction',
label = 'Click Here',
width = '100px'
)
),
column(3)
),
br(),
fluidRow(
column(3),
column(4, align = 'center',
h4('Customer Level Data'),
p('Each row represents transactions of a customer. The data includes
the number of days since the last transaction.')
),
column(2, align = 'left',
br(),
actionButton(
inputId = 'click_customer_1',
label = 'Click Here',
width = '100px'
)
),
column(3)
),
br(),
fluidRow(
column(3),
column(4, align = 'center',
h4('Customer Level Data'),
p('Each row represents transactions of a customer. The data includes
the date of the latest transaction.')
),
column(2, align = 'left',
br(),
actionButton(
inputId = 'click_customer_2',
label = 'Click Here',
width = '100px'
)
),
column(3)
)
)
) | /scratch/gouwar.j/cran-all/cranData/xplorerr/inst/app-rfm/ui/ui_rfm_home.R |
tabPanel('Scatter Plots', value = 'tab_rfm_scatter',
fluidPage(
fluidRow(
column(6, align = 'left',
h4('Scatter Plots'),
p("Examine the relationship between recency, frequency and monetary values.")
)
),
hr(),
fluidRow(
br(),
br(),
column(2),
column(8, align = 'center',
plotOutput('plot_scatter_1', height = '500px') %>%
withSpinner()
),
column(2)
),
fluidRow(
br(),
br(),
column(2),
column(8, align = 'center',
plotOutput('plot_scatter_2', height = '500px') %>%
withSpinner()
),
column(2)
),
fluidRow(
br(),
br(),
column(2),
column(8, align = 'center',
plotOutput('plot_scatter_3', height = '500px') %>%
withSpinner()
),
column(2)
)
)
)
| /scratch/gouwar.j/cran-all/cranData/xplorerr/inst/app-rfm/ui/ui_rfm_scatter_plot.R |
tabPanel('Transaction Data', value = 'tab_rfm_transaction_score',
# check box for transcation or customer data
fluidPage(
fluidRow(
column(6, align = 'left',
h4('RFM Analysis'),
p('Recency, frequency and monetary value analysis for transaction level data i.e. each row represents
a transaction/order.')
),
column(6, align = 'right',
actionButton(inputId='rvsp1', label="Help", icon = icon("question-circle"),
onclick ="window.open('https://rfm.rsquaredacademy.com/reference/rfm_table_order.html', '_blank')")
)
),
hr(),
fluidRow(
column(2, align = "right",
br(),
h5("Unique ID:")
),
column(2, align = "left",
selectInput("rfm_customer_id_t", label = '',
choices = "", selected = "", width = '150px'
),
bsTooltip("rfm_customer_id_t", "Select the variable representing the unique id of the customer.",
"bottom", options = list(container = "body")
)
),
column(2, align = "right",
br(),
h5("Order Date:")
),
column(2, align = "left",
selectInput("rfm_order_date_t", label = '',
choices = "", selected = "", width = '150px'
),
bsTooltip("rfm_order_date_t", "Select the variable representing the date of the order/transaction.",
"bottom", options = list(container = "body")
)
),
column(2, align = "right",
br(),
h5("Revenue:")
),
column(2, align = "left",
selectInput("rfm_revenue_t", label = '',
choices = "", selected = "", width = '150px'
),
bsTooltip("rfm_revenue_t", "Select the variable representing the total revenue from the transaction.",
"bottom", options = list(container = "body")
)
)
),
fluidRow(
column(2, align = "right",
br(),
h5("Analysis Date:")
),
column(2, align = "left",
dateInput("rfm_analysis_date_t", label = '', width = '150px'),
bsTooltip("rfm_analysis_date_t", "Select the date of analysis.",
"bottom", options = list(container = "body")
)
),
column(2, align = "right",
br(),
h5("Recency Bins:")
),
column(2, align = "left",
numericInput("rfm_recency_bins_t", label = '',
min = 1, step = 1, value = 5, width = '150px'
),
bsTooltip("rfm_recency_bins_t", "Specify the number of bins for recency.",
"bottom", options = list(container = "body")
)
),
column(2, align = "right",
br(),
h5("Frequency Bins:")
),
column(2, align = "left",
numericInput("rfm_frequency_bins_t", label = '',
min = 1, step = 1, value = 5, width = '150px'
),
bsTooltip("rfm_recency_bins_t", "Specify the number of bins for recency.",
"bottom", options = list(container = "body")
)
)
),
fluidRow(
column(2, align = "right",
br(),
h5("Monetary Bins:")
),
column(2, align = "left",
numericInput("rfm_monetary_bins_t", label = '',
min = 1, step = 1, value = 5, width = '150px'
),
bsTooltip("rfm_monetary_bins_t", "Specify the number of bins for monetary value.",
"bottom", options = list(container = "body")
)
)
),
br(),
fluidRow(
column(12, align = "center",
actionButton(inputId = 'submit_rfm_transaction_score', label = 'Submit', width = '120px', icon = icon('check')),
bsTooltip("submit_rfm_transaction_score", "Click here to view RFM score.",
"bottom", options = list(container = "body"))
)
),
fluidRow(
br(),
dataTableOutput('rfm_transaction_score_out') %>%
withSpinner()
)
)
) | /scratch/gouwar.j/cran-all/cranData/xplorerr/inst/app-rfm/ui/ui_rfm_score_transaction.R |
tabPanel('Screen', value = 'tab_scr', icon = icon('binoculars'),
navlistPanel(id = 'navlist_scr',
well = FALSE,
widths = c(2, 10),
source('ui/ui_screen.R', local = TRUE)[[1]]
)
)
| /scratch/gouwar.j/cran-all/cranData/xplorerr/inst/app-rfm/ui/ui_scr.R |
tabPanel('Screen', value = 'tab_screen',
fluidPage(
fluidRow(
column(8, align = 'left',
h4('Data Screening'),
p('Screen data for missing values, verify column names and data types.')
),
column(4, align = 'right',
actionButton(inputId='dscreenlink1', label="Help", icon = icon("question-circle"),
onclick ="window.open('https://descriptr.rsquaredacademy.com/reference/ds_screener.html', '_blank')"),
actionButton(inputId='dscreenlink3', label="Demo", icon = icon("video-camera"),
onclick ="window.open('https://www.youtube.com/watch?v=IckaPr19Bvc#t=03m17s', '_blank')")
)
),
hr(),
fluidRow(
column(12, align = 'center',
verbatimTextOutput('screen')
)
),
fluidRow(
br(),
column(12, align = 'center',
actionButton('finalok', 'Approve', width = '120px', icon = icon('sign-out')),
bsTooltip("finalok", "Click here to approve the data.",
"top", options = list(container = "body"))
)
)
)
)
| /scratch/gouwar.j/cran-all/cranData/xplorerr/inst/app-rfm/ui/ui_screen.R |
tabPanel('Segments', value = 'tab_segment', icon = icon('object-ungroup'),
navlistPanel(id = 'navlist_rfm',
well = FALSE,
widths = c(2, 10),
source('ui/ui_segments.R', local = TRUE)[[1]],
source('ui/ui_segment_size.R', local = TRUE)[[1]],
source('ui/ui_average_recency.R', local = TRUE)[[1]],
source('ui/ui_average_frequency.R', local = TRUE)[[1]],
source('ui/ui_average_monetary.R', local = TRUE)[[1]]
)
) | /scratch/gouwar.j/cran-all/cranData/xplorerr/inst/app-rfm/ui/ui_segment.R |
tabPanel("Segment Size", value = "tab_segment_size",
fluidPage(
fluidRow(
column(6, align = 'left',
h4('Segment Distribution'),
p("Distribution of customers across the segments.")
)
),
hr(),
fluidRow(
br(),
br(),
column(12, align = 'center',
verbatimTextOutput('segment_size_out') %>%
withSpinner()
)
)
)
) | /scratch/gouwar.j/cran-all/cranData/xplorerr/inst/app-rfm/ui/ui_segment_size.R |
tabPanel("Segmentation", value = "tab_rfm_segments",
fluidPage(
fluidRow(
column(6, align = 'left',
h4('Generate Segments'),
p("Classify customers based on the individual recency, frequency and monetary scores. Those
customers who do not fall into any of the below segments will be classified as 'Others'.")
)
),
hr(),
fluidRow(
column(6, align = "right", br(), h5("Number of Segments:")),
column(6, align = "left",
numericInput(
inputId = "n_segments",
label = "",
min = 1,
max = 10,
step = 1,
value = 5
)
)
),
hr(),
fluidRow(
column(1),
column(2, h5('Segment')),
column(3, h5('Recency Score')),
column(3, h5('Frequency Score')),
column(3, h5('Monetary Score'))
),
column(12, uiOutput('segment_prep')),
fluidRow(
column(12, align = 'center',
br(),
actionButton(inputId="button_create_segments", label="Generate Segments", icon = icon('thumbs-up')),
bsTooltip("button_create_segments", "Click here to generate segments.",
"top", options = list(container = "body")),
br(),
br()
)
),
fluidRow(
br(),
dataTableOutput("segment_out")
)
)
) | /scratch/gouwar.j/cran-all/cranData/xplorerr/inst/app-rfm/ui/ui_segments.R |
tabPanel("Select Data", value = "tab_seldata",
fluidPage(
fluidRow(
column(6, align = 'left',
h4('Select Data Set'),
p('Select a data set from the drop down box and click on submit.')
),
column(6, align = 'right',
actionButton(inputId='seldatalink', label="Demo", icon = icon("video-camera"),
onclick ="window.open('https://www.youtube.com/watch?v=IckaPr19Bvc#t=01m14s', '_blank')")
)
),
hr(),
fluidRow(
column(12, align = "center",
selectInput(
inputId = "sel_data",
label = "Select a data set:",
choices = '',
# choices = c('csv', 'excel', 'json', 'spss', 'stata', 'sas'),
selected = '',
width = '200px',
)
)
),
fluidRow(
column(12, align = 'center',
br(),
actionButton(inputId = 'submit_seldata', label = 'Submit', width = '120px', icon = icon('check')),
bsTooltip("submit_seldata", "Click here to select data.",
"bottom", options = list(container = "body")))
)
)
) | /scratch/gouwar.j/cran-all/cranData/xplorerr/inst/app-rfm/ui/ui_seldata.R |
tabPanel('Select Variables', value = 'tab_selvar',
fluidPage(
fluidRow(
column(6, align = 'left',
h4('Select Variables'),
p('Click on Yes to select variables.')
),
column(6, align = 'right',
actionButton(inputId='selvarlink', label="Demo", icon = icon("video-camera"),
onclick ="window.open('https://www.youtube.com/watch?v=IckaPr19Bvc#t=02m19s', '_blank')")
)
),
hr(),
fluidRow(
column(12, align = 'center',
h4('Do you want to select variables?')
)
),
fluidRow(
column(6, align = 'right',
actionButton(
inputId = 'button_selvar_yes',
label = 'Yes',
width = '120px'
)
),
column(6, align = 'left',
actionButton(
inputId = 'button_selvar_no',
label = 'No',
width = '120px'
)
)
),
fluidRow(
br(),
br(),
uiOutput('show_sel_button')
),
fluidRow(
uiOutput('sub_sel_button')
)
)
) | /scratch/gouwar.j/cran-all/cranData/xplorerr/inst/app-rfm/ui/ui_select.R |
tabPanel('Transform', value = 'tab_trans', icon = icon('rotate-right'),
navlistPanel(id = 'navlist_trans',
well = FALSE,
widths = c(2, 10),
source('ui/ui_seldata.R', local = TRUE)[[1]],
source('ui/ui_transform2.R', local = TRUE)[[1]],
source('ui/ui_select.R', local = TRUE)[[1]]
)
)
| /scratch/gouwar.j/cran-all/cranData/xplorerr/inst/app-rfm/ui/ui_trans.R |
tabPanel('Transform', value = 'tab_transform',
fluidPage(
fluidRow(
column(6, align = 'left',
h4('Data Transformation'),
p('Rename variables and modify data types.')
),
column(6, align = 'right',
actionButton(inputId='translink3', label="Demo", icon = icon("video-camera"),
onclick ="window.open('https://www.youtube.com/watch?v=IckaPr19Bvc#t=01m23s', '_blank')")
)
),
hr(),
fluidRow(
column(3, tags$h5('Variable')),
column(3, tags$h5('Rename Variable')),
column(3, tags$h5('Modify Data Type'))
),
column(12, uiOutput('trans_try')),
fluidRow(
tags$br()
),
fluidRow(
column(12, align = 'center',
br(),
actionButton(inputId="apply_changes", label="Apply Changes", icon = icon('thumbs-up')),
bsTooltip("apply_changes", "Click here to apply changes to data.",
"top", options = list(container = "body")),
br(),
br()
)
)
)
)
| /scratch/gouwar.j/cran-all/cranData/xplorerr/inst/app-rfm/ui/ui_transform2.R |
tabPanel('Get Data', value = 'tab_upload', icon = icon('server'),
navlistPanel(id = 'navlist_up',
well = FALSE,
widths = c(2, 10),
source('ui/ui_dataoptions.R', local = TRUE)[[1]],
source('ui/ui_datafiles.R', local = TRUE)[[1]],
source('ui/ui_datasamples.R', local = TRUE)[[1]]
# source('ui/ui_upload.R', local = TRUE)[[1]],
# source('ui/ui_excel.R', local = TRUE)[[1]],
# source('ui/ui_json.R', local = TRUE)[[1]],
# source('ui/ui_stata.R', local = TRUE)[[1]],
# source('ui/ui_spss.R', local = TRUE)[[1]],
# source('ui/ui_sas.R', local = TRUE)[[1]]
)
)
| /scratch/gouwar.j/cran-all/cranData/xplorerr/inst/app-rfm/ui/ui_up.R |
tabPanel('View', value = 'tab_vi', icon = icon('sort'),
navlistPanel(id = 'navlist_vi',
well = FALSE,
widths = c(2, 10),
source('ui/ui_view.R', local = TRUE)[[1]]
)
)
| /scratch/gouwar.j/cran-all/cranData/xplorerr/inst/app-rfm/ui/ui_vi.R |
tabPanel('View', value = 'tab_view',
fluidPage(
br(),
fluidRow(
column(6, align = 'left',
actionButton(inputId='view2getdata', label=" Get Data", icon = icon("long-arrow-left"))
),
column(6, align = 'right',
actionButton(inputId='view2analyze', label="Analyze Data", icon = icon("long-arrow-right"))
)
),
hr(),
fluidRow(
dataTableOutput(outputId = "table")
)
)
)
| /scratch/gouwar.j/cran-all/cranData/xplorerr/inst/app-rfm/ui/ui_view.R |
tabPanel("Home", value = "tab_welcome", icon = icon('home'),
fluidPage(
br(),
fluidRow(
column(2),
column(3, align = 'left',
br(),
h3('RFM Analysis'),
p('RFM (recency, frequency, monetary) analysis is a behavior based technique
used to segment customers by examining their transaction history such as'),
tags$ul(
tags$li("how recently a customer has purchased (recency)"),
tags$li("how often they purchase (frequency)"),
tags$li("how much the customer spends (monetary)")
),
p('It is based on the marketing axiom that 80% of your business comes from 20% of
your customers. RFM helps to identify customers who are more likely to respond
to promotions by segmenting them into various categories.')
),
column(2),
column(4, align = 'center',
br(),
br(),
br(),
img(src = 'rfm_main.png', width = '360px', height = '250px')
),
column(1)
),
br(),
br(),
br(),
fluidRow(
column(12, align = "center",
actionButton(inputId='welcomebutton', label="Get Started", icon = icon("long-arrow-right"))
)
),
fluidRow(hr()),
# fluidRow(
# column(12, align = "center", h4("Quick Demo"))
# ),
# fluidRow(
# column(12, align = 'center',
# div(style = "height:550px;",
# br(),
# br(),
# tags$iframe(width="760", height="515", src="https://www.youtube.com/embed/aM0bjrYCvv8?rel=0&autoplay=0")
# )
# )
# ),
br(),
br(),
fluidRow(
column(12, align = "center", h4("Data Sources"))
),
fluidRow(
column(12, align = "center",
p("There are a few data sets available on the internet which can be used for learning RFM analysis
and we list them below:")
)
),
fluidRow(
column(12, align = "center", a("Data Source 1", href = "http://shiny.rstudio.com/", target = "_blank")),
br(),
column(12, align = "center", a("Data Source 2", href = "http://shiny.rstudio.com/", target = "_blank"))
),
br(),
br(),
br()
)
) | /scratch/gouwar.j/cran-all/cranData/xplorerr/inst/app-rfm/ui/ui_welcome.R |
library(shiny)
library(shinyBS)
library(shinythemes)
library(shinycssloaders)
library(magrittr)
library(shinycssloaders)
shinyUI(
navbarPage(HTML("rfm"), id = 'mainpage',
# source('ui/ui_welcome.R', local = TRUE)[[1]],
source('ui/ui_data.R', local = TRUE)[[1]],
source('ui/ui_analyze.R', local = TRUE)[[1]],
source('ui/ui_exit_button.R', local = TRUE)[[1]]
))
| /scratch/gouwar.j/cran-all/cranData/xplorerr/inst/app-rfm/ui.R |
output$binom_shape <- renderPlot({
vdist_binom_plot(input$binom_n, input$binom_p)
})
output$bprob_plot <- renderPlot({
if (input$bprob_tail != 'interval') {
vdist_binom_prob(input$bprob_n, input$bprob_p, input$bprob_s, input$bprob_tail)
} else {
vdist_binom_prob(input$bprob_n, input$bprob_p,
c(input$bprob_tail_1, input$bprob_tail_2), input$bprob_tail)
}
})
output$bperc_plot <- renderPlot({
vdist_binom_perc(input$bperc_n, input$bperc_p, input$bperc_tp, input$bperc_tail)
})
| /scratch/gouwar.j/cran-all/cranData/xplorerr/inst/app-vistributions/logic/logic_binom.R |
output$chisq_shape <- renderPlot({
vdist_chisquare_plot(input$chisq_df, as.logical(input$chisq_norm))
})
output$chiprob_plot <- renderPlot({
vdist_chisquare_prob(input$chiprob_p, input$chiprob_df, input$chiprob_tail)
})
output$chiperc_plot <- renderPlot({
print(vdist_chisquare_perc(input$chiperc_p, input$chiperc_df, input$chiperc_tail))
})
| /scratch/gouwar.j/cran-all/cranData/xplorerr/inst/app-vistributions/logic/logic_chisq.R |
# Exit ---------------------------------------------------------------
observe({
if (isTRUE(input$mainpage == "exit")) {
stopApp()
}
})
| /scratch/gouwar.j/cran-all/cranData/xplorerr/inst/app-vistributions/logic/logic_exit_button.R |
output$f_shape <- renderPlot({
vdist_f_plot(input$f_numdf, input$f_dendf, as.logical(input$f_norm))
})
output$fprob_plot <- renderPlot({
vdist_f_prob(input$fprob_p, input$fprob_numdf, input$fprob_dendf, input$fprob_tail)
})
output$fperc_plot <- renderPlot({
vdist_f_perc(input$fperc_p, input$fperc_numdf, input$fperc_dendf, input$fperc_tail)
})
| /scratch/gouwar.j/cran-all/cranData/xplorerr/inst/app-vistributions/logic/logic_f.R |
eda_menu <- eventReactive(input$finalok, {
fluidRow(
column(12),
br(),
column(12, align = 'center',
h5('What do you want to do?')
),
br(),
br(),
br(),
column(3),
column(4, align = 'left',
h5('Generate detailed descriptive statistics for a continuous variable: ')
),
column(2, align = 'left',
actionButton(
inputId = 'button_1',
label = 'Click Here',
width = '120px'
)
),
column(3),
br(),
br(),
br(),
column(3),
column(4, align = 'left',
h5('Generate frequency distribution of a categorical variable: ')
),
column(2, align = 'left',
actionButton(
inputId = 'button_2',
label = 'Click Here',
width = '120px'
)
),
column(3),
br(),
br(),
br(),
column(3),
column(4, align = 'left',
h5('Generate frequency distribution a continuous variable: ')
),
column(2, align = 'left',
actionButton(
inputId = 'button_3',
label = 'Click Here',
width = '120px'
)
),
column(3),
br(),
br(),
br(),
column(3),
column(4, align = 'left',
h5('Generate two way table of categorical variables: ')
),
column(2, align = 'left',
actionButton(
inputId = 'button_4',
label = 'Click Here',
width = '120px'
)
),
column(3),
br(),
br(),
br(),
column(3),
column(4, align = 'left',
h5('Generate multiple one way tables of categorical variables: ')
),
column(2, align = 'left',
actionButton(
inputId = 'button_5',
label = 'Click Here',
width = '120px'
)
),
column(3),
br(),
br(),
br(),
column(3),
column(4, align = 'left',
h5('Generate multiple two way tables of categorical variables: ')
),
column(2, align = 'left',
actionButton(
inputId = 'button_6',
label = 'Click Here',
width = '120px'
)
),
column(3),
br(),
br(),
br(),
column(3),
column(4, align = 'left',
h5('Generate grouped summary statistics: ')
),
column(2, align = 'left',
actionButton(
inputId = 'button_7',
label = 'Click Here',
width = '120px'
)
),
column(3)
)
})
output$eda_options <- renderUI({
eda_menu()
})
observeEvent(input$click_descriptive, {
updateNavbarPage(session, 'mainpage', selected = 'tab_home_analyze')
updateNavlistPanel(session, 'navlist_home', 'tab_eda_home')
})
observeEvent(input$click_distributions, {
updateNavbarPage(session, 'mainpage', selected = 'tab_home_analyze')
updateNavlistPanel(session, 'navlist_home', 'tab_dist_home')
})
observeEvent(input$click_inference, {
updateNavbarPage(session, 'mainpage', selected = 'tab_home_analyze')
updateNavlistPanel(session, 'navlist_home', 'tab_infer_home')
})
observeEvent(input$click_model, {
updateNavbarPage(session, 'mainpage', selected = 'tab_home_analyze')
updateNavlistPanel(session, 'navlist_home', 'tab_model_home')
})
observeEvent(input$click_visualize, {
updateNavbarPage(session, 'mainpage', selected = 'tab_viz_home')
updateNavlistPanel(session, 'navlist_vizmenu', 'tab_home_viz')
})
# observeEvent(input$click_visualize, {
# updateNavbarPage(session, 'mainpage', selected = 'tab_viz_lib')
# })
observeEvent(input$button_1, {
updateNavbarPage(session, 'mainpage', selected = 'tab_eda')
updateNavlistPanel(session, 'navlist_eda', 'tab_summary')
})
observeEvent(input$button_2, {
updateNavbarPage(session, 'mainpage', selected = 'tab_eda')
updateNavlistPanel(session, 'navlist_eda', 'tab_fqual')
})
observeEvent(input$button_3, {
updateNavbarPage(session, 'mainpage', selected = 'tab_eda')
updateNavlistPanel(session, 'navlist_eda', 'tab_fquant')
})
observeEvent(input$button_4, {
updateNavbarPage(session, 'mainpage', selected = 'tab_eda')
updateNavlistPanel(session, 'navlist_eda', 'tab_cross')
})
observeEvent(input$button_5, {
updateNavbarPage(session, 'mainpage', selected = 'tab_eda')
updateNavlistPanel(session, 'navlist_eda', 'tab_mult1')
})
observeEvent(input$button_6, {
updateNavbarPage(session, 'mainpage', selected = 'tab_eda')
updateNavlistPanel(session, 'navlist_eda', 'tab_mult2')
})
observeEvent(input$button_7, {
updateNavbarPage(session, 'mainpage', selected = 'tab_eda')
updateNavlistPanel(session, 'navlist_eda', 'tab_gsummary')
})
observeEvent(input$button_dist_home_1, {
updateNavbarPage(session, 'mainpage', selected = 'tab_dist')
updateNavlistPanel(session, 'navlist_dist', 'tab_norm')
})
observeEvent(input$button_dist_home_2, {
updateNavbarPage(session, 'mainpage', selected = 'tab_dist')
updateNavlistPanel(session, 'navlist_dist', 'tab_t')
})
observeEvent(input$button_dist_home_3, {
updateNavbarPage(session, 'mainpage', selected = 'tab_dist')
updateNavlistPanel(session, 'navlist_dist', 'tab_chisq')
})
observeEvent(input$button_dist_home_4, {
updateNavbarPage(session, 'mainpage', selected = 'tab_dist')
updateNavlistPanel(session, 'navlist_dist', 'tab_binom')
})
observeEvent(input$button_dist_home_5, {
updateNavbarPage(session, 'mainpage', selected = 'tab_dist')
updateNavlistPanel(session, 'navlist_dist', 'tab_f')
})
observeEvent(input$button_infer_home_1, {
updateNavbarPage(session, 'mainpage', selected = 'tab_home_analyze')
updateNavlistPanel(session, 'navlist_home', 'tab_infer1_home')
})
observeEvent(input$button_infer_home_2, {
updateNavbarPage(session, 'mainpage', selected = 'tab_home_analyze')
updateNavlistPanel(session, 'navlist_home', 'tab_infer2_home')
})
observeEvent(input$button_infer_home_3, {
updateNavbarPage(session, 'mainpage', selected = 'tab_home_analyze')
updateNavlistPanel(session, 'navlist_home', 'tab_infer3_home')
})
# links for inferential statistics
observeEvent(input$inf_menu_1_t, {
updateNavbarPage(session, 'mainpage', selected = 'tab_infer')
updateNavlistPanel(session, 'navlist_infer', 'tab_ttest')
})
observeEvent(input$inf_menu_1_var, {
updateNavbarPage(session, 'mainpage', selected = 'tab_infer')
updateNavlistPanel(session, 'navlist_infer', 'tab_osvartest')
})
observeEvent(input$inf_menu_1_prop, {
updateNavbarPage(session, 'mainpage', selected = 'tab_infer')
updateNavlistPanel(session, 'navlist_infer', 'tab_osproptest')
})
observeEvent(input$inf_menu_1_chi, {
updateNavbarPage(session, 'mainpage', selected = 'tab_infer')
updateNavlistPanel(session, 'navlist_infer', 'tab_chigof')
})
observeEvent(input$inf_menu_1_runs, {
updateNavbarPage(session, 'mainpage', selected = 'tab_infer')
updateNavlistPanel(session, 'navlist_infer', 'tab_runs')
})
observeEvent(input$inf_menu_2_it, {
updateNavbarPage(session, 'mainpage', selected = 'tab_infer')
updateNavlistPanel(session, 'navlist_infer', 'tab_indttest')
})
observeEvent(input$inf_menu_2_pt, {
updateNavbarPage(session, 'mainpage', selected = 'tab_infer')
updateNavlistPanel(session, 'navlist_infer', 'tab_indttest')
})
observeEvent(input$inf_menu_2_binom, {
updateNavbarPage(session, 'mainpage', selected = 'tab_infer')
updateNavlistPanel(session, 'navlist_infer', 'tab_binomtest')
})
observeEvent(input$inf_menu_2_var, {
updateNavbarPage(session, 'mainpage', selected = 'tab_infer')
updateNavlistPanel(session, 'navlist_infer', 'tab_tsvartest')
})
observeEvent(input$inf_menu_2_prop, {
updateNavbarPage(session, 'mainpage', selected = 'tab_infer')
updateNavlistPanel(session, 'navlist_infer', 'tab_tsproptest')
})
observeEvent(input$inf_menu_2_chi, {
updateNavbarPage(session, 'mainpage', selected = 'tab_infer')
updateNavlistPanel(session, 'navlist_infer', 'tab_chict')
})
observeEvent(input$inf_menu_2_mcnemar, {
updateNavbarPage(session, 'mainpage', selected = 'tab_infer')
updateNavlistPanel(session, 'navlist_infer', 'tab_mcnemar')
})
observeEvent(input$inf_menu_3_anova, {
updateNavbarPage(session, 'mainpage', selected = 'tab_infer')
updateNavlistPanel(session, 'navlist_infer', 'tab_anova')
})
observeEvent(input$inf_menu_3_levene, {
updateNavbarPage(session, 'mainpage', selected = 'tab_infer')
updateNavlistPanel(session, 'navlist_infer', 'tab_levtest')
})
observeEvent(input$inf_menu_3_cochran, {
updateNavbarPage(session, 'mainpage', selected = 'tab_infer')
updateNavlistPanel(session, 'navlist_infer', 'tab_cochran')
})
## visulization links
observeEvent(input$click_base, {
updateNavbarPage(session, 'mainpage', selected = 'tab_viz_home')
updateNavlistPanel(session, 'navlist_vizmenu', 'tab_viz_base')
})
observeEvent(input$click_ggplot2, {
updateNavbarPage(session, 'mainpage', selected = 'tab_viz_home')
updateNavlistPanel(session, 'navlist_vizmenu', 'tab_viz_gg')
})
observeEvent(input$click_prh, {
updateNavbarPage(session, 'mainpage', selected = 'tab_viz_home')
updateNavlistPanel(session, 'navlist_vizmenu', 'tab_viz_others')
})
## link viz libraries to tabs
observeEvent(input$click_bar_base, {
updateNavbarPage(session, 'mainpage', selected = 'tab_base')
updateNavlistPanel(session, 'navlist_base', 'tab_bar')
})
observeEvent(input$click_bar2_base, {
updateNavbarPage(session, 'mainpage', selected = 'tab_base')
updateNavlistPanel(session, 'navlist_base', 'tab_bar2')
})
observeEvent(input$click_box_base, {
updateNavbarPage(session, 'mainpage', selected = 'tab_base')
updateNavlistPanel(session, 'navlist_base', 'tab_box')
})
observeEvent(input$click_box2_base, {
updateNavbarPage(session, 'mainpage', selected = 'tab_base')
updateNavlistPanel(session, 'navlist_base', 'tab_box2')
})
observeEvent(input$click_line_base, {
updateNavbarPage(session, 'mainpage', selected = 'tab_base')
updateNavlistPanel(session, 'navlist_base', 'tab_line')
})
observeEvent(input$click_scatter_base, {
updateNavbarPage(session, 'mainpage', selected = 'tab_base')
updateNavlistPanel(session, 'navlist_base', 'tab_scatter')
})
observeEvent(input$click_hist_base, {
updateNavbarPage(session, 'mainpage', selected = 'tab_base')
updateNavlistPanel(session, 'navlist_base', 'tab_hist')
})
observeEvent(input$click_pie_base, {
updateNavbarPage(session, 'mainpage', selected = 'tab_base')
updateNavlistPanel(session, 'navlist_base', 'tab_pie')
})
observeEvent(input$click_pie2_base, {
updateNavbarPage(session, 'mainpage', selected = 'tab_base')
updateNavlistPanel(session, 'navlist_base', 'tab_pie3d')
})
## ggplot2
observeEvent(input$click_bar_gg, {
updateNavbarPage(session, 'mainpage', selected = 'tab_gg')
updateNavlistPanel(session, 'navlist_gg', 'tab_gbar')
})
observeEvent(input$click_bar2_gg, {
updateNavbarPage(session, 'mainpage', selected = 'tab_gg')
updateNavlistPanel(session, 'navlist_gg', 'tab_gbar2')
})
observeEvent(input$click_box_gg, {
updateNavbarPage(session, 'mainpage', selected = 'tab_gg')
updateNavlistPanel(session, 'navlist_gg', 'tab_gbox')
})
observeEvent(input$click_box2_gg, {
updateNavbarPage(session, 'mainpage', selected = 'tab_gg')
updateNavlistPanel(session, 'navlist_gg', 'tab_gbox2')
})
observeEvent(input$click_line_gg, {
updateNavbarPage(session, 'mainpage', selected = 'tab_gg')
updateNavlistPanel(session, 'navlist_gg', 'tab_gline1')
})
observeEvent(input$click_scatter_gg, {
updateNavbarPage(session, 'mainpage', selected = 'tab_gg')
updateNavlistPanel(session, 'navlist_gg', 'tab_gscatter')
})
observeEvent(input$click_hist_gg, {
updateNavbarPage(session, 'mainpage', selected = 'tab_gg')
updateNavlistPanel(session, 'navlist_gg', 'tab_ghist')
})
observeEvent(input$click_pie_gg, {
updateNavbarPage(session, 'mainpage', selected = 'tab_gg')
updateNavlistPanel(session, 'navlist_gg', 'tab_gpie')
})
observeEvent(input$click_line2_gg, {
updateNavbarPage(session, 'mainpage', selected = 'tab_gg')
updateNavlistPanel(session, 'navlist_gg', 'tab_gline2')
})
## others
observeEvent(input$click_bar_others, {
updateNavbarPage(session, 'mainpage', selected = 'tab_others')
updateNavlistPanel(session, 'navlist_others', 'tab_bar_plot_1')
})
observeEvent(input$click_bar2_others, {
updateNavbarPage(session, 'mainpage', selected = 'tab_others')
updateNavlistPanel(session, 'navlist_others', 'tab_bar_plot_2')
})
observeEvent(input$click_box_others, {
updateNavbarPage(session, 'mainpage', selected = 'tab_others')
updateNavlistPanel(session, 'navlist_others', 'tab_box_plot_1')
})
observeEvent(input$click_box2_others, {
updateNavbarPage(session, 'mainpage', selected = 'tab_others')
updateNavlistPanel(session, 'navlist_others', 'tab_box_plot_2')
})
observeEvent(input$click_line_others, {
updateNavbarPage(session, 'mainpage', selected = 'tab_others')
updateNavlistPanel(session, 'navlist_others', 'tab_line_prh')
})
observeEvent(input$click_scatter_others, {
updateNavbarPage(session, 'mainpage', selected = 'tab_others')
updateNavlistPanel(session, 'navlist_others', 'tab_scatter_prh')
})
observeEvent(input$click_hist_others, {
updateNavbarPage(session, 'mainpage', selected = 'tab_others')
updateNavlistPanel(session, 'navlist_others', 'tab_hist_prh')
})
observeEvent(input$click_pie_others, {
updateNavbarPage(session, 'mainpage', selected = 'tab_others')
updateNavlistPanel(session, 'navlist_others', 'tab_pie_prh')
})
## model links
observeEvent(input$model_reg_click, {
updateNavbarPage(session, 'mainpage', selected = 'tab_reg')
updateNavlistPanel(session, 'navlist_reg', 'tab_regress')
})
observeEvent(input$model_varsel_click, {
updateNavbarPage(session, 'mainpage', selected = 'tab_reg')
updateNavlistPanel(session, 'navlist_reg', 'tab_var_select')
})
observeEvent(input$model_resdiag_click, {
updateNavbarPage(session, 'mainpage', selected = 'tab_reg')
updateNavlistPanel(session, 'navlist_reg', 'tab_res_diag')
})
observeEvent(input$model_het_click, {
updateNavbarPage(session, 'mainpage', selected = 'tab_reg')
updateNavlistPanel(session, 'navlist_reg', 'tab_hetero')
})
observeEvent(input$model_coldiag_click, {
updateNavbarPage(session, 'mainpage', selected = 'tab_reg')
updateNavlistPanel(session, 'navlist_reg', 'tab_regcollin')
})
observeEvent(input$model_infl_click, {
updateNavbarPage(session, 'mainpage', selected = 'tab_reg')
updateNavlistPanel(session, 'navlist_reg', 'tab_inflobs')
})
observeEvent(input$model_fit_click, {
updateNavbarPage(session, 'mainpage', selected = 'tab_reg')
updateNavlistPanel(session, 'navlist_reg', 'tab_mfit')
})
observeEvent(input$model_varcontrib_click, {
updateNavbarPage(session, 'mainpage', selected = 'tab_reg')
updateNavlistPanel(session, 'navlist_reg', 'tab_regvarcont')
})
| /scratch/gouwar.j/cran-all/cranData/xplorerr/inst/app-vistributions/logic/logic_home.R |
output$norm_shape <- renderPlot({
vdist_normal_plot(input$norm_m, input$norm_sd)
})
output$nprob_plot <- renderPlot({
vdist_normal_prob(input$nprob_p, input$nprob_m, input$nprob_sd, input$nprob_tail)
})
output$nperc_plot <- renderPlot({
vdist_normal_perc(input$nperc_p, input$nperc_m, input$nperc_sd, input$nperc_tail)
})
| /scratch/gouwar.j/cran-all/cranData/xplorerr/inst/app-vistributions/logic/logic_norm.R |
output$t_shape <- renderPlot({
vdist_t_plot(input$t_df)
})
output$tprob_plot <- renderPlot({
vdist_t_prob(input$tprob_p, input$tprob_df, input$tprob_tail)
})
output$tperc_plot <- renderPlot({
vdist_t_perc(input$tperc_p, input$tperc_df, input$tperc_tail)
})
| /scratch/gouwar.j/cran-all/cranData/xplorerr/inst/app-vistributions/logic/logic_t.R |
library(vistributions)
library(tibble)
library(magrittr)
library(ggplot2)
shinyServer(function(input, output, session) {
source("logic/logic_binom.R", local = T)
source("logic/logic_f.R", local = T)
source("logic/logic_t.R", local = T)
source("logic/logic_norm.R", local = T)
source("logic/logic_chisq.R", local = T)
source("logic/logic_home.R", local = T)
source("logic/logic_exit_button.R", local = T)
})
| /scratch/gouwar.j/cran-all/cranData/xplorerr/inst/app-vistributions/server.R |
navbarMenu('Visualize', icon = icon('search-plus'),
source('ui/ui_homes.R', local = TRUE)[[1]],
source('ui/ui_dist.R', local = TRUE)[[1]]
)
| /scratch/gouwar.j/cran-all/cranData/xplorerr/inst/app-vistributions/ui/ui_analyze.R |
tabPanel('Binomial Distribution', value = 'tab_binom',
fluidPage(
fluidRow(
column(12,
fluidRow(
column(8, align = 'left',
h4('Binomial Distribution'),
p('Visualize how changes in number of trials and the probability of
success affect the shape of the binomial distribution.
Compute/visualize probability from a given quantile and quantiles
out of given probability.')
),
column(4, align = 'right',
actionButton(inputId='binomdist1', label="Help", icon = icon("question-circle"),
onclick ="window.open('https://descriptr.rsquaredacademy.com/reference/dist_binom_plot.html', '_blank')")
)
),
hr(),
tabsetPanel(type = 'tabs',
tabPanel('Distribution Shape',
column(4,
column(6, align = 'center',
br(),
br(),
numericInput('binom_n', 'Number of trials', value = 10, min = 1,
step = 1
),
numericInput('binom_p', 'Probability', value = 0.3, min = 0,
max = 1, step = 0.01
)
)
),
column(8,
plotOutput('binom_shape', height = '400px') %>%
shinycssloaders::withSpinner()
)
),
tabPanel('Find Probability',
column(4,
column(6, align = 'center',
br(),
br(),
numericInput('bprob_n', 'Number of trials', value = 10, min = 1,
step = 1
),
numericInput('bprob_p', 'Probability', value = 0.3, min = 0,
max = 1, step = 0.01
),
selectInput('bprob_tail', 'Tail',
choices = c('lower', 'upper', 'exact', 'interval'),
selected = 'lower'
),
conditionalPanel(
condition = "input.bprob_tail != 'interval'",
numericInput('bprob_s', 'Success', value = 1, min = 0, step = 1)
),
conditionalPanel(
condition = "input.bprob_tail == 'interval'",
numericInput('bprob_tail_1', 'Lower', value = 1, min = 0, step = 1),
br(),
numericInput('bprob_tail_2', 'Upper', value = 1, min = 0, step = 1)
)
)
),
column(8,
plotOutput('bprob_plot', height = '400px') %>%
shinycssloaders::withSpinner()
)
),
tabPanel('Find Percentile',
column(4,
column(6, align = 'center',
br(),
br(),
numericInput('bperc_n', 'Number of trials', value = 10, min = 1,
step = 1
),
numericInput('bperc_p', 'Probability of Success', value = 0.3,
min = 0, max = 1, step = 0.01
),
numericInput('bperc_tp', 'Aggregated Probability', value = 0.05,
min = 0, max = 0.5, step = 0.01
),
selectInput('bperc_tail', 'Tail',
choices = c('lower', 'upper'), selected = 'lower'
)
)
),
column(8,
plotOutput('bperc_plot', height = '400px') %>%
shinycssloaders::withSpinner()
)
)
)
)
)
)
)
| /scratch/gouwar.j/cran-all/cranData/xplorerr/inst/app-vistributions/ui/ui_binom.R |
tabPanel('Chisquare Distribution', value = 'tab_chisq',
fluidPage(
fluidRow(
column(8, align = 'left',
h4('Chi Square Distribution'),
p('Visualize how changes in degrees of freedom affect the shape of the
chi square distribution. Compute/visualize quantiles out of given
probability and probability from a given quantile.')
),
column(4, align = 'right',
actionButton(inputId='chidistlink1', label="Help", icon = icon("question-circle"),
onclick ="window.open('https://descriptr.rsquaredacademy.com/reference/dist_chi_plot.html', '_blank')")
)
),
hr(),
fluidRow(
column(12,
tabsetPanel(type = 'tabs',
tabPanel('Distribution Shape',
column(4,
column(6, align = 'center',
br(),
br(),
numericInput('chisq_df', 'Degrees of freedom', value = 4,
min = 1, step = 1
),
selectInput('chisq_norm', 'Normal Distribution',
choices = c('TRUE' = TRUE, 'FALSE' = FALSE),
selected = 'FALSE'
)
)
),
column(8,
plotOutput('chisq_shape', height = '400px') %>%
shinycssloaders::withSpinner()
)
),
tabPanel('Find Probability',
column(4,
column(6, align = 'center',
br(),
br(),
numericInput('chiprob_p', 'Percentile', value = 2,
min = 0, step = 1
),
numericInput('chiprob_df', 'Degrees of freedom', value = 4,
min = 1, step = 1
),
selectInput('chiprob_tail', 'Tail',
choices = c('lower', 'upper'), selected = 'lower'
)
)
),
column(8,
plotOutput('chiprob_plot', height = '400px') %>%
shinycssloaders::withSpinner()
)
),
tabPanel('Find Percentile',
column(4,
column(6, align = 'center',
br(),
br(),
numericInput('chiperc_p', 'Probability', value = 0.3, min = 0,
step = 0.01, max = 1
),
numericInput('chiperc_df', 'Degrees of freedom', value = 4,
min = 1, step = 1
),
selectInput('chiperc_tail', 'Tail',
choices = c('lower', 'upper'), selected = 'lower'
)
)
),
column(8,
plotOutput('chiperc_plot', height = '400px') %>%
shinycssloaders::withSpinner()
)
)
)
)
)
)
)
| /scratch/gouwar.j/cran-all/cranData/xplorerr/inst/app-vistributions/ui/ui_chisq.R |
tabPanel('Distributions', value = 'tab_dist', icon = icon('area-chart'),
navlistPanel(id = 'navlist_dist',
well = FALSE,
widths = c(2, 10),
source('ui/ui_normal.R', local = TRUE)[[1]],
source('ui/ui_t.R', local = TRUE)[[1]],
source('ui/ui_chisq.R', local = TRUE)[[1]],
source('ui/ui_binom.R', local = TRUE)[[1]],
source('ui/ui_f.R', local = TRUE)[[1]]
)
) | /scratch/gouwar.j/cran-all/cranData/xplorerr/inst/app-vistributions/ui/ui_dist.R |
tabPanel('Distributions', value = 'tab_dist_home',
fluidPage(theme = shinytheme('cerulean'),
includeCSS("mystyle.css"),
fluidRow(
column(12),
br(),
column(12, align = 'center',
h5('Visualize Probability Distributions')
),
br(),
br(),
br(),
column(3),
column(4, align = 'left',
h5('Normal Distribution')
),
column(2, align = 'left',
actionButton(
inputId = 'button_dist_home_1',
label = 'Click Here',
width = '120px'
)
),
column(3),
br(),
br(),
br(),
column(3),
column(4, align = 'left',
h5('t Distribution')
),
column(2, align = 'left',
actionButton(
inputId = 'button_dist_home_2',
label = 'Click Here',
width = '120px'
)
),
column(3),
br(),
br(),
br(),
column(3),
column(4, align = 'left',
h5('Chi Square Distribution')
),
column(2, align = 'left',
actionButton(
inputId = 'button_dist_home_3',
label = 'Click Here',
width = '120px'
)
),
column(3),
br(),
br(),
br(),
column(3),
column(4, align = 'left',
h5('Binomial Distribution')
),
column(2, align = 'left',
actionButton(
inputId = 'button_dist_home_4',
label = 'Click Here',
width = '120px'
)
),
column(3),
br(),
br(),
br(),
column(3),
column(4, align = 'left',
h5('F Distribution')
),
column(2, align = 'left',
actionButton(
inputId = 'button_dist_home_5',
label = 'Click Here',
width = '120px'
)
),
column(3)
)
)
) | /scratch/gouwar.j/cran-all/cranData/xplorerr/inst/app-vistributions/ui/ui_dist_home.R |
# Exit -----------------------------------------------------------
tabPanel("", value = "exit", icon = icon("power-off"),
br(),
br(),
br(),
br(),
br(),
br(),
# In case window does not close, one should see this message
fluidRow(column(3),
column(6, h2("Thank you for using", strong("vistributions"), "!"))),
fluidRow(column(3),
column(6, h4("Now you should close this window.")))
)
| /scratch/gouwar.j/cran-all/cranData/xplorerr/inst/app-vistributions/ui/ui_exit_button.R |
tabPanel('F Distribution', value = 'tab_f',
fluidPage(
fluidRow(
column(7, align = 'left',
h4('F Distribution'),
p('Visualize how changes in degrees of freedom affect the shape of the F
distribution. Compute/visualize quantiles out of given probability and
probability from a given quantile.')
),
column(5, align = 'right',
actionButton(inputId='fdistlink1', label="Help", icon = icon("question-circle"),
onclick ="window.open('https://descriptr.rsquaredacademy.com/reference/dist_f_plot.html', '_blank')")
)
),
hr(),
fluidRow(
column(12,
tabsetPanel(type = 'tabs',
tabPanel('Distribution Shape',
column(4,
column(6, align = 'center',
br(),
br(),
numericInput('f_numdf', 'Numerator Degrees of freedom',
value = 4, min = 1, step = 1
),
numericInput('f_dendf', 'Denominator Degrees of freedom',
value = 5, min = 1, step = 1
),
selectInput('f_norm', 'Normal Distribution',
choices = c('TRUE' = TRUE, 'FALSE' = FALSE),
selected = 'FALSE'
)
)
),
column(8,
plotOutput('f_shape', height = '400px') %>%
shinycssloaders::withSpinner()
)
),
tabPanel('Find Probability',
column(4,
column(6, align = 'center',
br(),
br(),
numericInput('fprob_p', 'Percentile', value = 2,
min = 0, step = 1
),
numericInput('fprob_numdf', 'Numerator Degrees of freedom',
value = 4, min = 1, step = 1
),
numericInput('fprob_dendf', 'Denominator Degrees of freedom',
value = 5, min = 1, step = 1
),
selectInput('fprob_tail', 'Tail',
choices = c('lower', 'upper'), selected = 'lower'
)
)
),
column(8,
plotOutput('fprob_plot', height = '400px') %>%
shinycssloaders::withSpinner()
)
),
tabPanel('Find Percentile',
column(4,
column(6, align = 'center',
br(),
br(),
numericInput('fperc_p', 'Probability', value = 0.3, min = 0,
step = 0.01, max = 1
),
numericInput('fperc_numdf', 'Numerator Degrees of freedom',
value = 4, min = 1, step = 1
),
numericInput('fperc_dendf', 'Denominator Degrees of freedom',
value = 5, min = 1, step = 1
),
selectInput('fperc_tail', 'Tail',
choices = c('lower', 'upper'), selected = 'lower'
)
)
),
column(8,
plotOutput('fperc_plot', height = '400px') %>%
shinycssloaders::withSpinner()
)
)
)
)
)
)
)
| /scratch/gouwar.j/cran-all/cranData/xplorerr/inst/app-vistributions/ui/ui_f.R |
tabPanel('Home', value = 'tab_home_analyze', icon = icon('home'),
navlistPanel(id = 'navlist_home',
well = FALSE,
widths = c(2, 10),
source('ui/ui_dist_home.R', local = TRUE)[[1]]
)
) | /scratch/gouwar.j/cran-all/cranData/xplorerr/inst/app-vistributions/ui/ui_homes.R |
tabPanel('Normal Distribution', value = 'tab_norm',
fluidPage(
fluidRow(
column(8, align = 'left',
h4('Normal Distribution'),
p('Visualize how changes in mean and standard deviation affect the shape
of the normal distribution. Compute/visualize quantiles out of given
probability and probability from a given quantile.')
),
column(4, align = 'right',
actionButton(inputId='ndistlink1', label="Help", icon = icon("question-circle"),
onclick ="window.open('https://descriptr.rsquaredacademy.com/reference/dist_norm_plot.html', '_blank')")
)
),
hr(),
fluidRow(
column(12,
tabsetPanel(type = 'tabs',
tabPanel('Distribution Shape',
column(4,
column(6, align = 'center',
br(),
br(),
numericInput('norm_m', 'Mean', value = 0, step = 0.1),
numericInput('norm_sd', 'Standard Deviation', value = 1,
min = 0, step = 0.1)
)
),
column(8,
plotOutput('norm_shape', height = '400px') %>%
shinycssloaders::withSpinner()
)
),
tabPanel('Find Probability',
column(4,
column(6, align = 'center',
br(),
br(),
numericInput('nprob_p', 'Percentile', value = 2, min = 0,
step = 1),
numericInput('nprob_m', 'Mean', value = 0, step = 0.1),
numericInput('nprob_sd', 'Standard Deviation', value = 1,
min = 0, step = 0.1),
selectInput('nprob_tail', 'Tail',
choices = c('lower', 'upper'), selected = 'lower'
)
)
),
column(8,
plotOutput('nprob_plot', height = '400px') %>%
shinycssloaders::withSpinner()
)
),
tabPanel('Find Percentile',
column(4,
column(6, align = 'center',
br(),
br(),
numericInput('nperc_p', 'Probability', value = 0.3, min = 0,
step = 0.01, max = 1
),
numericInput('nperc_m', 'Mean', value = 0, step = 0.1),
numericInput('nperc_sd', 'Standard Deviation', value = 1,
min = 0, step = 0.1),
selectInput('nperc_tail', 'Tail',
choices = c('lower', 'upper'), selected = 'lower'
)
)
),
column(8,
plotOutput('nperc_plot', height = '400px') %>%
shinycssloaders::withSpinner()
)
)
)
)
)
)
)
| /scratch/gouwar.j/cran-all/cranData/xplorerr/inst/app-vistributions/ui/ui_normal.R |
tabPanel('t Distribution', value = 'tab_t',
fluidPage(
fluidRow(
column(6, align = 'left',
h4('t Distribution'),
p('Visualize how degrees of freedom affect the shape of t distribution. Compute/visualize quantiles out of given probability and probability
from a given quantile.')
),
column(6, align = 'right',
actionButton(inputId='tdistlink1', label="Help", icon = icon("question-circle"),
onclick ="window.open('https://descriptr.rsquaredacademy.com/reference/dist_t_plot.html', '_blank')")
)
),
hr(),
fluidRow(
column(12,
tabsetPanel(type = 'tabs',
tabPanel('Distribution Shape',
column(2,
column(12, align = 'center',
br(),
br(),
numericInput('t_df', 'Degrees of Freedom', value = 1,
min = 0, step = 1)
)
),
column(10,
plotOutput('t_shape', height = '500px') %>%
shinycssloaders::withSpinner()
)
),
tabPanel('Find Probability',
column(2,
column(12, align = 'center',
br(),
br(),
numericInput('tprob_p', 'Percentile', value = 2, min = 0,
step = 1),
numericInput('tprob_df', 'Degrees of Freedom', value = 1,
min = 0, step = 1),
selectInput('tprob_tail', 'Tail',
choices = c('lower', 'upper', 'interval', 'both'),
selected = 'lower'
)
)
),
column(10,
plotOutput('tprob_plot', height = '500px') %>%
shinycssloaders::withSpinner()
)
),
tabPanel('Find Percentile',
column(2,
column(12, align = 'center',
br(),
br(),
numericInput('tperc_p', 'Probability', value = 0.3, min = 0,
step = 0.01, max = 1
),
numericInput('tperc_df', 'Degrees of Freedom', value = 1,
min = 0, step = 1),
selectInput('tperc_tail', 'Tail',
choices = c('lower', 'upper', 'both'),
selected = 'lower'
)
)
),
column(10,
plotOutput('tperc_plot', height = '500px') %>%
shinycssloaders::withSpinner()
)
)
)
)
)
)
)
| /scratch/gouwar.j/cran-all/cranData/xplorerr/inst/app-vistributions/ui/ui_t.R |
library(shiny)
library(shinyBS)
library(shinythemes)
library(magrittr)
shinyUI(
navbarPage(HTML("vistributions"), id = 'mainpage',
source('ui/ui_analyze.R', local = TRUE)[[1]],
source('ui/ui_exit_button.R', local = TRUE)[[1]]
))
| /scratch/gouwar.j/cran-all/cranData/xplorerr/inst/app-vistributions/ui.R |
library(plotly)
barly1 <- function(x_data = NULL, data = NULL, b_name = NULL,
b_orientation = 'v', b_text = NULL, bar_col = 'blue',
bar_l_col = 'black', bar_l_wid = 1, bar_gap = 1,
bar_opacity = 1, plot_width = NULL, plot_height = NULL,
axis_range = FALSE, y_min, y_max, auto_size = TRUE,
title = NA, x_title = NA, y_title = NA,
x_showgrid = TRUE, y_showgrid = TRUE,
ax_title_font_family = 'Arial, sans-serif',
ax_title_font_size = 18, ax_title_font_color = 'black',
ax_tick_font_family = 'Arial, sans-serif',
ax_tick_font_size = 18, ax_tick_font_color = 'black',
x_autotick = TRUE, x_ticks = 'outside', x_tick0 = NULL,
x_dtick = NULL, x_ticklen = 5, x_tickwidth = 1,
x_tickcolor = '#444', x_showticklab = TRUE,
x_tickangle = 'auto', x_zeroline = FALSE,
x_showline = TRUE, x_gridcolor = "rgb(204, 204, 204)",
x_gridwidth = 1, x_zerolinecol = "#444",
x_zerolinewidth = 1, x_linecol = '#444',
x_linewidth = 1,
y_autotick = TRUE, y_ticks = 'outside',
y_tick0 = NULL, y_dtick = NULL, y_ticklen = 5,
y_tickwidth = 1, y_tickcolor = '#444',
y_showticklab = TRUE, y_tickangle = 'auto',
y_zeroline = FALSE, y_showline = TRUE,
y_gridcolor = "rgb(204, 204, 204)",
y_gridwidth = 1, y_zerolinecol = "#444",
y_zerolinewidth = 1, y_linecol = '#444',
y_linewidth = 1, left_margin = 80, right_margin = 80,
top_margin = 100, bottom_margin = 80, padding = 0,
add_annotate = FALSE,
x_annotate, y_annotate, text_annotate,
annotate_xanchor = 'auto', show_arrow, arrow_head = 1,
ax_annotate = 20, ay_annotate = -40,
annotate_family = 'sans-serif',
annotate_size = 14, annotate_col = 'red') {
x <- data %>%
select(x_data) %>%
unlist() %>%
levels()
y <- data %>%
select(x_data) %>%
table() %>%
as.vector()
data <- data.frame(x, y)
# style axes title and tickfont
f1 <- list(
family = ax_title_font_family,
size = ax_title_font_size,
color = ax_title_font_color
)
f2 <- list(
family = ax_tick_font_family,
size = ax_tick_font_size,
color = ax_tick_font_color
)
xaxis <- list(
title = x_title,
showgrid = x_showgrid,
autotick = x_autotick,
ticks = x_ticks,
tick0 = x_tick0,
dtick = x_dtick,
ticklen = x_ticklen,
tickwidth = x_tickwidth,
tickcolor = x_tickcolor,
titlefont = f1,
showticklabels = x_showticklab,
tickangle = x_tickangle,
tickfont = f2,
zeroline = x_zeroline,
showline = x_showline,
gridcolor = x_gridcolor,
gridwidth = x_gridwidth,
zerolinecolor = x_zerolinecol,
zerolinewidth = x_zerolinewidth,
linecolor = x_linecol,
linewidth = x_linewidth
)
yaxis <- list(
title = y_title,
showgrid = y_showgrid,
autotick = y_autotick,
ticks = y_ticks,
tick0 = y_tick0,
dtick = y_dtick,
ticklen = y_ticklen,
tickwidth = y_tickwidth,
tickcolor = y_tickcolor,
titlefont = f1,
showticklabels = y_showticklab,
tickangle = y_tickangle,
tickfont = f2,
zeroline = y_zeroline,
showline = y_showline,
mirror = 'ticks',
gridcolor = y_gridcolor,
gridwidth = y_gridwidth,
zerolinecolor = y_zerolinecol,
zerolinewidth = y_zerolinewidth,
linecolor = y_linecol,
linewidth = y_linewidth
)
# margins
m <- list(
l = left_margin,
r = right_margin,
t = top_margin,
b = bottom_margin,
pad = padding
)
# annotations
if(add_annotate) {
a <- list(
x = x_annotate,
y = y_annotate,
text = text_annotate,
xref = 'x',
yref = 'y',
xanchor = annotate_xanchor,
showarrow = show_arrow,
arrowhead = arrow_head,
ax = ax_annotate,
ay = ay_annotate,
font = list(
family = annotate_family,
size = annotate_size,
color = annotate_col
)
)
}
p <- plot_ly(data,
x = ~x,
y = ~y,
type = "bar",
name = b_name,
orientation = b_orientation,
text = b_text,
marker = list(color = bar_col,
opacity = bar_opacity,
line = list(
color = bar_l_col,
width = bar_l_wid,
gap = bar_gap
)),
width = plot_width,
height = plot_height) %>%
layout(
title = title,
xaxis = xaxis,
yaxis = yaxis,
autosize = auto_size,
margin = m
)
if(add_annotate) {
p <- p %>%
layout(annotations = a)
}
if(axis_range) {
p <- p %>%
layout(
yaxis = list(
range = list(y_min, y_max)
)
)
}
p
}
| /scratch/gouwar.j/cran-all/cranData/xplorerr/inst/app-visualize/helper/barly1.R |
barly2 <- function(x, y, data, auto_size = TRUE,
plot_width = NULL, plot_height = NULL,
axis_range = FALSE, y_min, y_max,
title = NA, show_legend = TRUE, x_title = NA,
y_title = NA, x_showgrid = TRUE, y_showgrid = TRUE,
ax_title_font_family = 'Arial, sans-serif',
ax_title_font_size = 18, ax_title_font_color = 'black',
ax_tick_font_family = 'Arial, sans-serif',
ax_tick_font_size = 18, ax_tick_font_color = 'black',
x_autotick = TRUE, x_ticks = 'outside', x_tick0 = NULL,
x_dtick = NULL, x_ticklen = 5, x_tickwidth = 1,
x_tickcolor = '#444', x_showticklab = TRUE,
x_tickangle = 'auto', x_zeroline = FALSE,
x_showline = TRUE, x_gridcolor = "rgb(204, 204, 204)",
x_gridwidth = 1, x_zerolinecol = "#444",
x_zerolinewidth = 1, x_linecol = '#444',
x_linewidth = 1,
y_autotick = TRUE, y_ticks = 'outside',
y_tick0 = NULL, y_dtick = NULL, y_ticklen = 5,
y_tickwidth = 1, y_tickcolor = '#444',
y_showticklab = TRUE, y_tickangle = 'auto',
y_zeroline = FALSE, y_showline = TRUE,
y_gridcolor = "rgb(204, 204, 204)",
y_gridwidth = 1, y_zerolinecol = "#444",
y_zerolinewidth = 1, y_linecol = '#444',
y_linewidth = 1, left_margin = 80, right_margin = 80,
top_margin = 100, bottom_margin = 80, padding = 0,
leg_x = 100, leg_y = 0.5, leg_orientation = 'v',
leg_font_family = 'sans-serif',
leg_font_size = 12, leg_font_color = '#000',
leg_bg_color = '#E2E2E2',
leg_border_col = "#FFFFFF", leg_border_width = 2,
add_annotate = FALSE,
x_annotate, y_annotate, text_annotate,
annotate_xanchor = 'auto', show_arrow, arrow_head = 1,
ax_annotate = 20, ay_annotate = -40,
annotate_family = 'sans-serif',
annotate_size = 14, annotate_col = 'red') {
d <- data %>%
select_(x, y)
t <- d %>%
table() %>%
as.data.frame.matrix()
col1 <- t %>%
rownames() %>%
as.numeric()
dat <- cbind(col1, t)
colnames(dat)[1] <- x
cname <- colnames(dat)
# style axes title and tickfont
f1 <- list(
family = ax_title_font_family,
size = ax_title_font_size,
color = ax_title_font_color
)
f2 <- list(
family = ax_tick_font_family,
size = ax_tick_font_size,
color = ax_tick_font_color
)
xaxis <- list(
title = x_title,
showgrid = x_showgrid,
autotick = x_autotick,
ticks = x_ticks,
tick0 = x_tick0,
dtick = x_dtick,
ticklen = x_ticklen,
tickwidth = x_tickwidth,
tickcolor = x_tickcolor,
titlefont = f1,
showticklabels = x_showticklab,
tickangle = x_tickangle,
tickfont = f2,
zeroline = x_zeroline,
showline = x_showline,
gridcolor = x_gridcolor,
gridwidth = x_gridwidth,
zerolinecolor = x_zerolinecol,
zerolinewidth = x_zerolinewidth,
linecolor = x_linecol,
linewidth = x_linewidth
)
yaxis <- list(
title = y_title,
showgrid = y_showgrid,
autotick = y_autotick,
ticks = y_ticks,
tick0 = y_tick0,
dtick = y_dtick,
ticklen = y_ticklen,
tickwidth = y_tickwidth,
tickcolor = y_tickcolor,
titlefont = f1,
showticklabels = y_showticklab,
tickangle = y_tickangle,
tickfont = f2,
zeroline = y_zeroline,
showline = y_showline,
mirror = 'ticks',
gridcolor = y_gridcolor,
gridwidth = y_gridwidth,
zerolinecolor = y_zerolinecol,
zerolinewidth = y_zerolinewidth,
linecolor = y_linecol,
linewidth = y_linewidth
)
# margins
m <- list(
l = left_margin,
r = right_margin,
t = top_margin,
b = bottom_margin,
pad = padding
)
# legend
l <- list(
x = leg_x,
y = leg_y,
orientation = leg_orientation,
font = list(
family = leg_font_family,
size = leg_font_size,
color = leg_font_color),
bgcolor = leg_bg_color,
bordercolor = leg_border_col,
borderwidth = leg_border_width)
# annotations
if(add_annotate) {
a <- list(
x = x_annotate,
y = y_annotate,
text = text_annotate,
xref = 'x',
yref = 'y',
xanchor = annotate_xanchor,
showarrow = show_arrow,
arrowhead = arrow_head,
ax = ax_annotate,
ay = ay_annotate,
font = list(
family = annotate_family,
size = annotate_size,
color = annotate_col
)
)
}
p <- plot_ly(dat, x = dat[, 1], y = dat[, 2],
type = 'bar', name = cname[2])
j <- dim(dat)[2]
for (i in 3:j) {
p <- p %>%
add_trace(y = dat[, i], name = cname[i])
}
p <- p %>%
layout(
title = title,
xaxis = xaxis,
yaxis = yaxis,
autosize = auto_size,
margin = m,
legend = l,
showlegend = show_legend
)
if(add_annotate) {
p <- p %>%
layout(annotations = a)
}
if(axis_range) {
p <- p %>%
layout(
yaxis = list(
range = list(y_min, y_max)
)
)
}
p
}
# test
barly2('cyl', 'gear', mtcars)
| /scratch/gouwar.j/cran-all/cranData/xplorerr/inst/app-visualize/helper/barly2.R |
# bivariate
bar_plotb <- function(counts, horizontal = FALSE, color = 'blue', border = "black",
besides = FALSE, title = NA, xlab = NA, labels = NA, space = NA, width = 1,
axes = TRUE, axislty = 0, offset = 0,
ylab = NA, colmain = "black", colaxis = "black", collab = "black",
fontmain = 1, fontaxis = 1, fontlab = 1, cexmain = 1, cexaxis = 1, cexlab = 1,
leg = FALSE, leg_x, leg_y, legend, leg_point, leg_colour, leg_boxtype,
leg_boxcol, leg_boxlty, leg_boxlwd, leg_boxborcol, leg_boxxjust, leg_boxyjust,
leg_textcol, leg_textfont, leg_textcolumns, leg_texthoriz, leg_title,
leg_titlecol, leg_textadj, text_p = NA, text_x_loc = NA, text_y_loc = NA,
text_col = "black", text_font = NA, text_size = NA, m_text = NA, m_side = 3,
m_line = 0.5, m_adj = 0.5, m_col = "black", m_font = 1, m_cex = 1) {
if (leg == TRUE) {
legtext <- NULL
} else {
legtext <- rownames(counts)
}
# bar plot
barplot(height = counts, horiz = horizontal, col = color, border = border,
beside = besides, legend = legtext, main = title, xlab = xlab, width = width,
density = NULL, angle = 45, axes = axes, axis.lty = axislty,
offset = offset, ylab = ylab, col.main = colmain, col.axis = colaxis,
col.lab = collab, font.main = fontmain, font.axis = fontaxis,
font.lab = fontlab, cex.main = cexmain, cex.axis = cexaxis, cex.lab = cexlab)
if (is.null(leg_colour)) {
pcol <- 'blue'
} else {
pcol <- leg_colour
}
# legend
if (leg == TRUE) {
legend(leg_x, leg_y,
legend = legend, pch = leg_point, col = pcol,
bty = leg_boxtype, bg = leg_boxcol,
box.lty = leg_boxlty, box.lwd = leg_boxlwd,
box.col = leg_boxborcol, xjust = leg_boxxjust,
yjust = leg_boxyjust, text.col = leg_textcol,
text.font = leg_textfont, ncol = leg_textcolumns,
horiz = leg_texthoriz, title = leg_title,
title.col = leg_titlecol, title.adj = leg_textadj)
}
# add text inside the plot
text(text_x_loc, text_y_loc, text_p, font = text_font, col = text_col,
cex = text_size)
# add text on the mar-gins of the plot
mtext(m_text, side = m_side, line = m_line, adj = m_adj,
col = m_col, font = m_font, cex = m_cex)
}
| /scratch/gouwar.j/cran-all/cranData/xplorerr/inst/app-visualize/helper/bbar-plot.R |
# bivariate
box_plotb <- function(x, y, color = 'blue', borders = 'black', title = NA, subs = NA, xlabel = NA, ylabel = NA,
horiz = FALSE, notches = FALSE, ranges = 1.5, outlines = TRUE, varwidths = FALSE, labels,
colmain = "black", colsub = "black", colaxis = "black", collab = "black",
fontmain = 1, fontsub = 1, fontaxis = 1, fontlab = 1,
cexmain = 1, cexsub = 1, cexaxis = 1, cexlab = 1, text_p = NA,
text_x_loc = NA, text_y_loc = NA, text_col = "black", text_font = NA,
text_size = NA, m_text = NA, m_side = 3, m_line = 0.5, m_adj = 0.5,
m_col = "black", m_font = 1, m_cex = 1, ab_col = "black") {
x <- as.factor(x)
boxplot(y ~ x, col = color, border = borders, main = title, sub = subs, xlab = xlabel, ylab = ylabel,
horizontal = horiz, notch = notches, range = ranges, outline = outlines, names = labels,
varwidth = varwidths, col.main = colmain, col.sub = colsub,
col.axis = colaxis, col.lab = collab, font.main = fontmain,
font.sub = fontsub, font.axis = fontaxis, font.lab = fontlab,
cex.main = cexmain, cex.sub = cexsub, cex.axis = cexaxis,
cex.lab = cexlab)
# # legend
# if (leg == TRUE) {
# legend(leg_x, leg_y,
# legend = legend, pch = leg_point, col = leg_colour,
# bty = leg_boxtype, bg = leg_boxcol,
# box.lty = leg_boxlty, box.lwd = leg_boxlwd,
# box.col = leg_boxborcol, xjust = leg_boxxjust,
# yjust = leg_boxyjust, text.col = leg_textcol,
# text.font = leg_textfont, ncol = leg_textcolumns,
# horiz = leg_texthoriz, title = leg_title,
# title.col = leg_titlecol, title.adj = leg_textadj)
# }
# add text inside the plot
text(text_x_loc, text_y_loc, text_p, font = text_font, col = text_col,
cex = text_size)
# add text on the mar-gins of the plot
mtext(m_text, side = m_side, line = m_line, adj = m_adj,
col = m_col, font = m_font, cex = m_cex)
}
# leg = FALSE, leg_x, leg_y, legend,
# leg_point = 15, leg_colour, leg_boxtype, leg_boxcol, leg_boxlty, leg_boxlwd,
# leg_boxborcol, leg_boxxjust, leg_boxyjust, leg_textcol, leg_textfont,
# leg_textcolumns, leg_texthoriz, leg_title, leg_titlecol, leg_textadj, | /scratch/gouwar.j/cran-all/cranData/xplorerr/inst/app-visualize/helper/bbox-plot.R |
bibar <- function(data, x, y, horizontal = FALSE, stacked = FALSE) {
da <- data %>%
select_(x, y) %>%
table()
xcat <- da %>%
rownames() %>%
as.numeric()
types <- da %>%
ncol() %>%
seq_len()
if (horizontal) {
h <- highchart() %>%
hc_chart(type = 'bar') %>%
hc_xAxis(categories = xcat)
if (stacked) {
h <- h %>%
hc_plotOptions(bar = list(stacking = 'normal'))
}
} else {
h <- highchart() %>%
hc_chart(type = 'column') %>%
hc_xAxis(categories = xcat)
if (stacked) {
h <- h %>%
hc_plotOptions(column = list(stacking = 'normal'))
}
}
for (i in types) {
h <- h %>%
hc_add_series(data = da[i, ] %>% as.vector())
}
h
} | /scratch/gouwar.j/cran-all/cranData/xplorerr/inst/app-visualize/helper/bibar.R |
bobar <- function(x_data = NULL, data = NULL, fig_title = NULL,
x_lab = NULL, y_lab = NULL, x_grid = TRUE,
y_grid = TRUE, bar_width = 0.9, bar_hover = TRUE,
bar_col = NULL, bar_f_alpha = 1,
bar_l_col = NULL, bar_l_alpha = 1) {
xdata <- data %>%
select_(x_data) %>%
table() %>%
as.vector()
xlev <- data %>%
select_(x_data) %>%
unlist() %>%
levels()
ba <- figure(title = fig_title, xlab = x_lab, ylab = y_lab,
xgrid = x_grid, ygrid = y_grid, legend_location = NULL) %>%
ly_bar(x = xlev, y = xdata, hover = bar_hover,
width = bar_width, fill_color = bar_col, fill_alpha = bar_f_alpha,
line_color = bar_l_col, line_alpha = bar_l_alpha)
ba
} | /scratch/gouwar.j/cran-all/cranData/xplorerr/inst/app-visualize/helper/bobar.R |
bobar2 <- function(data = NULL, var_1 = NULL, var_2 = NULL, fig_title = NULL,
x_lab = NULL, y_lab = NULL, x_grid = TRUE, y_grid = TRUE,
legend_loc = 'top_right', bar_pos = 'dodge',
bar_hover = TRUE, bar_width = 0.9, bar_f_alpha = 1) {
ba <- figure(title = fig_title, xlab = x_lab, ylab = y_lab,
xgrid = x_grid, ygrid = y_grid, legend_location = legend_loc) %>%
ly_bar(data = mtcars, x = var_1, y = rep(1, length(var_1)), position = bar_pos,
color = var_2, hover = bar_hover, width = bar_width, fill_alpha = bar_f_alpha)
ba
} | /scratch/gouwar.j/cran-all/cranData/xplorerr/inst/app-visualize/helper/bobar2.R |
bobox <- function(x_data = NULL, data = NULL, fig_title = NULL, x_lab = NULL,
y_lab = NULL, x_grid = TRUE, y_grid = TRUE, legend_loc = NULL,
box_w = 0.9, box_col = NULL, box_alp = 1, box_l_col = NULL,
box_out_gly = 1, box_out_size = 10) {
p <- figure(title = fig_title, xlab = x_lab, ylab = y_lab, xgrid = x_grid,
ygrid = y_grid, legend_location = legend_loc) %>%
ly_boxplot(x = x_data, data = data, width = box_w, fill_color = box_col,
fill_alpha = box_alp, line_color = box_l_col,
outlier_glyph = box_out_gly, outlier_size = box_out_size)
p
} | /scratch/gouwar.j/cran-all/cranData/xplorerr/inst/app-visualize/helper/bobox.R |
bobox2 <- function(data = NULL, x_data = NULL, y_data = NULL, fig_title = NULL,
x_lab = NULL, y_lab = NULL, x_grid = TRUE, y_grid = TRUE,
legend_loc = 'top_right', box_w = 0.9,
box_alp = 1, box_out_gly = 1, box_out_size = 10) {
p <- figure(title = fig_title, xlab = x_lab, ylab = y_lab, xgrid = x_grid,
ygrid = y_grid, legend_location = legend_loc) %>%
ly_boxplot(data = data, x = x_data, y = y_data, width = box_w,
fill_alpha = box_alp, outlier_glyph = box_out_gly,
outlier_size = box_out_size)
p
}
| /scratch/gouwar.j/cran-all/cranData/xplorerr/inst/app-visualize/helper/bobox2.R |
bohist <- function(data = NULL, x_data = NULL, fig_title = NULL, x_lab = NULL, y_lab = NULL,
h_breaks = 5, h_freq = TRUE, h_incl_low = TRUE,
h_right = TRUE, h_fill_col = 'blue', add_density = FALSE,
den_col = 'black', den_alpha = 1, den_width = 1,
den_type = 1, den_leg = FALSE) {
xdata <- data %>%
select_(x_data) %>%
unlist()
h <- figure(title = fig_title, xlab = x_lab, ylab = y_lab, legend_location = NULL) %>%
ly_hist(x = xdata, data = data, breaks = h_breaks, freq = h_freq,
include.lowest = h_incl_low, right = h_right, fill_color = h_fill_col)
if(add_density) {
h <- ly_density(x = xdata, data = data, color = den_col, alpha = den_alpha,
width = den_width, type = den_type, legend = den_leg)
}
h
}
| /scratch/gouwar.j/cran-all/cranData/xplorerr/inst/app-visualize/helper/bohist.R |
boline <- function(data = data, x_data = NULL, y_data = NULL, fig_title = NULL,
x_lab = NULL, y_lab = NULL, l_color = NULL, l_type = 1, l_width = 1,
l_alpha = 1) {
suppressWarnings(
p <- figure(title = fig_title, xlab = x_lab, ylab = y_lab, legend_location = NULL) %>%
ly_lines(x = x_data, y = y_data, data = data,
color = l_color, type = l_type, width = l_width,
alpha = l_alpha, legend = FALSE)
)
p
} | /scratch/gouwar.j/cran-all/cranData/xplorerr/inst/app-visualize/helper/boline.R |
bokatter <- function(data = NULL, x_data = NULL, y_data = NULL, fig_title = NULL,
x_lab = NULL, y_lab = NULL, x_grid = TRUE, y_grid = TRUE,
glyph = 21, point_size = 10, inner_col = 'blue', inner_alpha = 1,
add_line = FALSE, line_a = NULL, line_b = NULL,
line_color = 'black', line_alpha = NULL, line_width = 1,
line_type = 1) {
suppressWarnings(
p <- figure(title = fig_title, xlab = x_lab, ylab = y_lab,
xgrid = x_grid, ygrid = y_grid) %>%
ly_points(x = x_data, y = y_data, data = data, glyph = glyph,
size = point_size, fill_color = inner_col,
fill_alpha = inner_alpha, hover = list(x_data, y_data))
)
suppressWarnings(
if(add_line) {
suppressWarnings(
p <- p %>%
ly_abline(a = line_a, b = line_b, color = line_color, width = line_width,
alpha = line_alpha, type = line_type, legend = NULL)
)
}
)
p
}
| /scratch/gouwar.j/cran-all/cranData/xplorerr/inst/app-visualize/helper/boscatter.R |
boxly1 <- function(data = NULL, y = NULL, b_points = "outliers",
o_col = 'rgb(8,81,156)', o_out_col = 'rgba(219, 64, 82, 0.6)',
o_out_size = 2, auto_size = TRUE, plot_width = NULL, plot_height = NULL,
axis_range = FALSE, x_min, x_max, y_min, y_max, name = NA,
title = NA, show_legend = TRUE, x_title = NA, y_title = NA,
x_showgrid = TRUE, y_showgrid = TRUE, ax_title_font_family = 'Arial, sans-serif',
ax_title_font_size = 18, ax_title_font_color = 'black',
ax_tick_font_family = 'Arial, sans-serif',
ax_tick_font_size = 18, ax_tick_font_color = 'black',
x_autotick = TRUE, x_ticks = 'outside', x_tick0 = NULL,
x_dtick = NULL, x_ticklen = 5, x_tickwidth = 1,
x_tickcolor = '#444', x_showticklab = TRUE,
x_tickangle = 'auto', x_zeroline = FALSE,
x_showline = TRUE, x_gridcolor = "rgb(204, 204, 204)",
x_gridwidth = 1, x_zerolinecol = "#444",
x_zerolinewidth = 1, x_linecol = '#444',
x_linewidth = 1,
y_autotick = TRUE, y_ticks = 'outside',
y_tick0 = NULL, y_dtick = NULL, y_ticklen = 5,
y_tickwidth = 1, y_tickcolor = '#444',
y_showticklab = TRUE, y_tickangle = 'auto',
y_zeroline = FALSE, y_showline = TRUE,
y_gridcolor = "rgb(204, 204, 204)",
y_gridwidth = 1, y_zerolinecol = "#444",
y_zerolinewidth = 1, y_linecol = '#444',
y_linewidth = 1, left_margin = 80, right_margin = 80,
top_margin = 100, bottom_margin = 80, padding = 0,
leg_x = 100, leg_y = 0.5, leg_orientation = 'v',
leg_font_family = 'sans-serif',
leg_font_size = 12, leg_font_color = '#000',
leg_bg_color = '#E2E2E2',
leg_border_col = "#FFFFFF", leg_border_width = 2,
add_annotate = FALSE,
x_annotate, y_annotate, text_annotate,
annotate_xanchor = 'auto', show_arrow, arrow_head = 1,
ax_anntate = 20, ay_annotate = -40,
annotate_family = 'sans-serif',
annotate_size = 14, annotate_col = 'red') {
# style axes title and tickfont
f1 <- list(
family = ax_title_font_family,
size = ax_title_font_size,
color = ax_title_font_color
)
f2 <- list(
family = ax_tick_font_family,
size = ax_tick_font_size,
color = ax_tick_font_color
)
xaxis <- list(
title = x_title,
showgrid = x_showgrid,
autotick = x_autotick,
ticks = x_ticks,
tick0 = x_tick0,
dtick = x_dtick,
ticklen = x_ticklen,
tickwidth = x_tickwidth,
tickcolor = x_tickcolor,
titlefont = f1,
showticklabels = x_showticklab,
tickangle = x_tickangle,
tickfont = f2,
zeroline = x_zeroline,
showline = x_showline,
gridcolor = x_gridcolor,
gridwidth = x_gridwidth,
zerolinecolor = x_zerolinecol,
zerolinewidth = x_zerolinewidth,
linecolor = x_linecol,
linewidth = x_linewidth
)
yaxis <- list(
title = y_title,
showgrid = y_showgrid,
autotick = y_autotick,
ticks = y_ticks,
tick0 = y_tick0,
dtick = y_dtick,
ticklen = y_ticklen,
tickwidth = y_tickwidth,
tickcolor = y_tickcolor,
titlefont = f1,
showticklabels = y_showticklab,
tickangle = y_tickangle,
tickfont = f2,
zeroline = y_zeroline,
showline = y_showline,
mirror = 'ticks',
gridcolor = y_gridcolor,
gridwidth = y_gridwidth,
zerolinecolor = y_zerolinecol,
zerolinewidth = y_zerolinewidth,
linecolor = y_linecol,
linewidth = y_linewidth
)
# margins
m <- list(
l = left_margin,
r = right_margin,
t = top_margin,
b = bottom_margin,
pad = padding
)
# legend
l <- list(
x = leg_x,
y = leg_y,
orientation = leg_orientation,
font = list(
family = leg_font_family,
size = leg_font_size,
color = leg_font_color),
bgcolor = leg_bg_color,
bordercolor = leg_border_col,
borderwidth = leg_border_width)
# annotations
if(add_annotate) {
a <- list(
x = x_annotate,
y = y_annotate,
text = text_annotate,
xref = 'x',
yref = 'y',
xanchor = annotate_xanchor,
showarrow = show_arrow,
arrowhead = arrow_head,
ax = ax_annotate,
ay = ay_annotate,
font = list(
family = annotate_family,
size = annotate_size,
color = annotate_col
)
)
}
if(!is.null(data)) {
y <- data %>%
select_(y) %>%
unlist()
}
p <- plot_ly(type = "box", width = plot_width, height = plot_height) %>%
add_boxplot(y = y, name = name,
boxpoints = b_points,
marker = list(color = o_col,
outliercolor = o_out_col,
line = list(outliercolor = o_out_col,
outlierwidth = o_out_size)),
line = list(color = o_col)
) %>%
layout(
title = title,
xaxis = xaxis,
yaxis = yaxis,
autosize = auto_size,
margin = m,
legend = l,
showlegend = show_legend
)
if(add_annotate) {
p <- p %>%
layout(annotations = a)
}
if(axis_range) {
p <- p %>%
layout(
xaxis = list(
range = list(x_min, x_max)
),
yaxis = list(
range = list(y_min, y_max)
)
)
}
p
}
# p <- boxly1(mtcars, 'mpg', outliers = "suspectedoutliers")
# p
#
y3 <- c(0.75, 5.25, 5.5, 6, 6.2, 6.6, 6.80, 7.0, 7.2, 7.5, 7.5, 7.75, 8.15,
8.15, 8.65, 8.93, 9.2, 9.5, 10, 10.25, 11.5, 12, 16, 20.90, 22.3, 23.25)
p <- boxly1(y = y3, b_points = "suspectedoutliers")
p
| /scratch/gouwar.j/cran-all/cranData/xplorerr/inst/app-visualize/helper/boxly1.R |
boxly2 <- function(data = NULL, y = NULL, b_points = "outliers",
x = NULL, o_col = 'rgb(8,81,156)', o_out_col = 'rgba(219, 64, 82, 0.6)',
o_out_size = 2, auto_size = TRUE, plot_width = NULL, plot_height = NULL,
axis_range = FALSE, x_min, x_max, y_min, y_max, name = NA,
title = NA, show_legend = TRUE, x_title = NA, y_title = NA,
x_showgrid = TRUE, y_showgrid = TRUE, ax_title_font_family = 'Arial, sans-serif',
ax_title_font_size = 18, ax_title_font_color = 'black',
ax_tick_font_family = 'Arial, sans-serif',
ax_tick_font_size = 18, ax_tick_font_color = 'black',
x_autotick = TRUE, x_ticks = 'outside', x_tick0 = NULL,
x_dtick = NULL, x_ticklen = 5, x_tickwidth = 1,
x_tickcolor = '#444', x_showticklab = TRUE,
x_tickangle = 'auto', x_zeroline = FALSE,
x_showline = TRUE, x_gridcolor = "rgb(204, 204, 204)",
x_gridwidth = 1, x_zerolinecol = "#444",
x_zerolinewidth = 1, x_linecol = '#444',
x_linewidth = 1,
y_autotick = TRUE, y_ticks = 'outside',
y_tick0 = NULL, y_dtick = NULL, y_ticklen = 5,
y_tickwidth = 1, y_tickcolor = '#444',
y_showticklab = TRUE, y_tickangle = 'auto',
y_zeroline = FALSE, y_showline = TRUE,
y_gridcolor = "rgb(204, 204, 204)",
y_gridwidth = 1, y_zerolinecol = "#444",
y_zerolinewidth = 1, y_linecol = '#444',
y_linewidth = 1, left_margin = 80, right_margin = 80,
top_margin = 100, bottom_margin = 80, padding = 0,
leg_x = 100, leg_y = 0.5, leg_orientation = 'v',
leg_font_family = 'sans-serif',
leg_font_size = 12, leg_font_color = '#000',
leg_bg_color = '#E2E2E2',
leg_border_col = "#FFFFFF", leg_border_width = 2,
add_annotate = FALSE,
x_annotate, y_annotate, text_annotate,
annotate_xanchor = 'auto', show_arrow, arrow_head = 1,
ax_anntate = 20, ay_annotate = -40,
annotate_family = 'sans-serif',
annotate_size = 14, annotate_col = 'red') {
# style axes title and tickfont
f1 <- list(
family = ax_title_font_family,
size = ax_title_font_size,
color = ax_title_font_color
)
f2 <- list(
family = ax_tick_font_family,
size = ax_tick_font_size,
color = ax_tick_font_color
)
xaxis <- list(
title = x_title,
showgrid = x_showgrid,
autotick = x_autotick,
ticks = x_ticks,
tick0 = x_tick0,
dtick = x_dtick,
ticklen = x_ticklen,
tickwidth = x_tickwidth,
tickcolor = x_tickcolor,
titlefont = f1,
showticklabels = x_showticklab,
tickangle = x_tickangle,
tickfont = f2,
zeroline = x_zeroline,
showline = x_showline,
gridcolor = x_gridcolor,
gridwidth = x_gridwidth,
zerolinecolor = x_zerolinecol,
zerolinewidth = x_zerolinewidth,
linecolor = x_linecol,
linewidth = x_linewidth
)
yaxis <- list(
title = y_title,
showgrid = y_showgrid,
autotick = y_autotick,
ticks = y_ticks,
tick0 = y_tick0,
dtick = y_dtick,
ticklen = y_ticklen,
tickwidth = y_tickwidth,
tickcolor = y_tickcolor,
titlefont = f1,
showticklabels = y_showticklab,
tickangle = y_tickangle,
tickfont = f2,
zeroline = y_zeroline,
showline = y_showline,
mirror = 'ticks',
gridcolor = y_gridcolor,
gridwidth = y_gridwidth,
zerolinecolor = y_zerolinecol,
zerolinewidth = y_zerolinewidth,
linecolor = y_linecol,
linewidth = y_linewidth
)
# margins
m <- list(
l = left_margin,
r = right_margin,
t = top_margin,
b = bottom_margin,
pad = padding
)
# legend
l <- list(
x = leg_x,
y = leg_y,
orientation = leg_orientation,
font = list(
family = leg_font_family,
size = leg_font_size,
color = leg_font_color),
bgcolor = leg_bg_color,
bordercolor = leg_border_col,
borderwidth = leg_border_width)
# annotations
if(add_annotate) {
a <- list(
x = x_annotate,
y = y_annotate,
text = text_annotate,
xref = 'x',
yref = 'y',
xanchor = annotate_xanchor,
showarrow = show_arrow,
arrowhead = arrow_head,
ax = ax_annotate,
ay = ay_annotate,
font = list(
family = annotate_family,
size = annotate_size,
color = annotate_col
)
)
}
y <- data %>%
select_(y) %>%
unlist()
x <- data %>%
select_(x) %>%
unlist() %>%
as.factor()
p <- plot_ly(data = data, y = y, color = x, boxpoints = b_points,
type = "box", width = plot_width, height = plot_height) %>%
layout(
title = title,
xaxis = xaxis,
yaxis = yaxis,
autosize = auto_size,
margin = m,
legend = l,
showlegend = show_legend
)
if(add_annotate) {
p <- p %>%
layout(annotations = a)
}
if(axis_range) {
p <- p %>%
layout(
xaxis = list(
range = list(x_min, x_max)
),
yaxis = list(
range = list(y_min, y_max)
)
)
}
p
}
mtcars$cyl <- as.factor(mtcars$cyl)
p <- boxly2(mtcars, y = 'mpg', x = 'cyl')
p
| /scratch/gouwar.j/cran-all/cranData/xplorerr/inst/app-visualize/helper/boxly2.R |
source('helper/utils.R')
source('helper/output.R')
freq_cont <- function(dframe, x, bins = 5) UseMethod("freq_cont")
freq_cont.default <- function(dframe, x, bins = 5) {
if(!is.data.frame(dframe)) {
stop('dframe must be a data frame')
}
if(!is.numeric(bins)) {
stop('bins must be integer value')
}
if (!is.character(x)) {
stop('x must be character')
}
if (!x %in% colnames(dframe)) {
stop('x must be a column in dframe')
}
if(is.numeric(bins)) {
bins <- as.integer(bins)
}
var_name <- x
data <- dframe %>%
select_(x) %>%
as.data.frame() %>%
unlist() %>%
na.omit()
n_bins <- bins
inta <- intervals(data, bins)
result <- freq(data, bins, inta)
data_len <- length(data)
cum <- cumsum(result)
per <- percent(result, data_len)
cum_per <- percent(cum, data_len)
out <- list(breaks = inta,
frequency = result,
cumulative = cum,
percent = per,
cum_percent = cum_per,
bins = n_bins,
data = data,
varname = var_name)
class(out) <- "freq_cont"
return(out)
}
print.freq_cont <- function(x, ...) {
print_fcont(x)
}
hist.freq_cont <- function(x, col = 'blue', ...) {
ymax <- max(x$frequency) + 2
h <- hist(x$data, breaks = x$breaks,
main = paste('Histogram of', x$varname),
xlab = x$varname, ylab = 'Frequency', ylim = c(0, ymax), col = col)
text(h$mids, h$counts + 1, labels = h$counts, adj = 0.5, pos = 1)
}
| /scratch/gouwar.j/cran-all/cranData/xplorerr/inst/app-visualize/helper/freq-cont.R |
ggbibar <- function(data, x, y, stacked = TRUE, horizontal = FALSE,
yaxlimit = FALSE, y1 = NA, y2 = NA, theme = "Default",
title = NULL, xlab = NULL, ylab = NULL, sub = NULL,
title_col = 'black', title_vjust = 0.5,
title_fam = 'serif', title_face = 'plain',
title_size = 10, title_hjust = 0.5,
sub_col = 'black', sub_fam = 'serif', sub_face = 'plain',
sub_size = 10, sub_hjust = 0.5, sub_vjust = 0.5,
xax_col = 'black', xax_fam = 'serif',
xax_face = 'plain', xax_size = 10,
xax_hjust = 0.5, xax_vjust = 0.5,
yax_col = 'black', yax_fam = 'serif',
yax_face = 'plain', yax_size = 10,
yax_hjust = 0.5, yax_vjust = 0.5,
remove_xax = FALSE, remove_yax = FALSE,
add_text = FALSE, xloc = NA, yloc = NA,
label = NA, tex_color = NA, tex_size = NA) {
if (stacked) {
posit <- 'stack'
} else {
posit <- 'dodge'
}
p <- ggplot(data, aes_string(x)) +
geom_bar(aes_string(fill = y), position = posit)
if (horizontal) {
p <- p + coord_flip()
}
if (yaxlimit) {
p <- p + ylim(y1, y2)
p
}
p <- p + ggtitle(title) + xlab(xlab) + ylab(ylab) +
theme(
plot.title = element_text(color = title_col, family = title_fam,
face = title_face, size = title_size, hjust = title_hjust,
vjust = title_vjust),
axis.title.x = element_text(color = xax_col, family = xax_fam,
face = xax_face, size = xax_size, hjust = xax_hjust,
vjust = xax_vjust),
axis.title.y = element_text(color = yax_col, family = yax_fam,
face = yax_face, size = yax_size, hjust = yax_hjust,
vjust = yax_vjust)
)
if(remove_xax) {
p <- p + theme(
axis.title.x = element_blank()
)
p
}
if(remove_yax) {
p <- p + theme(
axis.title.y = element_blank()
)
p
}
if(add_text) {
p <- p + annotate("text", x = xloc, y = yloc, label = label,
color = tex_color, size = tex_size)
p
}
if (theme == "Classic Dark") {
p <- p + theme_bw()
} else if (theme == "Light") {
p <- p + theme_light()
} else if (theme == "Minimal") {
p <- p + theme_minimal()
} else if (theme == "Dark") {
p <- p + theme_dark()
} else if (theme == "Classic") {
p <- p + theme_classic()
} else if (theme == "Empty") {
p <- p + theme_void()
}
p
}
ggbibar(mtcars, 'cyl', 'gear', horizontal = TRUE, stacked = FALSE)
| /scratch/gouwar.j/cran-all/cranData/xplorerr/inst/app-visualize/helper/ggbibar.R |
ggbox1 <- function(data, y, notch = FALSE, fill = 'blue', col = 'black',
o_col = 'red', o_fill = 'yellow', o_shape = 22, theme = "Default",
o_alpha = 0.8, o_size = 2, add_jitter = FALSE,
j_width = 0.1, j_height = 0.1, j_fill = 'blue',
j_col = 'black', j_shape = 22, j_size = 2, j_alpha = 0.8,
horizontal = FALSE, yaxlimit = FALSE, y1 = NA, y2 = NA,
title = NULL, xlab = NULL, ylab = NULL, sub = NULL,
title_col = 'black', title_vjust = 0.5,
title_fam = 'serif', title_face = 'plain',
title_size = 10, title_hjust = 0.5,
sub_col = 'black', sub_fam = 'serif', sub_face = 'plain',
sub_size = 10, sub_hjust = 0.5, sub_vjust = 0.5,
xax_col = 'black', xax_fam = 'serif',
xax_face = 'plain', xax_size = 10,
xax_hjust = 0.5, xax_vjust = 0.5,
yax_col = 'black', yax_fam = 'serif',
yax_face = 'plain', yax_size = 10,
yax_hjust = 0.5, yax_vjust = 0.5,
remove_xax = TRUE, remove_yax = FALSE,
add_text = FALSE, xloc = NA, yloc = NA,
label = NA, tex_color = NA, tex_size = NA) {
p <- ggplot(data, aes_string(x = factor(1), y = y)) +
geom_boxplot(notch = notch, fill = fill, color = col,
outlier.color = o_col, outlier.fill = o_fill,
outlier.shape = o_shape, outlier.alpha = o_alpha,
outlier.size = o_size)
if (add_jitter) {
p <- p + geom_jitter(width = j_width, height = j_height, alpha = j_alpha,
fill = j_fill, col = j_col, shape = j_shape, size = j_size)
}
p <- p + ggtitle(title) + xlab(xlab) + ylab(ylab) +
theme(
plot.title = element_text(color = title_col, family = title_fam,
face = title_face, size = title_size, hjust = title_hjust,
vjust = title_vjust),
plot.subtitle = element_text(color = sub_col, family = sub_fam,
face = sub_face, size = sub_size, hjust = sub_hjust,
vjust = sub_vjust),
axis.title.x = element_text(color = xax_col, family = xax_fam,
face = xax_face, size = xax_size, hjust = xax_hjust,
vjust = xax_vjust),
axis.title.y = element_text(color = yax_col, family = yax_fam,
face = yax_face, size = yax_size, hjust = yax_hjust,
vjust = yax_vjust)
)
if (yaxlimit) {
p <- p + ylim(y1, y2)
p
}
if(remove_xax) {
p <- p + theme(
axis.title.x = element_blank()
)
p
}
if(remove_yax) {
p <- p + theme(
axis.title.y = element_blank()
)
p
}
if (horizontal) {
p <- p + coord_flip()
}
if(add_text) {
p <- p + annotate("text", x = xloc, y = yloc, label = label,
color = tex_color, size = tex_size)
p
}
if (theme == "Classic Dark") {
p <- p + theme_bw()
} else if (theme == "Light") {
p <- p + theme_light()
} else if (theme == "Minimal") {
p <- p + theme_minimal()
} else if (theme == "Dark") {
p <- p + theme_dark()
} else if (theme == "Classic") {
p <- p + theme_classic()
} else if (theme == "Empty") {
p <- p + theme_void()
}
p
}
| /scratch/gouwar.j/cran-all/cranData/xplorerr/inst/app-visualize/helper/ggbox1.R |
ggbox2 <- function(data, x, y, notch = FALSE, fill = 'blue', col = 'black',
o_col = 'red', o_fill = 'yellow', o_shape = 22, theme = "Default",
o_alpha = 0.8, o_size = 2, add_jitter = FALSE,
j_width = 0.1, j_height = 0.1, j_fill = 'blue',
j_col = 'black', j_shape = 22, j_size = 2, j_alpha = 0.8,
horizontal = FALSE, yaxlimit = FALSE, y1 = NA, y2 = NA,
title = NULL, xlab = NULL, ylab = NULL, sub = NULL,
title_col = 'black', title_vjust = 0.5,
title_fam = 'serif', title_face = 'plain',
title_size = 10, title_hjust = 0.5,
sub_col = 'black', sub_fam = 'serif', sub_face = 'plain',
sub_size = 10, sub_hjust = 0.5, sub_vjust = 0.5,
xax_col = 'black', xax_fam = 'serif',
xax_face = 'plain', xax_size = 10,
xax_hjust = 0.5, xax_vjust = 0.5,
yax_col = 'black', yax_fam = 'serif',
yax_face = 'plain', yax_size = 10,
yax_hjust = 0.5, yax_vjust = 0.5,
remove_xax = FALSE, remove_yax = FALSE,
add_text = FALSE, xloc = NA, yloc = NA,
label = NA, tex_color = NA, tex_size = NA) {
p <- ggplot(data, aes_string(x = x, y = y)) +
geom_boxplot(notch = notch, fill = fill, color = col,
outlier.color = o_col, outlier.fill = o_fill,
outlier.shape = o_shape, outlier.alpha = o_alpha,
outlier.size = o_size)
if (add_jitter) {
p <- p + geom_jitter(width = j_width, height = j_height, alpha = j_alpha,
fill = j_fill, col = j_col, shape = j_shape, size = j_size)
}
p <- p + ggtitle(title) + xlab(xlab) + ylab(ylab) +
theme(
plot.title = element_text(color = title_col, family = title_fam,
face = title_face, size = title_size, hjust = title_hjust,
vjust = title_vjust),
plot.subtitle = element_text(color = sub_col, family = sub_fam,
face = sub_face, size = sub_size, hjust = sub_hjust,
vjust = sub_vjust),
axis.title.x = element_text(color = xax_col, family = xax_fam,
face = xax_face, size = xax_size, hjust = xax_hjust,
vjust = xax_vjust),
axis.title.y = element_text(color = yax_col, family = yax_fam,
face = yax_face, size = yax_size, hjust = yax_hjust,
vjust = yax_vjust)
)
if (yaxlimit) {
p <- p + ylim(y1, y2)
p
}
if(remove_xax) {
p <- p + theme(
axis.title.x = element_blank()
)
p
}
if(remove_yax) {
p <- p + theme(
axis.title.y = element_blank()
)
p
}
if (horizontal) {
p <- p + coord_flip()
}
if(add_text) {
p <- p + annotate("text", x = xloc, y = yloc, label = label,
color = tex_color, size = tex_size)
p
}
if (theme == "Classic Dark") {
p <- p + theme_bw()
} else if (theme == "Light") {
p <- p + theme_light()
} else if (theme == "Minimal") {
p <- p + theme_minimal()
} else if (theme == "Dark") {
p <- p + theme_dark()
} else if (theme == "Classic") {
p <- p + theme_classic()
} else if (theme == "Empty") {
p <- p + theme_void()
}
p
}
| /scratch/gouwar.j/cran-all/cranData/xplorerr/inst/app-visualize/helper/ggbox2.R |
gghist <- function(data, x, bins = 5, fill = 'blue', col = 'black',
yaxlimit = FALSE, y1 = NA, y2 = NA, theme = "Default",
title = NULL, xlab = NULL, ylab = NULL, sub = NULL,
title_col = 'black', title_vjust = 0.5,
title_fam = 'serif', title_face = 'plain',
title_size = 10, title_hjust = 0.5,
sub_col = 'black', sub_fam = 'serif', sub_face = 'plain',
sub_size = 10, sub_hjust = 0.5, sub_vjust = 0.5,
xax_col = 'black', xax_fam = 'serif',
xax_face = 'plain', xax_size = 10,
xax_hjust = 0.5, xax_vjust = 0.5,
yax_col = 'black', yax_fam = 'serif',
yax_face = 'plain', yax_size = 10,
yax_hjust = 0.5, yax_vjust = 0.5,
remove_xax = FALSE, remove_yax = FALSE,
add_text = FALSE, xloc = NA, yloc = NA,
label = NA, tex_color = NA, tex_size = NA) {
p <- ggplot(data, aes_string(x)) +
geom_histogram(bins = bins, fill = fill, color = col)
if (yaxlimit) {
p <- p + ylim(y1, y2)
p
}
p <- p + ggtitle(title) + xlab(xlab) + ylab(ylab) +
theme(
plot.title = element_text(color = title_col, family = title_fam,
face = title_face, size = title_size, hjust = title_hjust,
vjust = title_vjust),
plot.subtitle = element_text(color = sub_col, family = sub_fam,
face = sub_face, size = sub_size, hjust = sub_hjust,
vjust = sub_vjust),
axis.title.x = element_text(color = xax_col, family = xax_fam,
face = xax_face, size = xax_size, hjust = xax_hjust,
vjust = xax_vjust),
axis.title.y = element_text(color = yax_col, family = yax_fam,
face = yax_face, size = yax_size, hjust = yax_hjust,
vjust = yax_vjust)
)
if(remove_xax) {
p <- p + theme(
axis.title.x = element_blank()
)
p
}
if(remove_yax) {
p <- p + theme(
axis.title.y = element_blank()
)
p
}
if(add_text) {
p <- p + annotate("text", x = xloc, y = yloc, label = label,
color = tex_color, size = tex_size)
p
}
if (theme == "Classic Dark") {
p <- p + theme_bw()
} else if (theme == "Light") {
p <- p + theme_light()
} else if (theme == "Minimal") {
p <- p + theme_minimal()
} else if (theme == "Dark") {
p <- p + theme_dark()
} else if (theme == "Classic") {
p <- p + theme_classic()
} else if (theme == "Empty") {
p <- p + theme_void()
}
p
}
gghist(mtcars, 'mpg')
| /scratch/gouwar.j/cran-all/cranData/xplorerr/inst/app-visualize/helper/gghist.R |
# gdp <- readr::read_csv('J:/R/ggplot_xplorerr/gdp.csv')
# p <- ggplot(gdp) +
# geom_line(aes(x = year, y = india), col = 'blue') +
# geom_line(aes(x = year, y = china), col = 'red')
# p
ggline <- function(data, x, columns, cols = 'black', theme = "Default",
alphas = 1, ltypes = 1, sizes = 1,
yaxlimit = FALSE, y1 = NA, y2 = NA,
title = NULL, xlab = NULL, ylab = NULL, sub = NULL,
title_col = 'black', title_vjust = 0.5,
title_fam = 'serif', title_face = 'plain',
title_size = 10, title_hjust = 0.5,
sub_col = 'black', sub_fam = 'serif', sub_face = 'plain',
sub_size = 10, sub_hjust = 0.5, sub_vjust = 0.5,
xax_col = 'black', xax_fam = 'serif',
xax_face = 'plain', xax_size = 10,
xax_hjust = 0.5, xax_vjust = 0.5,
yax_col = 'black', yax_fam = 'serif',
yax_face = 'plain', yax_size = 10,
yax_hjust = 0.5, yax_vjust = 0.5,
remove_xax = FALSE, remove_yax = FALSE,
add_text = FALSE, xloc = NA, yloc = NA,
label = NA, tex_color = NA, tex_size = NA) {
x <- data %>%
select(x) %>%
pull(1)
column <- data %>%
select(columns)
j <- column %>% ncol()
n <- j %>% seq_len()
nam <- column %>% names()
if (length(cols) == 1) {
cols <- rep(cols, j)
}
if (length(alphas) == 1) {
alphas <- rep(alphas, j)
}
if (length(ltypes) == 1) {
ltypes <- rep(ltypes, j)
}
if (length(sizes) == 1) {
sizes <- rep(sizes, j)
}
p <- ggplot(data)
for (i in n) {
p <- p +
geom_line(aes_string(x = x, y = column[[i]]),
color = cols[[i]], alpha = alphas[[i]],
linetype = ltypes[[i]], size = sizes[[i]])
}
if (yaxlimit) {
p <- p + ylim(y1, y2)
p
}
p <- p + ggtitle(title) + xlab(xlab) + ylab(ylab) +
theme(
plot.title = element_text(color = title_col, family = title_fam,
face = title_face, size = title_size, hjust = title_hjust,
vjust = title_vjust),
plot.subtitle = element_text(color = sub_col, family = sub_fam,
face = sub_face, size = sub_size, hjust = sub_hjust,
vjust = sub_vjust),
axis.title.x = element_text(color = xax_col, family = xax_fam,
face = xax_face, size = xax_size, hjust = xax_hjust,
vjust = xax_vjust),
axis.title.y = element_text(color = yax_col, family = yax_fam,
face = yax_face, size = yax_size, hjust = yax_hjust,
vjust = yax_vjust)
)
if(remove_xax) {
p <- p + theme(
axis.title.x = element_blank()
)
p
}
if(remove_yax) {
p <- p + theme(
axis.title.y = element_blank()
)
p
}
if(add_text) {
p <- p + annotate("text", x = xloc, y = yloc, label = label,
color = tex_color, size = tex_size)
p
}
if (theme == "Classic Dark") {
p <- p + theme_bw()
} else if (theme == "Light") {
p <- p + theme_light()
} else if (theme == "Minimal") {
p <- p + theme_minimal()
} else if (theme == "Dark") {
p <- p + theme_dark()
} else if (theme == "Classic") {
p <- p + theme_classic()
} else if (theme == "Empty") {
p <- p + theme_void()
}
p
}
# ggline(gdp, 'year', c('india', 'china'))
| /scratch/gouwar.j/cran-all/cranData/xplorerr/inst/app-visualize/helper/ggline.R |
ggline2 <- function(data, x, columns, groups, cols = NULL,
ltypes = NULL, sizes = NULL, theme = "Default",
yaxlimit = FALSE, y1 = NA, y2 = NA,
title = NULL, xlab = NULL, ylab = NULL, sub = NULL,
title_col = 'black', title_vjust = 0.5,
title_fam = 'serif', title_face = 'plain',
title_size = 10, title_hjust = 0.5,
sub_col = 'black', sub_fam = 'serif', sub_face = 'plain',
sub_size = 10, sub_hjust = 0.5, sub_vjust = 0.5,
xax_col = 'black', xax_fam = 'serif',
xax_face = 'plain', xax_size = 10,
xax_hjust = 0.5, xax_vjust = 0.5,
yax_col = 'black', yax_fam = 'serif',
yax_face = 'plain', yax_size = 10,
yax_hjust = 0.5, yax_vjust = 0.5,
remove_xax = FALSE, remove_yax = FALSE,
add_text = FALSE, xloc = NA, yloc = NA,
label = NA, tex_color = NA, tex_size = NA) {
# x <- data %>%
# select(x) %>%
# pull(1)
#
# column <- data %>%
# select(columns)
#
# groupvar <- data %>%
# select(groups)
p <- ggplot(data)
p <- p +
geom_line(aes_string(x = x, y = columns, group = groups,
color = cols, linetype = ltypes,
size = sizes))
if (yaxlimit) {
p <- p + ylim(y1, y2)
p
}
p <- p + ggtitle(title) + xlab(xlab) + ylab(ylab) +
theme(
plot.title = element_text(color = title_col, family = title_fam,
face = title_face, size = title_size, hjust = title_hjust,
vjust = title_vjust),
plot.subtitle = element_text(color = sub_col, family = sub_fam,
face = sub_face, size = sub_size, hjust = sub_hjust,
vjust = sub_vjust),
axis.title.x = element_text(color = xax_col, family = xax_fam,
face = xax_face, size = xax_size, hjust = xax_hjust,
vjust = xax_vjust),
axis.title.y = element_text(color = yax_col, family = yax_fam,
face = yax_face, size = yax_size, hjust = yax_hjust,
vjust = yax_vjust)
)
if(remove_xax) {
p <- p + theme(
axis.title.x = element_blank()
)
p
}
if(remove_yax) {
p <- p + theme(
axis.title.y = element_blank()
)
p
}
if(add_text) {
p <- p + annotate("text", x = xloc, y = yloc, label = label,
color = tex_color, size = tex_size)
p
}
if (theme == "Classic Dark") {
p <- p + theme_bw()
} else if (theme == "Light") {
p <- p + theme_light()
} else if (theme == "Minimal") {
p <- p + theme_minimal()
} else if (theme == "Dark") {
p <- p + theme_dark()
} else if (theme == "Classic") {
p <- p + theme_classic()
} else if (theme == "Empty") {
p <- p + theme_void()
}
p
}
| /scratch/gouwar.j/cran-all/cranData/xplorerr/inst/app-visualize/helper/ggline2.R |
library(ggplot2)
library(dplyr)
library(scales)
ggpie <- function(data, x, title = NULL, xlab = NULL, ylab = NULL,
title_col = 'black', title_vjust = 0.5,
title_fam = 'serif', title_face = 'plain',
title_size = 10, title_hjust = 0.5,
xax_col = 'black', xax_fam = 'serif',
xax_face = 'plain', xax_size = 10,
xax_hjust = 0.5, xax_vjust = 0.5,
yax_col = 'black', yax_fam = 'serif',
yax_face = 'plain', yax_size = 10,
yax_hjust = 0.5, yax_vjust = 0.5,
add_text = FALSE, xloc = NA, yloc = NA,
label = NA, tex_color = NA, tex_size = NA) {
da <- data %>%
select(x)
df <- tibble::as_data_frame(table(da))
colnames(df) <- c('group', 'value')
p <- ggplot(df, aes(x = '', y = value, fill = group)) +
geom_bar(width = 1, stat = 'identity') + xlab('') + ylab('') +
coord_polar(theta = 'y', start = 0) +
theme(axis.text.x = element_blank(),
axis.text.y = element_blank()) +
theme_void() +
scale_fill_discrete(guide = guide_legend(title = x)) +
geom_text(aes(label = scales::percent(value/sum(value))),
position = position_stack(vjust = 0.5))
p <- p + ggtitle(title) + xlab(xlab) + ylab(ylab) +
theme(
plot.title = element_text(color = title_col, family = title_fam,
face = title_face, size = title_size, hjust = title_hjust,
vjust = title_vjust),
axis.title.x = element_text(color = xax_col, family = xax_fam,
face = xax_face, size = xax_size, hjust = xax_hjust,
vjust = xax_vjust),
axis.title.y = element_text(color = yax_col, family = yax_fam,
face = yax_face, size = yax_size, hjust = yax_hjust,
vjust = yax_vjust)
)
if(add_text) {
p <- p + annotate("text", x = xloc, y = yloc, label = label,
color = tex_color, size = tex_size)
p
}
p
}
| /scratch/gouwar.j/cran-all/cranData/xplorerr/inst/app-visualize/helper/ggpie.R |
library(ggplot2)
# add text annotations
gscatter <- function(data, x, y, aes_var = FALSE, reg_line = FALSE,
reg_method = 'lm', reg_se = TRUE, theme = "Default",
title = NULL, xlab = NULL, ylab = NULL, sub = NULL,
color = 'black', shape = 1, size = 1, fill = 'black',
xaxlimit = FALSE, yaxlimit = FALSE,
x1 = NA, x2 = NA, y1 = NA, y2 = NA, title_col = 'black',
title_fam = 'serif', title_face = 'plain',
title_size = 10, title_hjust = 0.5, title_vjust = 0.5,
sub_col = 'black', sub_fam = 'serif', sub_face = 'plain',
sub_size = 10, sub_hjust = 0.5, sub_vjust = 0.5,
xax_col = 'black', xax_fam = 'serif',
xax_face = 'plain', xax_size = 10,
xax_hjust = 0.5, xax_vjust = 0.5,
yax_col = 'black', yax_fam = 'serif',
yax_face = 'plain', yax_size = 10,
yax_hjust = 0.5, yax_vjust = 0.5,
remove_xax = FALSE, remove_yax = FALSE,
add_text = FALSE, xloc = NA, yloc = NA, label = NA,
tex_color = NA, tex_size = NA) {
if(aes_var) {
if(is.numeric(shape)) {
p <- ggplot(data = data, mapping = aes_string(x = x, y = y,
colour = color, shape = color, size = size)) +
geom_point()
} else {
p <- ggplot(data = data, mapping = aes_string(x = x, y = y,
colour = color, shape = shape, size = size)) +
geom_point()
}
if(is.numeric(size)) {
p <- p + labs(size = 'Size')
}
} else {
p <- ggplot(data = data, mapping = aes_string(x = x, y = y)) +
geom_point(colour = color, shape = shape, size = size, fill = fill)
}
if(reg_line) {
p <- p + geom_smooth(method = reg_method, se = reg_se)
p
}
p <- p + ggtitle(title) + xlab(xlab) + ylab(ylab) +
theme(
plot.title = element_text(color = title_col, family = title_fam,
face = title_face, size = title_size, hjust = title_hjust,
vjust = title_vjust),
plot.subtitle = element_text(color = sub_col, family = sub_fam,
face = sub_face, size = sub_size, hjust = sub_hjust,
vjust = sub_vjust),
axis.title.x = element_text(color = xax_col, family = xax_fam,
face = xax_face, size = xax_size, hjust = xax_hjust,
vjust = xax_vjust),
axis.title.y = element_text(color = yax_col, family = yax_fam,
face = yax_face, size = yax_size, hjust = yax_hjust,
vjust = yax_vjust)
)
if(xaxlimit) {
p <- p + xlim(x1, x2)
p
}
if (yaxlimit) {
p <- p + ylim(y1, y2)
p
}
if(remove_xax) {
p <- p + theme(
axis.title.x = element_blank()
)
p
}
if(remove_yax) {
p <- p + theme(
axis.title.y = element_blank()
)
p
}
if(add_text) {
p <- p + annotate("text", x = xloc, y = yloc, label = label,
color = tex_color, size = tex_size)
p
}
if (theme == "Classic Dark") {
p <- p + theme_bw()
} else if (theme == "Light") {
p <- p + theme_light()
} else if (theme == "Minimal") {
p <- p + theme_minimal()
} else if (theme == "Dark") {
p <- p + theme_dark()
} else if (theme == "Classic") {
p <- p + theme_classic()
} else if (theme == "Empty") {
p <- p + theme_void()
}
p
}
# test
# mtcars$cyl <- as.factor(mtcars$cyl)
# mtcars$gear <- as.factor(mtcars$gear)
# mtcars$am <- as.factor(mtcars$am)
# gscatter(mtcars, 'disp', 'mpg', aes_var = TRUE,
# color = 'cyl')
# k <- gscatter(mtcars, 'disp', 'mpg', aes_var = FALSE,
# color = 'red', shape = 22, size = 3, fill = 'blue',
# reg_line = TRUE, reg_method = 'loess', reg_se = FALSE)
| /scratch/gouwar.j/cran-all/cranData/xplorerr/inst/app-visualize/helper/ggscatter.R |
library(ggplot2)
# mtcars$cyl <- as.factor(mtcars$cyl)
# mtcars$gear <- as.factor(mtcars$gear)
ggbar1 <- function(data, column, bar_col = 'blue', bor_col = 'black', theme = "Default",
yaxlimit = FALSE, y1 = NA, y2 = NA, horizontal = FALSE,
title = NULL, xlab = NULL, ylab = NULL, sub = NULL,
title_col = 'black', title_vjust = 0.5,
title_fam = 'serif', title_face = 'plain',
title_size = 10, title_hjust = 0.5,
sub_col = 'black', sub_fam = 'serif', sub_face = 'plain',
sub_size = 10, sub_hjust = 0.5, sub_vjust = 0.5,
xax_col = 'black', xax_fam = 'serif',
xax_face = 'plain', xax_size = 10,
xax_hjust = 0.5, xax_vjust = 0.5,
yax_col = 'black', yax_fam = 'serif',
yax_face = 'plain', yax_size = 10,
yax_hjust = 0.5, yax_vjust = 0.5,
remove_xax = FALSE, remove_yax = FALSE,
add_text = FALSE, xloc = NA, yloc = NA,
label = NA, tex_color = NA, tex_size = NA) {
p <- ggplot(data, aes_string(column)) +
geom_bar(fill = bar_col, col = bor_col)
if (yaxlimit) {
p <- p + ylim(y1, y2)
p
}
p <- p + ggtitle(title) + xlab(xlab) + ylab(ylab) +
theme(
plot.title = element_text(color = title_col, family = title_fam,
face = title_face, size = title_size, hjust = title_hjust,
vjust = title_vjust),
plot.subtitle = element_text(color = sub_col, family = sub_fam,
face = sub_face, size = sub_size, hjust = sub_hjust,
vjust = sub_vjust),
axis.title.x = element_text(color = xax_col, family = xax_fam,
face = xax_face, size = xax_size, hjust = xax_hjust,
vjust = xax_vjust),
axis.title.y = element_text(color = yax_col, family = yax_fam,
face = yax_face, size = yax_size, hjust = yax_hjust,
vjust = yax_vjust)
)
if (horizontal) {
p <- p + coord_flip()
}
if(remove_xax) {
p <- p + theme(
axis.title.x = element_blank()
)
p
}
if(remove_yax) {
p <- p + theme(
axis.title.y = element_blank()
)
p
}
if(add_text) {
p <- p + annotate("text", x = xloc, y = yloc, label = label,
color = tex_color, size = tex_size)
p
}
if (theme == "Classic Dark") {
p <- p + theme_bw()
} else if (theme == "Light") {
p <- p + theme_light()
} else if (theme == "Minimal") {
p <- p + theme_minimal()
} else if (theme == "Dark") {
p <- p + theme_dark()
} else if (theme == "Classic") {
p <- p + theme_classic()
} else if (theme == "Empty") {
p <- p + theme_void()
}
p
}
ggbar1(mtcars, 'cyl', yaxlimit = TRUE, y1 = 0, y2 = 20, horizontal = TRUE)
| /scratch/gouwar.j/cran-all/cranData/xplorerr/inst/app-visualize/helper/ggunibar.R |
library(highcharter)
highbox <- function(data, y, x, col = 'blue',
xax_title = '', xax_title_align = 'center',
xax_title_col = 'black', title = '',
xax_title_ftype = 'italic', xax_title_fsize = '18px',
yax_title = '', yax_title_col = 'black',
yax_title_ftype = 'italic', yax_title_fsize = '18px',
title_align = 'center', title_col = 'black',
title_ftype = 'italic', title_size = '12px',
sub = '', sub_align = 'center', sub_col = 'black',
sub_ftype = 'italic', sub_size = '12px') {
da <- data %>%
select_(y, x)
colnames(da) <- c('y', 'x')
h <- hcboxplot(x = da$y, var = da$x, color = col)
h <- h %>%
hc_xAxis(categories = levels(as.factor(da$x)),
title = list(text = xax_title,
align = xax_title_align,
style = list(color = xax_title_col,
fontWeight = xax_title_ftype,
fontSize = xax_title_fsize))) %>%
hc_yAxis(
title = list(text = yax_title,
style = list(color = yax_title_col,
fontWeight = yax_title_ftype,
fontSize = yax_title_fsize)),
opposite = FALSE) %>%
hc_title(text = title,
align = title_align,
style = list(color = title_col,
fontWeight = title_ftype,
fontSize = title_size)) %>%
hc_subtitle(text = sub,
align = sub_align,
style = list(color = sub_col,
fontWeight = sub_ftype,
fontSize = sub_size))
h
}
mtcars$gear <- as.factor(mtcars$gear)
highbox(mtcars, 'disp', 'gear')
| /scratch/gouwar.j/cran-all/cranData/xplorerr/inst/app-visualize/helper/hibox2.R |
highist <- function(data, column, xlab = ' ', color = 'blue') {
da <- data %>%
select_(column) %>%
pull(1)
h <- hchist(da, name = xlab)
h %>%
hc_colors(colors = color) %>%
hc_yAxis(title = list(text = 'Frequency'))
}
highist(mtcars, 'mpg', xlab = 'Miles Per Gallon', color = 'red')
| /scratch/gouwar.j/cran-all/cranData/xplorerr/inst/app-visualize/helper/highhist.R |
library(highcharter)
# title
# subtitile
# axis
# legend
# plotoptions
# gdp <- readr::read_csv('gdp.csv')
highline <- function(data, x, columns, add_labels = FALSE) {
x <- data %>%
select_(x) %>%
pull(1)
column <- data %>%
select(columns)
n <- column %>% ncol() %>% seq_len()
nam <- column %>% names()
h <- highchart() %>%
hc_xAxis(categories = x)
for (i in n) {
h <- h %>%
hc_add_series(name = nam[i], data = column[[i]])
}
if (add_labels) {
h %>%
hc_plotOptions(line = list(dataLabels = list(enabled = TRUE)))
}
h
}
# highline(gdp, 'year', c('india', 'china'), add_labels = TRUE)
| /scratch/gouwar.j/cran-all/cranData/xplorerr/inst/app-visualize/helper/highline.R |
highpie <- function(data, column) {
da <- data %>%
select_(column) %>%
pull(1) %>%
as.factor()
freq <- da %>%
table() %>%
as.vector()
labels <- da %>%
levels()
highchart() %>%
hc_chart(type = 'pie') %>%
hc_add_series_labels_values(labels, freq,
name = "Pie", colorByPoint = TRUE,
type = "pie")
}
# highpie(mtcars, 'cyl')
| /scratch/gouwar.j/cran-all/cranData/xplorerr/inst/app-visualize/helper/highpie.R |
library(plotly)
histly <- function(data = NULL, y = NULL, hist_orient = 'v',
hist_opacity = 1, hist_type = 'count', auto_binx = TRUE,
xbins_start = NULL, xbins_end = NULL, xbins_size = NULL,
hist_col = 'blue', hist_l_col = 'black', hist_l_w = 1,
hist_bargap = 0, auto_size = TRUE, plot_width = NULL,
plot_height = NULL, axis_range = FALSE, x_min, x_max,
y_min, y_max, title = NA, x_title = NA,
y_title = NA, x_showgrid = TRUE, y_showgrid = TRUE,
ax_title_font_family = 'Arial, sans-serif',
ax_title_font_size = 18, ax_title_font_color = 'black',
ax_tick_font_family = 'Arial, sans-serif',
ax_tick_font_size = 18, ax_tick_font_color = 'black',
x_autotick = TRUE, x_ticks = 'outside', x_tick0 = NULL,
x_dtick = NULL, x_ticklen = 5, x_tickwidth = 1,
x_tickcolor = '#444', x_showticklab = TRUE,
x_tickangle = 'auto', x_zeroline = FALSE,
x_showline = TRUE, x_gridcolor = "rgb(204, 204, 204)",
x_gridwidth = 1, x_zerolinecol = "#444",
x_zerolinewidth = 1, x_linecol = '#444',
x_linewidth = 1,
y_autotick = TRUE, y_ticks = 'outside',
y_tick0 = NULL, y_dtick = NULL, y_ticklen = 5,
y_tickwidth = 1, y_tickcolor = '#444',
y_showticklab = TRUE, y_tickangle = 'auto',
y_zeroline = FALSE, y_showline = TRUE,
y_gridcolor = "rgb(204, 204, 204)",
y_gridwidth = 1, y_zerolinecol = "#444",
y_zerolinewidth = 1, y_linecol = '#444',
y_linewidth = 1, left_margin = 80, right_margin = 80,
top_margin = 100, bottom_margin = 80, padding = 0,
add_annotate = FALSE,
x_annotate, y_annotate, text_annotate,
annotate_xanchor = 'auto', show_arrow, arrow_head = 1,
ax_anntate = 20, ay_annotate = -40,
annotate_family = 'sans-serif',
annotate_size = 14, annotate_col = 'red') {
y1 <- data %>%
select_(y) %>%
unlist()
f1 <- list(
family = ax_title_font_family,
size = ax_title_font_size,
color = ax_title_font_color
)
f2 <- list(
family = ax_tick_font_family,
size = ax_tick_font_size,
color = ax_tick_font_color
)
xaxis <- list(
title = x_title,
showgrid = x_showgrid,
autotick = x_autotick,
ticks = x_ticks,
tick0 = x_tick0,
dtick = x_dtick,
ticklen = x_ticklen,
tickwidth = x_tickwidth,
tickcolor = x_tickcolor,
titlefont = f1,
showticklabels = x_showticklab,
tickangle = x_tickangle,
tickfont = f2,
zeroline = x_zeroline,
showline = x_showline,
gridcolor = x_gridcolor,
gridwidth = x_gridwidth,
zerolinecolor = x_zerolinecol,
zerolinewidth = x_zerolinewidth,
linecolor = x_linecol,
linewidth = x_linewidth
)
yaxis <- list(
title = y_title,
showgrid = y_showgrid,
autotick = y_autotick,
ticks = y_ticks,
tick0 = y_tick0,
dtick = y_dtick,
ticklen = y_ticklen,
tickwidth = y_tickwidth,
tickcolor = y_tickcolor,
titlefont = f1,
showticklabels = y_showticklab,
tickangle = y_tickangle,
tickfont = f2,
zeroline = y_zeroline,
showline = y_showline,
mirror = 'ticks',
gridcolor = y_gridcolor,
gridwidth = y_gridwidth,
zerolinecolor = y_zerolinecol,
zerolinewidth = y_zerolinewidth,
linecolor = y_linecol,
linewidth = y_linewidth
)
# margins
m <- list(
l = left_margin,
r = right_margin,
t = top_margin,
b = bottom_margin,
pad = padding
)
if(add_annotate) {
a <- list(
x = x_annotate,
y = y_annotate,
text = text_annotate,
xref = 'x',
yref = 'y',
xanchor = annotate_xanchor,
showarrow = show_arrow,
arrowhead = arrow_head,
ax = ax_annotate,
ay = ay_annotate,
font = list(
family = annotate_family,
size = annotate_size,
color = annotate_col
)
)
}
if(hist_orient == 'v') {
p <- plot_ly(data, x = y1,
type = "histogram",
opacity = hist_opacity,
histnorm = hist_type,
autobinx = auto_binx,
xbins = list(
start = xbins_start,
end = xbins_end,
size = xbins_size
),
marker = list(
color = hist_col,
line = list(
color = hist_l_col,
width = hist_l_w
)
)
)
} else {
p <- plot_ly(data, y = y1,
type = "histogram",
opacity = hist_opacity,
histnorm = hist_type,
autobinx = auto_binx,
xbins = list(
start = xbins_start,
end = xbins_end,
size = xbins_size
),
marker = list(
color = hist_col,
line = list(
color = hist_l_col,
width = hist_l_w
)
)
)
}
p <- p %>%
layout(
title = title,
xaxis = xaxis,
yaxis = yaxis,
autosize = auto_size,
margin = m,
bargap = hist_bargap
)
if(add_annotate) {
p <- p %>%
layout(annotations = a)
}
if(axis_range) {
p <- p %>%
layout(
xaxis = list(
range = list(x_min, x_max)
),
yaxis = list(
range = list(y_min, y_max)
)
)
}
p
}
h <- histly(mtcars, 'mpg', hist_orient = "h")
h
| /scratch/gouwar.j/cran-all/cranData/xplorerr/inst/app-visualize/helper/histly.R |
# histogram
hist_plot <- function(x, bins, title = NA, xlab = NA,
ylab = NA, ylimit = NULL, probability = FALSE, right = TRUE,
axes = TRUE, labels = FALSE,
col = NULL, border = 'black',
colmain = "black", colsub = "black", colaxis = "black",
collab = "black", fontmain = 1, fontsub = 1, fontaxis = 1, fontlab = 1,
cexmain = 1, cexsub = 1, cexaxis = 1, cexlab = 1, leg = FALSE, leg_x, leg_y, legend,
leg_point = 15, leg_colour, leg_boxtype, leg_boxcol, leg_boxlty, leg_boxlwd,
leg_boxborcol, leg_boxxjust, leg_boxyjust, leg_textcol, leg_textfont,
leg_textcolumns, leg_texthoriz, leg_title, leg_titlecol, leg_textadj, text_p = NA,
text_x_loc = NA, text_y_loc = NA, text_col = "black", text_font = NA,
text_size = NA, m_text = NA, m_side = 3, m_line = 0.5, m_adj = 0.5,
m_col = "black", m_font = 1, m_cex = 1) {
# hist function
hist(x, breaks = bins, main = title, xlab = xlab, ylab = ylab, ylim = ylimit,
probability = probability, right = right, axes = axes, labels = labels,
density = NULL, angle = 45, col = col, border = border,
col.main = colmain, col.sub = colsub,col.axis = colaxis,
col.lab = collab, font.main = fontmain, font.sub = fontsub,
font.axis = fontaxis, font.lab = fontlab, cex.main = cexmain,
cex.sub = cexsub, cex.axis = cexaxis, cex.lab = cexlab)
# legend
if (leg == TRUE) {
legend(leg_x, leg_y,
legend = legend, pch = leg_point, col = leg_colour,
bty = leg_boxtype, bg = leg_boxcol,
box.lty = leg_boxlty, box.lwd = leg_boxlwd,
box.col = leg_boxborcol, xjust = leg_boxxjust,
yjust = leg_boxyjust, text.col = leg_textcol,
text.font = leg_textfont, ncol = leg_textcolumns,
horiz = leg_texthoriz, title = leg_title,
title.col = leg_titlecol, title.adj = leg_textadj)
}
# add text inside the plot
text(text_x_loc, text_y_loc, text_p, font = text_font, col = text_col,
cex = text_size)
# add text on the margins of the plot
mtext(m_text, side = m_side, line = m_line, adj = m_adj,
col = m_col, font = m_font, cex = m_cex)
}
# histogram test
# hist_plot(mtcars$disp, bins = 5, colours = "blue", border = "red")
| /scratch/gouwar.j/cran-all/cranData/xplorerr/inst/app-visualize/helper/histogram.R |
hscatter <- function(data, x, y, xax_title = '', xax_title_align = 'center',
xax_tick_int = 5, xax_title_col = 'black',
xax_title_ftype = 'italic', xax_title_fsize = '18px',
yax_title = '', yax_title_col = 'black',
yax_title_ftype = 'italic', yax_title_fsize = '18px',
point_size = 4, scatter_series_name = ' ',
point_col = 'blue', point_shape = 'circle',
fit_line = FALSE, line_col = 'red',
line_width = 0.1, point_on_line = FALSE, title = '',
title_align = 'center', title_col = 'black',
title_ftype = 'italic', title_size = '12px',
sub = '', sub_align = 'center', sub_col = 'black',
sub_ftype = 'italic', sub_size = '12px') {
da <- data %>%
select_(x, y) %>%
arrange_(x)
colnames(da) <- c('x', 'y')
j <- seq(from = min(da$x),
to = max(da$x),
length.out = length(da$x))
fit <- lm(y ~ x, data = da)
new <- tibble::tibble(x = j)
fits <- tibble::tibble(value = predict(fit, newdata = new))
h <- highchart() %>%
hc_xAxis(categories = da$x,
tickInterval = xax_tick_int,
title = list(text = xax_title,
align = xax_title_align,
style = list(color = xax_title_col,
fontWeight = xax_title_ftype,
fontSize = xax_title_fsize))) %>%
hc_yAxis(title = list(text = yax_title,
style = list(color = yax_title_col,
fontWeight = yax_title_ftype,
fontSize = yax_title_fsize)),
opposite = FALSE) %>%
hc_add_series(type = "scatter",
data = da$y,
name = scatter_series_name,
marker = list(radius = point_size)) %>%
hc_plotOptions(line = list(color = line_col,
marker = list(lineWidth = line_width,
enabled = point_on_line)),
scatter = list(marker = list(symbol = point_shape),
color = point_col)) %>%
hc_title(text = title,
align = title_align,
style = list(color = title_col,
fontWeight = title_ftype,
fontSize = title_size)) %>%
hc_subtitle(text = sub,
align = sub_align,
style = list(color = sub_col,
fontWeight = sub_ftype,
fontSize = sub_size))
if (fit_line) {
h <- h %>%
hc_add_series(type = "line",
data = fits$value,
name = 'Regression Line',
pointIntervalUnit = 0)
}
h
} | /scratch/gouwar.j/cran-all/cranData/xplorerr/inst/app-visualize/helper/hscatter.R |
# line graph
line_graph <- function(x, y, linetype = 1, linewidth = 1,
colour = "black", title = NA, subtitle = NA, xlabel = NA, ylabel = NA,
add_points = FALSE, shape, size, point_col, point_bg, ylim_l = NULL,
ylim_u = NULL, extra_lines = NULL, extra_vars = NULL, extra_cols = NULL,
ltys = NULL, lwds = NULL, extra_p = FALSE, pcolors = NULL, pbgcolors = NULL, pshapes = NULL,
psizes = NULL, colmain = "black", colsub = "black", colaxis = "black",
collab = "black", fontmain = 1, fontsub = 1, fontaxis = 1, fontlab = 1,
cexmain = 1, cexsub = 1, cexaxis = 1, cexlab = 1, text_p = NA,
text_x_loc = NA, text_y_loc = NA, text_col = "black", text_font = NA,
text_size = NA, m_text = NA, m_side = 3, m_line = 0.5, m_adj = 0.5,
m_col = "black", m_font = 1, m_cex = 1, leg = FALSE, leg_x, leg_y, legend,
leg_line,
leg_point, leg_colour, leg_boxtype, leg_boxcol, leg_boxlty, leg_boxlwd,
leg_boxborcol, leg_boxxjust, leg_boxyjust, leg_textcol, leg_textfont,
leg_textcolumns, leg_texthoriz, leg_title, leg_titlecol, leg_textadj) {
# empty plot
plot(y, type = 'n', xaxt = 'n', main = title, sub = subtitle, xlab = xlabel,
ylab = ylabel, ylim =c(ylim_l, ylim_u), col.main = colmain, col.sub = colsub,
col.axis = colaxis, col.lab = collab, font.main = fontmain,
font.sub = fontsub, font.axis = fontaxis, font.lab = fontlab,
cex.main = cexmain, cex.sub = cexsub, cex.axis = cexaxis,
cex.lab = cexlab
)
# add lines
lines(x = y, lty = linetype, lwd = linewidth, col = colour)
# axis labels
axis(1, at = seq_len(length(x)), labels = x)
# add points
if (add_points) {
points(x = y, pch = shape, cex = size, col = point_col, bg = point_bg)
}
# additional lines and points
if (!is.null(extra_lines)) {
for (i in seq_len(extra_lines)) {
lines(x = extra_vars[, i], lty = ltys[i], lwd = lwds[i],
col = extra_cols[i]
)
if (extra_p) {
points(x = extra_vars[i], pch = pshapes[i], cex = psizes[i],
col = pcolors[i], bg = pbgcolors[i])
}
}
}
if (leg == TRUE) {
legend(leg_x, leg_y,
legend = legend, lty = leg_line, pch = leg_point, col = leg_colour,
bty = leg_boxtype, bg = leg_boxcol,
box.lty = leg_boxlty, box.lwd = leg_boxlwd,
box.col = leg_boxborcol, xjust = leg_boxxjust,
yjust = leg_boxyjust, text.col = leg_textcol,
text.font = leg_textfont, ncol = leg_textcolumns,
horiz = leg_texthoriz, title = leg_title,
title.col = leg_titlecol, title.adj = leg_textadj)
}
# add text inside the plot
text(text_x_loc, text_y_loc, text_p, font = text_font, col = text_col,
cex = text_size)
# add text on the margins of the plot
mtext(m_text, side = m_side, line = m_line, adj = m_adj,
col = m_col, font = m_font, cex = m_cex)
}
| /scratch/gouwar.j/cran-all/cranData/xplorerr/inst/app-visualize/helper/line-plot.R |
library(dplyr)
library(plotly)
linely <- function(data, x, y, mode = 'lines', lcol = 'blue', lwidth = 1, ltype = 'plain',
title = NULL, p_bgcol = NULL, plot_bgcol = NULL,
title_family = 'Arial', title_size = 12, title_color = 'black',
axis_modify = FALSE, x_min, x_max, y_min, y_max,
x_title = NULL, x_showline = FALSE, x_showgrid = TRUE,
x_gridcol = NULL, x_showticklabels = TRUE,
x_lcol = NULL, x_lwidth = NULL, x_zline = FALSE,
x_autotick = TRUE, x_ticks = TRUE, x_tickcol = 'black',
x_ticklen = NULL, x_tickw = NULL, x_ticfont = 'Arial',
x_tickfsize = 10, x_tickfcol = 'black', y_title = NULL,
y_showline = FALSE, y_showgrid = TRUE,
y_gridcol = NULL, y_showticklabels = TRUE,
y_lcol = NULL, y_lwidth = NULL, y_zline = FALSE,
y_autotick = TRUE, y_ticks = TRUE, y_tickcol = 'black',
y_ticklen = NULL, y_tickw = NULL, y_ticfont = 'Arial',
y_tickfsize = 10, y_tickfcol = 'black',
ax_family = 'Arial', ax_size = 12, ax_color = 'black',
add_txt = FALSE, t_x, t_y, t_text, t_showarrow = FALSE,
t_font = 'Arial', t_size = 10, t_col = 'blue') {
yax <- data %>% select(y) %>% pull(1)
xax <- data %>% select(x) %>% pull(1)
p <- plot_ly(data = data,
type = "scatter",
mode = mode,
x = xax,
y = yax,
line = list(
color = lcol,
width = lwidth,
dash = ltype
))
title_font <- list(
family = title_family,
size = title_size,
color = title_color
)
axis_font <- list(
family = ax_family,
size = ax_size,
color = ax_color
)
xaxis <- list(title = x_title,
titlefont = axis_font,
showline = x_showline,
showgrid = x_showgrid,
gridcolor = x_gridcol,
showticklabels = x_showticklabels,
linecolor = x_lcol,
linewidth = x_lwidth,
zeroline = x_zline,
autotick = x_autotick,
ticks = x_ticks,
tickcolor = x_tickcol,
tickwidth = x_tickw,
ticklen = x_ticklen,
tickfont = list(family = x_ticfont,
size = x_tickfsize,
color = x_tickfcol))
yaxis <- list(title = y_title,
titlefont = axis_font,
showline = y_showline,
showgrid = y_showgrid,
gridcolor = y_gridcol,
showticklabels = y_showticklabels,
linecolor = y_lcol,
linewidth = y_lwidth,
zeroline = y_zline,
autotick = y_autotick,
ticks = y_ticks,
tickcolor = y_tickcol,
tickwidth = y_tickw,
ticklen = y_ticklen,
tickfont = list(family = y_ticfont,
size = y_tickfsize,
color = y_tickfcol))
p <- p %>%
layout(title = title,
font = title_font,
paper_bgcolor = p_bgcol,
plot_bgcolor = plot_bgcol,
xaxis = xaxis,
yaxis = yaxis)
if(add_txt) {
annote <- list(
x = t_x,
y = t_y,
text = t_text,
font = list(family = t_font,
size = t_size,
color = t_col),
showarrow = t_showarrow
)
p <- p %>%
layout(annotations = annote)
}
if(axis_modify) {
p <- p %>%
layout(
xaxis = list(
range = list(x_min, x_max)
),
yaxis = list(
range = list(y_min, y_max)
)
)
}
p
}
# data1 <- c(7.2, 7.6, 6.8, 6.5, 7)
# data2 <- c(6.8, 7.2, 7.8, 7, 6.2)
# data <- data.frame(x = data1, y = data2)
#
# p <- linely(gdp, 'india', mode = 'lines+markers', title = 'Line Chart',
# x_title = 'Year', y_title = 'Growth', axis_modify = TRUE,
# x_min = 0, x_max = 7, y_min = 4, y_max = 9)
# p
| /scratch/gouwar.j/cran-all/cranData/xplorerr/inst/app-visualize/helper/linely.R |
print_stats <- function(data) {
n <- nchar(format(data$uss, nsmall = 2))
width1 <- 52 + (2 * n)
width2 <- as.integer(width1 / 2)
width3 <- width2 - 5
width4 <- width2 - 2
col1 <- max(nchar(as.character(data$lowobs)))
col2 <- max(nchar(as.character(data$highobs)))
col3 <- max(nchar(as.character(data$lowobsi)))
col4 <- max(nchar(as.character(data$highobsi)))
v <- nchar("Value")
ol <- max(col1, col2, col3, col4, v)
gap <- width4 - (2 * ol)
cat(formatc("Univariate Analysis", width1), "\n\n",
formatl("N"), formatr(data$obs, n), formats(),
formatl("Variance"), formatr(data$variance, n), "\n",
formatl("Missing"), formatr(data$missing, n), formats(),
formatl("Std Deviation"), formatr(data$stdev, n), "\n",
formatl("Mean"), formatr(data$avg, n), formats(),
formatl("Range"), formatr(data$range, n), "\n",
formatl("Median"), formatr(data$median, n), formats(),
formatl("Interquartile Range"), formatr(data$iqrange, n), "\n",
formatl("Mode"), formatr(data$mode, n), formats(),
formatl("Uncorrected SS"), formatr(data$uss, n), "\n",
formatl("Trimmed Mean"), formatr(data$tavg, n), formats(),
formatl("Corrected SS"), formatr(data$css, n), "\n",
formatl("Skewness"), formatr(data$skew, n), formats(),
formatl("Coeff Variation"), formatr(data$cvar, n), "\n",
formatl("Kurtosis"), formatr(data$kurtosis, n), formats(),
formatl("Std Error Mean"), formatr(data$sem, n), "\n\n",
formatc("Quantiles", width1), "\n\n",
formatc("Quantile", width2), formatc("Value", width2), "\n\n",
formatc("Max ", width2), formatnc(data$Max, width2), "\n",
formatc("99% ", width2), formatnc(data$per99, width2), "\n",
formatc("95% ", width2), formatnc(data$per95, width2), "\n",
formatc("90% ", width2), formatnc(data$per90, width2), "\n",
formatc("Q3 ", width2), formatnc(data$per75, width2), "\n",
formatc("Median ", width2), formatnc(data$median, width2), "\n",
formatc("Q1 ", width2), formatnc(data$per25, width2), "\n",
formatc("10% ", width2), formatnc(data$per10, width2), "\n",
formatc("5% ", width2), formatnc(data$per5, width2), "\n",
formatc("1% ", width2), formatnc(data$per1, width2), "\n",
formatc("Min ", width2), formatnc(data$min, width2), "\n\n",
formatc("Extreme Values", width1), "\n\n",
formatc("Low", width2), formatc("High", width2), "\n\n",
formatol("Obs", ol), format_gap(gap), formatol("Value", ol), formats(),
formatol("Obs", ol), format_gap(gap), formatol("Value", ol), "\n")
for (i in seq_len(5)) {
cat("",formatol(data$lowobsi[i], ol), format_gap(gap), formatol(data$lowobs[i], ol), formats(),
formatol(data$highobsi[i], ol), format_gap(gap), formatol(data$highobs[i], ol), "\n")
}
}
print_cross <- function(data) {
p <- length(data$var2_levels)
q <- p + 2
h <- p + 1
r <- (h * 15) - 3
f <- length(data$var1_levels)
g <- f + 2
h <- p + 1
col_names <- c(data$varnames[1], data$var2_levels, "Row Total")
col_totals <- c("Column Total", data$column_totals, data$obs)
cat(formatter(" Cell Contents\n"), "|---------------|\n", "|", formatter("Frequency"),
"|\n", "|", formatter("Percent"), "|\n", "|", formatter("Row Pct"), "|\n",
"|", formatter("Col Pct"), "|\n", "|---------------|\n\n", "Total Observations: ",
data$obs, "\n\n")
cat("-", rep("---------------", q), sep = "")
cat("\n")
cat("| |", format(data$varnames[2], width = r, justify = "centre"),
"|")
cat("\n")
cat("-", rep("---------------", q), sep = "")
cat("\n|")
for (i in seq_along(col_names)) {
cat(formatter(col_names[i]), "|")
}
cat("\n-", rep("---------------", q), sep = "")
cat("\n")
for (i in seq_len(f)) {
cat("|")
for (j in seq_len(q)) {
cat(formatter(data$twowaytable[i, j]), "|")
}
cat("\n")
cat("| |")
for (j in seq_len(p)) {
cat(formatter(data$percent_table[i, j]), "|")
}
cat(" |")
cat("\n")
cat("| |")
for (j in seq_len(h)) {
cat(formatter(data$row_percent[i, j]), "|")
}
cat("\n")
cat("| |")
for (j in seq_len(p)) {
cat(formatter(data$column_percent[i, j]), "|")
}
cat(" |")
cat("\n-", rep("---------------", q), sep = "")
cat("\n")
}
cat("|")
for (i in seq_along(col_totals)) {
cat(formatter(col_totals[i]), "|")
}
cat("\n")
cat("| |")
for (i in seq_along(data$percent_column)) {
cat(formatter(data$percent_column[i]), "|")
}
cat(" |")
cat("\n-", rep("---------------", q), sep = "")
cat("\n")
}
print_cross2 <- function(data) {
# output formatting
p <- length(data$variable_levels)
q <- p + 2
h <- p + 1
r <- (h * 15) - 3
f <- length(data$row_name)
g <- f + 2
h <- p + 1
tu <- q * 15
cat(format(paste(data$variable_names[1], 'vs', data$variable_names[2]), width = tu, justify = 'centre'), '\n')
cat("-", rep("---------------", q), sep = "")
cat("\n")
cat("| |", format(data$variable_names[2], width = r, justify = "centre"), "|")
cat("\n")
cat("-", rep("---------------", q), sep = "")
cat("\n|")
for (i in seq_along(data$column_names)) {
cat(formatter(data$column_names[i]), "|")
}
cat("\n-", rep("---------------", q), sep = "")
cat("\n")
for (i in seq_len(f)) {
cat("|")
for (j in seq_len(q)) {
cat(formatter(data$twowaytable[i, j]), "|")
}
cat("\n")
cat("| |")
for (j in seq_len(p)) {
cat(formatter(data$percent_table[i, j]), "|")
}
cat(" |")
cat("\n")
cat("| |")
for (j in seq_len(h)) {
cat(formatter(data$row_percent[i, j]), "|")
}
cat("\n")
cat("| |")
for (j in seq_len(p)) {
cat(formatter(data$column_percent[i, j]), "|")
}
cat(" |")
cat("\n-", rep("---------------", q), sep = "")
cat("\n")
}
cat("|")
for (i in seq_along(data$column_totals)) {
cat(formatter(data$column_totals[i]), "|")
}
cat("\n")
cat("| |")
for (i in seq_along(data$percent_column)) {
cat(formatter(data$percent_column[i]), "|")
}
cat(" |")
cat("\n-", rep("---------------", q), sep = "")
cat("\n\n\n")
}
print_screen <- function(x) {
columns <- c(' Column Name ', ' Data Type ', ' Levels ', ' Missing ', ' Missing (%) ')
len_col <- as.vector(sapply(columns, nchar))
xlev <- lapply(x$levels, paste, collapse = " ") %>%
lapply(nchar) %>%
unlist %>%
max
lengths <- list(x$Variables, x$Types, xlev, x$Missing, x$MissingPer)
n <- length(columns)
nlist <- list()
for (i in seq_len(n)) {
nlist[[i]] <- max(len_col[i], max(sapply(lengths[[i]], nchar)))
}
clengths <- unlist(nlist)
clengths[3] <- max(10, xlev)
dash <- sum(clengths) + 6
cat(rep("-",dash), sep = "")
cat("\n|")
for(i in seq_len(n)) {
cat(format(columns[i], width = clengths[i], justify = 'centre'), "|", sep = "")
}
cat("\n", rep("-",dash), sep = "")
cat("\n")
for (i in seq_len(x$Columns)) {
cat("|", format(x$Variables[i], width = clengths[1], justify = 'centre'), "|",
format(x$Types[i], width = clengths[2], justify = 'centre'), "|",
format(paste(x$levels[[i]], collapse = " "), width = clengths[3], justify = 'centre'), "|",
format(as.character(x$Missing[i]), width = clengths[4], justify = 'centre'), "|",
format(as.character(x$MissingPer[i]), width = clengths[5], justify = 'centre'), "|\n", sep = ""
)
}
cat(rep("-",dash), sep = "")
cat("\n\n")
cat(' Overall Missing Values ', x$MissingTotal, "\n", 'Percentage of Missing Values ', x$MissingTotPer, "%\n",
'Rows with Missing Values ', x$MissingRows, "\n", "Columns With Missing Values ", x$MissingCols, "\n")
}
print_fcont <- function(data) {
cat(format(paste('Variable:', data$varname), width = 77, justify = 'centre'), '\n')
cat("|---------------------------------------------------------------------------|
| Cumulative Cumulative |
| Bins | Frequency | Frequency | Percent | Percent |
|---------------------------------------------------------------------------|")
for (i in seq_len(data$bins)) {
k <- i + 1
cat("\n|", formata(data$breaks[i], 1, 5), "-", formata(data$breaks[k], 1, 5), "|",
formata(data$frequency[i], 2, 12), "|", formata(data$cumulative[i], 2, 12), "|",
formatas(data$percent[i], 2, 12), "|", formatas(data$cum_percent[i], 2, 12), "|")
cat("\n|---------------------------------------------------------------------------|")
}
}
print_ftable <- function(data) {
nr <- nrow(data$ftable)
nc <- ncol(data$ftable)
cat(format(paste('Variable:', data$varname), width = 76, justify = 'centre'), '\n')
cat("|--------------------------------------------------------------------------|
| Cumulative Cumulative |
| Levels | Frequency | Frequency | Percent | Percent |
|--------------------------------------------------------------------------|\n")
for (i in seq_len(nr)) {
for (j in seq_len(nc)) {
cat("|", formatter_freq(data$ftable[i, j]))
}
cat("|")
cat("\n|--------------------------------------------------------------------------|\n")
}
cat('\n\n')
}
print_ftable2 <- function(data) {
nr <- nrow(data$ftable)
nc <- ncol(data$ftable)
cat(format(paste('Variable:', data$varname), width = 76, justify = 'centre'), '\n')
cat("|--------------------------------------------------------------------------|
| Cumulative Cumulative |
| Levels | Frequency | Frequency | Percent | Percent |
|--------------------------------------------------------------------------|\n")
for (i in seq_len(nr)) {
for (j in seq_len(nc)) {
cat("|", formatter_freq(data$ftable[i, j]))
}
cat("|")
cat("\n|--------------------------------------------------------------------------|\n")
}
cat('\n\n')
}
print_group <- function(data) {
line <- 23
n <- 21
n_names <- max(nchar(data$stats[2, c(-1)]))
n_uss <- max(nchar(data$stats[12, c(-1)]))
w <- max(n_names, n_uss) + 2
cola <- ncol(data$stats)
col <- cola - 1
ow <- 23 * cola - col
row <- nrow(data$stats)
cat(format(paste(data$yvar, 'by', data$xvar), width = ow, justify = 'centre'), '\n')
cat(rep('-', ow), sep = '', '\n')
cat('|')
for (i in seq_len(cola)) {
cat(format(colnames(data$stats)[i], width = n, justify = 'right'), '|', sep = '')
}
cat('\n')
cat(rep('-', ow), sep = '', '\n')
for (i in seq_len(row)) {
cat('|')
for (j in seq_len(cola)) {
cat(format(data$stats[i, j], width = n, justify = 'right'), '|', sep = '')
}
cat('\n')
}
cat(rep('-', ow), sep = '', '\n')
}
| /scratch/gouwar.j/cran-all/cranData/xplorerr/inst/app-visualize/helper/output.R |
# plotting functions
# scatter plot
pie_plot <- function(x, lab, edg = 200, title = NULL, clock = FALSE, rad = 0.8, initangle = 45,
ang = 45, bord = NULL, colors = NULL, den = NULL, ltype = NULL,
colmain = 'black', fontmain = 1, cexmain = 1) {
# basic plot
pie(x, labels = lab, edges = edg, main = title, clockwise = clock, radius = rad, init.angle = initangle,
density = den, angle = ang, border = bord, col = colors,
lty = ltype, col.main = colmain, font.main = fontmain,
cex.main = cexmain)
} | /scratch/gouwar.j/cran-all/cranData/xplorerr/inst/app-visualize/helper/pie-plot.R |
library(plotrix)
# 3D pie chart
pie3_plot <- function(x, lab = NULL, edg = NA, title = NULL, rad = 1,
bord = NULL, colors = NULL, high = 0.1, begin = 0, labpos = NULL,
labcol = NULL, labcex = 1.5, labrad = 1.25, explo = 0, shd = 0.8,
colmain = 'black', fontmain = 1, cexmain = 1) {
# basic plot
pie3D(x, labels = lab, edges = edg, main = title, radius = rad,
border = bord, col = colors, height = high, start = begin,
labelpos = labpos, labelcol = labcol, labelcex = labcex,
labelrad = labrad, explode = explo, shade = shd, col.main = colmain,
font.main = fontmain, cex.main = cexmain)
} | /scratch/gouwar.j/cran-all/cranData/xplorerr/inst/app-visualize/helper/pie3d-plot.R |
piely <- function(data = NULL, x = NULL, text_pos = 'inside', text_font = 'Arial',
text_info = 'label+percent', itext_f_col = 'black',
itext_f_fam = 'Arial', itext_f_size = 14, hover_info = 'text',
text_direction = 'anticlockwise', text_rotation = 0,
pie_pull = 0, pie_hole = 0, col_opacity = 0.9,
pie_l_col = '#FFFFFF', pie_l_w = 1, auto_size = TRUE,
plot_width = NULL, plot_height = NULL, axis_range = FALSE,
x_min, x_max, y_min, y_max, symbol = 'circle', size = 5,
title = NA, show_legend = TRUE, x_title = NA, y_title = NA,
x_showgrid = FALSE, y_showgrid = FALSE,
ax_title_font_family = 'Arial, sans-serif',
ax_title_font_size = 18, ax_title_font_color = 'black',
ax_tick_font_family = 'Arial, sans-serif',
ax_tick_font_size = 18, ax_tick_font_color = 'black',
x_autotick = TRUE, x_ticks = 'outside', x_tick0 = NULL,
x_dtick = NULL, x_ticklen = 5, x_tickwidth = 1,
x_tickcolor = '#444', x_showticklab = FALSE,
x_tickangle = 'auto', x_zeroline = FALSE,
x_showline = TRUE, x_gridcolor = "rgb(204, 204, 204)",
x_gridwidth = 1, x_zerolinecol = "#444",
x_zerolinewidth = 1, x_linecol = '#444',
x_linewidth = 1, y_autotick = TRUE, y_ticks = 'outside',
y_tick0 = NULL, y_dtick = NULL, y_ticklen = 5,
y_tickwidth = 1, y_tickcolor = '#444',
y_showticklab = FALSE, y_tickangle = 'auto',
y_zeroline = FALSE, y_showline = TRUE,
y_gridcolor = "rgb(204, 204, 204)",
y_gridwidth = 1, y_zerolinecol = "#444",
y_zerolinewidth = 1, y_linecol = '#444',
y_linewidth = 1, left_margin = 80, right_margin = 80,
top_margin = 100, bottom_margin = 80, padding = 0,
leg_x = 100, leg_y = 0.5, leg_orientation = 'v',
leg_font_family = 'sans-serif',
leg_font_size = 12, leg_font_color = '#000',
leg_bg_color = '#E2E2E2',
leg_border_col = "#FFFFFF", leg_border_width = 2,
add_annotate = FALSE,
x_annotate, y_annotate, text_annotate,
annotate_xanchor = 'auto', show_arrow, arrow_head = 1,
ax_anntate = 20, ay_annotate = -40,
annotate_family = 'sans-serif',
annotate_size = 14, annotate_col = 'red') {
f1 <- list(
family = ax_title_font_family,
size = ax_title_font_size,
color = ax_title_font_color
)
f2 <- list(
family = ax_tick_font_family,
size = ax_tick_font_size,
color = ax_tick_font_color
)
xaxis <- list(
title = x_title,
showgrid = x_showgrid,
autotick = x_autotick,
ticks = x_ticks,
tick0 = x_tick0,
dtick = x_dtick,
ticklen = x_ticklen,
tickwidth = x_tickwidth,
tickcolor = x_tickcolor,
titlefont = f1,
showticklabels = x_showticklab,
tickangle = x_tickangle,
tickfont = f2,
zeroline = x_zeroline,
showline = x_showline,
gridcolor = x_gridcolor,
gridwidth = x_gridwidth,
zerolinecolor = x_zerolinecol,
zerolinewidth = x_zerolinewidth,
linecolor = x_linecol,
linewidth = x_linewidth
)
yaxis <- list(
title = y_title,
showgrid = y_showgrid,
autotick = y_autotick,
ticks = y_ticks,
tick0 = y_tick0,
dtick = y_dtick,
ticklen = y_ticklen,
tickwidth = y_tickwidth,
tickcolor = y_tickcolor,
titlefont = f1,
showticklabels = y_showticklab,
tickangle = y_tickangle,
tickfont = f2,
zeroline = y_zeroline,
showline = y_showline,
mirror = 'ticks',
gridcolor = y_gridcolor,
gridwidth = y_gridwidth,
zerolinecolor = y_zerolinecol,
zerolinewidth = y_zerolinewidth,
linecolor = y_linecol,
linewidth = y_linewidth
)
# margins
m <- list(
l = left_margin,
r = right_margin,
t = top_margin,
b = bottom_margin,
pad = padding
)
# legend
l <- list(
x = leg_x,
y = leg_y,
orientation = leg_orientation,
font = list(
family = leg_font_family,
size = leg_font_size,
color = leg_font_color),
bgcolor = leg_bg_color,
bordercolor = leg_border_col,
borderwidth = leg_border_width)
# annotations
if(add_annotate) {
a <- list(
x = x_annotate,
y = y_annotate,
text = text_annotate,
xref = 'x',
yref = 'y',
xanchor = annotate_xanchor,
showarrow = show_arrow,
arrowhead = arrow_head,
ax = ax_annotate,
ay = ay_annotate,
font = list(
family = annotate_family,
size = annotate_size,
color = annotate_col
)
)
}
x1 <- data %>%
select_(x) %>%
unlist() %>%
as.factor() %>%
levels()
y <- data %>%
select_(x) %>%
table() %>%
as.vector()
data <- data.frame(x1, y)
p <- plot_ly(data, labels = x1, values = y, type = 'pie',
textposition = text_pos, textinfo = text_info,
textfont = text_font,
insidetextfont = list(color = itext_f_col,
family = itext_f_fam,
size = itext_f_size),
hoverinfo = hover_info,
direction = text_direction,
rotation = text_rotation,
pull = pie_pull,
hole = pie_hole,
opacity = col_opacity,
marker = list(line = list(color = pie_l_col,
width = pie_l_w))) %>%
layout(
title = title,
xaxis = xaxis,
yaxis = yaxis,
autosize = auto_size,
margin = m,
legend = l,
showlegend = show_legend
)
if(add_annotate) {
p <- p %>%
layout(annotations = a)
}
if(axis_range) {
p <- p %>%
layout(
xaxis = list(
range = list(x_min, x_max)
),
yaxis = list(
range = list(y_min, y_max)
)
)
}
p
}
p <- piely(mtcars, 'cyl')
p
| /scratch/gouwar.j/cran-all/cranData/xplorerr/inst/app-visualize/helper/piely.R |
# plotting functions
# scatter plot
scatter_plot <- function(x, y, title = NA, sub = NA, xlab = NA,
ylab = NA, colours = "black", fill = NULL, shape = 18, xlim_min = NULL,
xlim_max = NULL, ylim_min = NULL, ylim_max = NULL,
size = 1, colmain = "black", colsub = "black", colaxis = "black",
collab = "black", fontmain = 1, fontsub = 1, fontaxis = 1, fontlab = 1,
cexmain = 1, cexsub = 1, cexaxis = 1, cexlab = 1, text_p = NA,
text_x_loc = NA, text_y_loc = NA, text_col = "black", text_font = NA,
text_size = NA, m_text = NA, m_side = 3, m_line = 0.5, m_adj = 0.5,
m_col = "black", m_font = 1, m_cex = 1, fitline = FALSE, col_abline = 'black',
lty_abline = 1, lwd_abline = 1) {
# basic plot
plot(x = x, y = y, type = 'p', main = title, sub = sub, xlab = xlab, ylab = ylab,
xlim = c(xlim_min, xlim_max), ylim = c(ylim_min, ylim_max),
col = colours, bg = fill, pch = shape, cex = size,
col.main = colmain, col.sub = colsub,
col.axis = colaxis, col.lab = collab, font.main = fontmain,
font.sub = fontsub, font.axis = fontaxis, font.lab = fontlab,
cex.main = cexmain, cex.sub = cexsub, cex.axis = cexaxis,
cex.lab = cexlab)
# add text inside the plot
text(text_x_loc, text_y_loc, text_p, font = text_font, col = text_col,
cex = text_size)
# add text on the margins of the plot
mtext(m_text, side = m_side, line = m_line, adj = m_adj,
col = m_col, font = m_font, cex = m_cex)
# fit a regression line
if (fitline) {
abline(lm(y ~ x), col = col_abline, lty = lty_abline, lwd = lwd_abline)
}
}
# scatter plot test
# scatter_plot(mtcars$disp, mtcars$mpg,
# title = "Scatter Plot", sub = "Fuck", xlab = "Boobs", ylab ="Tits",
# xlim_min = 0, xlim_max = 600, ylim_min = 0, ylim_max = 50, colours = "red",
# m_text = "Fuck You", m_side = 3, m_line = 0.5, m_adj = 1)
| /scratch/gouwar.j/cran-all/cranData/xplorerr/inst/app-visualize/helper/scatter-plot.R |
library(plotly)
scatterly <- function(data, x, y, name = NA, text = NA,
color = '#1F77B4', opacity = 1,
auto_size = TRUE,
plot_width = NULL, plot_height = NULL,
axis_range = FALSE, x_min, x_max, y_min, y_max,
symbol = 'circle', size = 5,
title = NA, show_legend = TRUE,
x_title = NA, y_title = NA,
x_showgrid = TRUE, y_showgrid = TRUE,
fit_line = FALSE, line_col = 'red',
line_type = 'dashed', line_width = 1,
ax_title_font_family = 'Arial, sans-serif',
ax_title_font_size = 18, ax_title_font_color = 'black',
ax_tick_font_family = 'Arial, sans-serif',
ax_tick_font_size = 18, ax_tick_font_color = 'black',
x_autotick = TRUE, x_ticks = 'outside', x_tick0 = NULL,
x_dtick = NULL, x_ticklen = 5, x_tickwidth = 1,
x_tickcolor = '#444', x_showticklab = TRUE,
x_tickangle = 'auto', x_zeroline = FALSE,
x_showline = TRUE, x_gridcolor = "rgb(204, 204, 204)",
x_gridwidth = 1, x_zerolinecol = "#444",
x_zerolinewidth = 1, x_linecol = '#444',
x_linewidth = 1,
y_autotick = TRUE, y_ticks = 'outside',
y_tick0 = NULL, y_dtick = NULL, y_ticklen = 5,
y_tickwidth = 1, y_tickcolor = '#444',
y_showticklab = TRUE, y_tickangle = 'auto',
y_zeroline = FALSE, y_showline = TRUE,
y_gridcolor = "rgb(204, 204, 204)",
y_gridwidth = 1, y_zerolinecol = "#444",
y_zerolinewidth = 1, y_linecol = '#444',
y_linewidth = 1, left_margin = 80, right_margin = 80,
top_margin = 100, bottom_margin = 80, padding = 0,
leg_x = 100, leg_y = 0.5, leg_orientation = 'v',
leg_font_family = 'sans-serif',
leg_font_size = 12, leg_font_color = '#000',
leg_bg_color = '#E2E2E2',
leg_border_col = "#FFFFFF", leg_border_width = 2,
add_annotate = FALSE,
x_annotate, y_annotate, text_annotate,
annotate_xanchor = 'auto', show_arrow, arrow_head = 1,
ax_anntate = 20, ay_annotate = -40,
annotate_family = 'sans-serif',
annotate_size = 14, annotate_col = 'red') {
x <- data %>% select_(x) %>% unlist()
y <- data %>% select_(y) %>% unlist()
# style axes title and tickfont
f1 <- list(
family = ax_title_font_family,
size = ax_title_font_size,
color = ax_title_font_color
)
f2 <- list(
family = ax_tick_font_family,
size = ax_tick_font_size,
color = ax_tick_font_color
)
xaxis <- list(
title = x_title,
showgrid = x_showgrid,
autotick = x_autotick,
ticks = x_ticks,
tick0 = x_tick0,
dtick = x_dtick,
ticklen = x_ticklen,
tickwidth = x_tickwidth,
tickcolor = x_tickcolor,
titlefont = f1,
showticklabels = x_showticklab,
tickangle = x_tickangle,
tickfont = f2,
zeroline = x_zeroline,
showline = x_showline,
gridcolor = x_gridcolor,
gridwidth = x_gridwidth,
zerolinecolor = x_zerolinecol,
zerolinewidth = x_zerolinewidth,
linecolor = x_linecol,
linewidth = x_linewidth
)
yaxis <- list(
title = y_title,
showgrid = y_showgrid,
autotick = y_autotick,
ticks = y_ticks,
tick0 = y_tick0,
dtick = y_dtick,
ticklen = y_ticklen,
tickwidth = y_tickwidth,
tickcolor = y_tickcolor,
titlefont = f1,
showticklabels = y_showticklab,
tickangle = y_tickangle,
tickfont = f2,
zeroline = y_zeroline,
showline = y_showline,
mirror = 'ticks',
gridcolor = y_gridcolor,
gridwidth = y_gridwidth,
zerolinecolor = y_zerolinecol,
zerolinewidth = y_zerolinewidth,
linecolor = y_linecol,
linewidth = y_linewidth
)
# margins
m <- list(
l = left_margin,
r = right_margin,
t = top_margin,
b = bottom_margin,
pad = padding
)
# legend
l <- list(
x = leg_x,
y = leg_y,
orientation = leg_orientation,
font = list(
family = leg_font_family,
size = leg_font_size,
color = leg_font_color),
bgcolor = leg_bg_color,
bordercolor = leg_border_col,
borderwidth = leg_border_width)
# annotations
if(add_annotate) {
a <- list(
x = x_annotate,
y = y_annotate,
text = text_annotate,
xref = 'x',
yref = 'y',
xanchor = annotate_xanchor,
showarrow = show_arrow,
arrowhead = arrow_head,
ax = ax_annotate,
ay = ay_annotate,
font = list(
family = annotate_family,
size = annotate_size,
color = annotate_col
)
)
}
p <- plot_ly(data = data,
type = "scatter",
mode = "markers",
x = x,
y = y,
name = name,
text = text,
marker = list(
color = color,
opacity = opacity,
symbol = symbol,
size = size
),
width = plot_width,
height = plot_height) %>%
layout(
title = title,
xaxis = xaxis,
yaxis = yaxis,
autosize = auto_size,
margin = m,
legend = l,
showlegend = show_legend
)
if(add_annotate) {
p <- p %>%
layout(annotations = a)
}
if(axis_range) {
p <- p %>%
layout(
xaxis = list(
range = list(x_min, x_max)
),
yaxis = list(
range = list(y_min, y_max)
)
)
}
if(fit_line) {
p <- p %>%
add_trace(x = x,
y = ~fitted(lm(y ~ x)),
mode = 'markers+lines',
line = list(
color = line_col,
dash = line_type,
width = line_width
)
)
p
}
p
}
# test
mtcars$cyl <- as.factor(mtcars$cyl)
scatterly(mtcars, 'disp', 'mpg', text = 'disp, mpg', size = 8, color = 'cyl',
title = 'Displacement vs Mileage', axis_range = FALSE,
x_min = 0, x_max = 600, y_min = 0, y_max = 50,
x_title = 'Displacement', y_title = 'Miles Per Gallon',
show_legend = TRUE, x_showgrid = F, fit_line = T)
| /scratch/gouwar.j/cran-all/cranData/xplorerr/inst/app-visualize/helper/scatterly.R |
# activity flow
# Step 1: Upload data or use demo data
# Step 2: Choose the type of data being plotted
# Options: a. Grouped Data
# b. Ungrouped Data
# Step 3: Choose whether a single plot should be built or multiple plots based on a grouping variable
# Options: Select a grouping variable
# barplot
# univariate
bar_plotu <- function(x, horizontal = FALSE, color = NULL, border = "black",
title = NA, xlab = NA, labels = NA, space = NA, width = 1,
axes = TRUE, axislty = 0, offset = 0,
ylab = NA, colmain = "black", colsub = "black", colaxis = "black",
collab = "black", fontmain = 1, fontsub = 1, fontaxis = 1, fontlab = 1,
cexmain = 1, cexsub = 1, cexaxis = 1, cexlab = 1, leg = FALSE, leg_x, leg_y, legend,
leg_point, leg_colour, leg_boxtype, leg_boxcol, leg_boxlty, leg_boxlwd,
leg_boxborcol, leg_boxxjust, leg_boxyjust, leg_textcol, leg_textfont,
leg_textcolumns, leg_texthoriz, leg_title, leg_titlecol, leg_textadj, text_p = NA,
text_x_loc = NA, text_y_loc = NA, text_col = "black", text_font = NA,
text_size = NA, m_text = NA, m_side = 3, m_line = 0.5, m_adj = 0.5,
m_col = "black", m_font = 1, m_cex = 1) {
counts <- table(x)
# bar plot
barplot(counts, horiz = horizontal, col = color, border = border,
main = title, xlab = xlab, names.arg = labels, space = space,
width = width, density = NULL, angle = 45, axes = axes,
axis.lty = axislty, offset = offset,
ylab = ylab, col.main = colmain, col.sub = colsub,
col.axis = colaxis, col.lab = collab, font.main = fontmain,
font.sub = fontsub, font.axis = fontaxis, font.lab = fontlab,
cex.main = cexmain, cex.sub = cexsub, cex.axis = cexaxis,
cex.lab = cexlab)
# legend
if (leg == TRUE) {
legend(leg_x, leg_y,
legend = legend, pch = leg_point, col = leg_colour,
bty = leg_boxtype, bg = leg_boxcol,
box.lty = leg_boxlty, box.lwd = leg_boxlwd,
box.col = leg_boxborcol, xjust = leg_boxxjust,
yjust = leg_boxyjust, text.col = leg_textcol,
text.font = leg_textfont, ncol = leg_textcolumns,
horiz = leg_texthoriz, title = leg_title,
title.col = leg_titlecol, title.adj = leg_textadj)
}
# add text inside the plot
text(text_x_loc, text_y_loc, text_p, font = text_font, col = text_col,
cex = text_size)
# add text on the mar-gins of the plot
mtext(m_text, side = m_side, line = m_line, adj = m_adj,
col = m_col, font = m_font, cex = m_cex)
}
| /scratch/gouwar.j/cran-all/cranData/xplorerr/inst/app-visualize/helper/ubar_plot.R |
# box plots
# univariate
box_plotu <- function(x, title = NA, xlabel = NA, ylabel = NA, colour = 'blue', borders = 'black',
horiz = FALSE, notches = FALSE, ranges = 1.5, outlines = TRUE, varwidths = FALSE,
colmain = "black", colsub = "black", colaxis = "black", collab = "black",
fontmain = 1, fontsub = 1, fontaxis = 1, fontlab = 1,
cexmain = 1, cexsub = 1, cexaxis = 1, cexlab = 1, text_p = NA,
text_x_loc = NA, text_y_loc = NA, text_col = "black", text_font = NA,
text_size = NA, m_text = NA, m_side = 3, m_line = 0.5, m_adj = 0.5,
m_col = "black", m_font = 1, m_cex = 1) {
boxplot(x, main = title, xlab = xlabel, ylab = ylabel, col = colour, border = borders,
horizontal = horiz, notch = notches, range = ranges, outline = outlines,
varwidth = varwidths, col.main = colmain, col.sub = colsub,
col.axis = colaxis, col.lab = collab, font.main = fontmain,
font.sub = fontsub, font.axis = fontaxis, font.lab = fontlab,
cex.main = cexmain, cex.sub = cexsub, cex.axis = cexaxis,
cex.lab = cexlab)
# add text inside the plot
text(text_x_loc, text_y_loc, text_p, font = text_font, col = text_col,
cex = text_size)
# add text on the mar-gins of the plot
mtext(m_text, side = m_side, line = m_line, adj = m_adj,
col = m_col, font = m_font, cex = m_cex)
}
| /scratch/gouwar.j/cran-all/cranData/xplorerr/inst/app-visualize/helper/ubox-plot.R |
library(highcharter)
library(dplyr)
library(magrittr)
highbar <- function(data, column, title = '', name = '', horizontal = FALSE) {
da <- data %>%
select_(column) %>%
pull(1) %>%
as.factor()
lev <- da %>%
levels()
tab <- da %>%
table() %>%
as.vector()
if (horizontal) {
bartype <- 'bar'
} else {
bartype <- 'column'
}
highchart() %>%
hc_chart(type = bartype) %>%
hc_title(text = title) %>%
hc_xAxis(categories = lev) %>%
hc_add_series(data = tab,
name = name)
}
highbar(mtcars, 'cyl', horizontal = TRUE)
data <- mtcars
column <- 'cyl'
| /scratch/gouwar.j/cran-all/cranData/xplorerr/inst/app-visualize/helper/unibar.R |
formatter_freq <- function(x) {
x %>%
as.character() %>%
format(width = 13, justify = "centre")
}
formatter <- function(x) {
x %>%
as.character() %>%
format(width = 13, justify = "right")
}
percent <- function(x, y) {
out <- round((x / y) * 100, 2)
}
formata <- function(x, round, width, justify = "centre") {
x %>%
round(round) %>%
as.character() %>%
format(width = width, justify = justify)
}
formatas <- function(x, round, width, justify = "centre") {
return(format(x, width = width, justify = justify))
}
bin_size <- function(data, bins) {
return((max(data, na.rm = TRUE) - min(data, na.rm = TRUE)) / bins)
}
intervals <- function(data, bins, na.rm = TRUE) {
binsize <- bin_size(data, bins)
bin <- bins - 1
interval <- min(data)
for (i in seq_len(bin)) {
out <- interval[i] + binsize
interval <- c(interval, out)
}
interval <- c(interval, max(data))
return(interval)
}
freq <- function(data, bins, inta) {
result <- c()
for (i in seq_len(bins)) {
k <- i + 1
freq <- data >= inta[i] & data <= inta[k]
out <- length(data[freq])
result <- c(result, out)
}
return(result)
}
div_by <- function(x) {
1 / x
}
standardize <- function(x, avg, stdev, p) {
((x - avg) / stdev) ^ p
}
sums <- function(x, q) {
avg <- mean(x)
stdev <- sd(x)
result <- sum(sapply(x, standardize, avg, stdev, q))
return(result)
}
md_helper <- function(x, y) {
abs(x - y)
}
std_error <- function(x) {
sd(x) / (length(x) ^ 0.5)
}
uss <- function(x, y) {
(x - y) ^ 2
}
stat_uss <- function(x) {
sum(x ^ 2)
}
formatl <- function(x) {
x %>%
format(nsmall = 2) %>%
format(width = 20, justify = "left")
}
formatol <- function(x, w) {
format(as.character(x), width = w, justify = "centre")
}
formatr <- function(x, w) {
x %>%
rounda() %>%
format(nsmall = 2, width = w, justify = "right")
}
formatc <- function(x, w) {
if (is.numeric(x)) {
ret <- x %>%
round(2) %>%
as.character(x) %>%
format(width = w, justify = "centre")
} else {
ret <- x %>%
as.character(x) %>%
format(width = w, justify = "centre")
}
return(ret)
}
formatnc <- function(x, w) {
x %>%
round(2) %>%
format(nsmall = 2) %>%
format(width = w, justify = "centre")
}
formats <- function() {
x <- rep(" ")
}
format_gap <- function(w) {
x <- rep("", w)
}
return_pos <- function(data, number) {
out <- c()
for (i in seq_len(length(data))) {
if (data[i] == number) {
out <- c(out, i)
}
}
return(out)
}
row_pct <- function(mat, tot) {
rows <- dim(mat)[1]
l <- length(tot)
result <- c()
for (i in seq_len(rows)) {
diva <- mat[i, ] / tot[i]
result <- rbind(result, diva)
}
rownames(result) <- NULL
return(result)
}
col_pct <- function(mat, tot) {
cols <- dim(mat)[2]
l <- length(tot)
result <- c()
for (i in seq_len(cols)) {
diva <- mat[, i] / tot[i]
result <- cbind(result, diva)
}
colnames(result) <- NULL
return(result)
}
rounda <- function(x) {
round(x, 2)
}
l <- function(x) {
x <- as.character(x)
k <- grep("\\$", x)
if (length(k) == 1) {
temp <- strsplit(x, "\\$")
out <- temp[[1]][2]
} else {
out <- x
}
return(out)
}
fround <- function(x) {
format(round(x, 2), nsmall = 2)
}
pol_chi <- function(l1, l2, df, col) {
x <- c(l1, seq(l1, l2, 0.01), l2)
y <- c(0, dchisq(seq(l1, l2, 0.01), df), 0)
polygon(x, y, col = col)
}
pol_f <- function(l1, l2, num_df, den_df, col) {
x <- c(l1, seq(l1, l2, 0.01), l2)
y <- c(0, df(seq(l1, l2, 0.01), num_df, den_df), 0)
polygon(x, y, col = col)
}
pol_cord <- function(l1, l2, mean, sd, col) {
x <- c(l1, seq(l1, l2, 0.01), l2)
y <- c(0, dnorm(seq(l1, l2, 0.01), mean, sd), 0)
polygon(x, y, col = col)
}
xaxp <- function(mean, el) {
xl <- mean - el
xu <- mean + el
x <- seq(xl, xu, 0.01)
return(x)
}
seqlp <- function(mean, sd, el) {
lmin <- mean - (el * sd)
lmax <- mean + (el * sd)
l <- seq(lmin, lmax, sd)
return(l)
}
xmmp <- function(mean, sd, el) {
xmin <- mean - (el * sd)
xmax <- mean + (el * sd)
out <- c(xmin, xmax)
return(out)
}
xax <- function(mean) {
xl <- mean - 3
xu <- mean + 3
x <- seq(xl, xu, 0.01)
return(x)
}
seql <- function(mean, sd) {
lmin <- mean - (5 * sd)
lmax <- mean + (5 * sd)
l <- seq(lmin, lmax, sd)
return(l)
}
xmm <- function(mean, sd) {
xmin <- mean - (5 * sd)
xmax <- mean + (5 * sd)
out <- c(xmin, xmax)
return(out)
}
seqln <- function(mean, sd) {
lmin <- mean - 3 * sd
lmax <- mean + 3 * sd
l <- seq(lmin, lmax, sd)
return(l)
}
xmn <- function(mean, sd) {
xmin <- mean - 3 * sd
xmax <- mean + 3 * sd
out <- c(xmin, xmax)
return(out)
}
pol_t <- function(l1, l2, df, col) {
x <- c(l1, seq(l1, l2, 0.01), l2)
y <- c(0, dt(seq(l1, l2, 0.01), df), 0)
polygon(x, y, col = col)
}
# ss <- function(x) {
# return(x ^ 2)
# }
#
# fl <- function(x, w) {
# x <- as.character(x)
# ret <- format(x, width = w, justify = "left")
# return(ret)
# }
#
# fc <- function(x, w) {
# x <- as.character(x)
# ret <- format(x, width = w, justify = "centre")
# return(ret)
# }
# formatrc <- function(x, w) {
# x <- as.character(x)
# ret <- format(x, width = w, justify = "right")
# return(ret)
# }
paired_data <- function(x, y) {
d <- tibble(x = x, y = y) %>%
mutate(z = x - y) %>%
gather()
return(d)
}
paired_stats <- function(data, key, value) {
d <- data %>%
group_by_(key) %>%
select_(value, key) %>%
summarise_each(funs(length, mean, sd)) %>%
as_data_frame() %>%
mutate(
se = sd / sqrt(length)
) %>%
select(-(key:length)) %>%
round(2)
return(d)
}
samp_err <- function(sigma, n) {
sigma / (n ^ 0.5)
}
conf_int_t <- function(u, s, n, alpha = 0.05) {
a <- alpha / 2
df <- n - 1
error <- round(qt(a, df), 3) * -1
lower <- u - (error * samp_err(s, n))
upper <- u + (error * samp_err(s, n))
result <- c(lower, upper)
return(result)
}
cor_sig <- function(corr, n) {
t <- corr / ((1 - (corr ^ 2)) / (n - 2)) ^ 0.5
df <- n - 2
sig <- (1 - pt(t, df)) * 2
return(round(sig, 4))
}
formatter_pair <- function(x, w) {
x1 <- format(x, nsmall = 2)
x2 <- as.character(x1)
ret <- format(x2, width = w, justify = "centre")
return(ret)
}
fg <- function(x, w) {
x %>%
as.character() %>%
format(width = w, justify = 'centre')
}
fs <- function() {
rep(" ")
}
| /scratch/gouwar.j/cran-all/cranData/xplorerr/inst/app-visualize/helper/utils.R |
source("helper/ubar_plot.R")
# update variable selection for bar plots
# observe({
# updateSelectInput(session, 'ubar_select', choices = names(data()))
# })
observeEvent(input$finalok, {
f_data <- final_split$train[, sapply(final_split$train, is.factor)]
# validate(need(!dim(f_data)[2] == 0, 'No factor variables in the data.'))
if (is.null(dim(f_data))) {
k <- final_split$train %>% map(is.factor) %>% unlist()
j <- names(which(k == TRUE))
fdata <- tibble::as_data_frame(f_data)
colnames(fdata) <- j
updateSelectInput(session, inputId = "ubar_select",
choices = names(fdata))
} else if (dim(f_data)[2] == 0) {
updateSelectInput(session, 'ubar_select', choices = '', selected = '')
} else {
updateSelectInput(session, 'ubar_select', choices = names(f_data))
}
})
observeEvent(input$submit_part_train_per, {
f_data <- final_split$train[, sapply(final_split$train, is.factor)]
# validate(need(!dim(f_data)[2] == 0, 'No factor variables in the data.'))
if (is.null(dim(f_data))) {
k <- final_split$train %>% map(is.factor) %>% unlist()
j <- names(which(k == TRUE))
fdata <- tibble::as_data_frame(f_data)
colnames(fdata) <- j
updateSelectInput(session, inputId = "ubar_select",
choices = names(fdata))
} else if (dim(f_data)[2] == 0) {
updateSelectInput(session, 'ubar_select', choices = '', selected = '')
} else {
updateSelectInput(session, 'ubar_select', choices = names(f_data))
}
})
# selected data
selectedVar <- reactive({
req(input$ubar_select)
bar_data <- final_split$train[, input$ubar_select]
})
# dynamic UI for bar colors
output$ui_ncolbar <- renderUI({
ncol <- as.integer(input$ncolbar)
if (ncol < 1) {
NULL
} else {
lapply(1:ncol, function(i) {
textInput(paste("n_barcol_", i),
label = paste0("Bar ", i, " Color"),
value = 'blue')
})
}
})
colours_bar <- reactive({
ncol <- as.integer(input$ncolbar)
if (ncol < 1) {
colors <- NULL
} else {
collect <- list(lapply(1:ncol, function(i) {
input[[paste("n_barcol_", i)]]
}))
colors <- unlist(collect)
}
colors
})
# dynamic UI for bar border colors
output$ui_nborbar <- renderUI({
ncol <- as.integer(input$nborbar)
if (ncol < 1) {
NULL
} else {
lapply(1:ncol, function(i) {
textInput(paste("n_bor_", i),
label = paste0("Border Color ", i),
value = 'black')
})
}
})
borders_bar <- reactive({
ncol <- as.integer(input$nborbar)
if (ncol < 1) {
colors <- NULL
} else {
collect <- list(lapply(1:ncol, function(i) {
input[[paste("n_bor_", i)]]
}))
colors <- unlist(collect)
}
colors
})
# dynamic UI for bar labels
output$ui_nbarlabel <- renderUI({
ncol <- as.integer(input$nbarlabel)
if (ncol < 1) {
NULL
} else {
lapply(1:ncol, function(i) {
textInput(paste("n_barlabel_", i),
label = paste0("Bar ", i, " Label"))
})
}
})
labels_bar <- reactive({
ncol <- as.integer(input$nbarlabel)
if (ncol < 1) {
colors <- NULL
} else {
collect <- list(lapply(1:ncol, function(i) {
input[[paste("n_barlabel_", i)]]
}))
colors <- unlist(collect)
}
colors
})
# dynamic UI for bar width
output$ui_nbarwidth <- renderUI({
ncol <- as.integer(input$nbarwidth)
if (ncol < 1) {
NULL
} else {
lapply(1:ncol, function(i) {
numericInput(paste("n_barwidth_", i),
label = paste0("Bar ", i, " Width"),
value = 1, min = 1)
})
}
})
widths_bar <- reactive({
ncol <- as.integer(input$nbarwidth)
if (ncol < 1) {
colors <- NULL
} else {
collect <- list(lapply(1:ncol, function(i) {
input[[paste("n_barwidth_", i)]]
}))
colors <- unlist(collect)
}
colors
})
# # dynamic UI for shading density
# output$ui_nbardensity <- renderUI({
# ncol <- as.integer(input$nbardensity)
# lapply(1:ncol, function(i) {
# numericInput(paste("n_bardensity_", i),
# label = paste0("Bar ", i, " Density"),
# value = 0, min = 0)
# })
# })
# density_bar <- reactive({
# ncol <- as.integer(input$nbardensity)
# collect <- list(lapply(1:ncol, function(i) {
# input[[paste("n_bardensity_", i)]]
# }))
# colors <- unlist(collect)
# })
# # dynamic UI for shading angle
# output$ui_nbarangle <- renderUI({
# ncol <- as.integer(input$nbarangle)
# lapply(1:ncol, function(i) {
# numericInput(paste("n_barangle_", i),
# label = paste0("Bar ", i, " Angle"),
# value = 0, min = 0)
# })
# })
# angle_bar <- reactive({
# ncol <- as.integer(input$nbarangle)
# collect <- list(lapply(1:ncol, function(i) {
# input[[paste("n_barangle_", i)]]
# }))
# colors <- unlist(collect)
# })
# dynamic UI for legend names
output$ui_legnames <- renderUI({
ncol <- as.integer(input$leg_names)
lapply(1:ncol, function(i) {
textInput(paste("n_names_", i),
label = paste0("Legend Name ", i))
})
})
# dynamic UI for legend border
output$ui_legpoint <- renderUI({
ncol <- as.integer(input$leg_point)
lapply(1:ncol, function(i) {
numericInput(paste("n_point_", i),
label = paste0("Legend Point ", i), value = 1)
})
})
# vector of legend names
name_bar <- reactive({
ncol <- as.integer(input$leg_names)
collect <- list(lapply(1:ncol, function(i) {
input[[paste("n_names_", i)]]
}))
names <- unlist(collect)
})
# vector of point types
point_bar <- reactive({
ncol <- as.integer(input$leg_point)
collect <- list(lapply(1:ncol, function(i) {
input[[paste("n_point_", i)]]
}))
names <- unlist(collect)
})
# bar plot
output$ubar_plot_1 <- renderPlot({
bar_plotu(
x = selectedVar(), horizontal = input$ubar_horiz, title = input$ubar_title, xlab = input$ubar_xlabel,
space = input$ubar_barspace, ylab = input$ubar_ylabel
)
})
output$ubar_plot_2 <- renderPlot({
bar_plotu(
x = selectedVar(), horizontal = input$ubar_horiz, color = colours_bar(),
border = borders_bar(), title = input$ubar_title, xlab = input$ubar_xlabel, labels = labels_bar(),
space = input$ubar_barspace, width = widths_bar(), ylab = input$ubar_ylabel
)
})
output$ubar_plot_3 <- renderPlot({
bar_plotu(
selectedVar(), input$ubar_horiz, colours_bar(),
borders_bar(), input$ubar_title, input$ubar_xlabel, labels_bar(),
input$ubar_barspace, widths_bar(), input$ubar_axes,
input$ubar_axislty, input$ubar_offset, input$ubar_ylabel
)
})
output$ubar_plot_4 <- renderPlot({
bar_plotu(
selectedVar(), input$ubar_horiz, colours_bar(),
borders_bar(), input$ubar_title, input$ubar_xlabel, labels_bar(),
input$ubar_barspace, widths_bar(), input$ubar_axes,
input$ubar_axislty, input$ubar_offset, input$ubar_ylabel,
leg = input$leg_yn, leg_x = input$leg_x, leg_y = input$leg_y, legend = name_bar(),
leg_point = point_bar(), leg_colour = colours_bar(), leg_boxtype = input$leg_boxtype,
leg_boxcol = input$leg_boxcol, leg_boxlty = input$leg_boxlty, leg_boxlwd = input$leg_boxlwd,
leg_boxborcol = input$leg_boxborcol, leg_boxxjust = input$leg_boxxjust, leg_boxyjust = input$leg_boxyjust,
leg_textcol = input$leg_textcol, leg_textfont = input$leg_textfont, leg_textcolumns = input$leg_textcolumns,
leg_texthoriz = input$leg_texthoriz, leg_title = input$leg_title,
leg_titlecol = input$leg_titlecol, leg_textadj = input$leg_textadj
)
})
output$ubar_plot_5 <- renderPlot({
bar_plotu(
selectedVar(), input$ubar_horiz, colours_bar(),
borders_bar(), input$ubar_title, input$ubar_xlabel, labels_bar(),
input$ubar_barspace, widths_bar(), input$ubar_axes,
input$ubar_axislty, input$ubar_offset, input$ubar_ylabel,
input$ubar_coltitle, input$ubar_colsub, input$ubar_colaxis,
input$ubar_collabel, input$ubar_fontmain, input$ubar_fontsub,
input$ubar_fontaxis, input$ubar_fontlab, input$ubar_cexmain,
input$ubar_cexsub, input$ubar_cexaxis, input$ubar_cexlab, input$leg_yn,
input$leg_x, input$leg_y, name_bar(), point_bar(), colours_bar(),
input$leg_boxtype, input$leg_boxcol,
input$leg_boxlty, input$leg_boxlwd, input$leg_boxborcol, input$leg_boxxjust,
input$leg_boxyjust, input$leg_textcol, input$leg_textfont, input$leg_textcolumns,
input$leg_texthoriz, input$leg_title, input$leg_titlecol, input$leg_textadj,
input$ubar_plottext, input$ubar_text_x_loc, input$ubar_text_y_loc,
input$ubar_textcolor, input$ubar_textfont, input$ubar_textsize,
input$ubar_mtextplot, input$ubar_mtext_side, input$ubar_mtext_line,
input$ubar_mtextadj, input$ubar_mtextcolor, input$ubar_mtextfont,
input$ubar_mtextsize
)
})
output$ubar_plot_final <- renderPlot({
bar_plotu(
selectedVar(), input$ubar_horiz, colours_bar(),
borders_bar(), input$ubar_title, input$ubar_xlabel, labels_bar(),
input$ubar_barspace, widths_bar(), input$ubar_axes,
input$ubar_axislty, input$ubar_offset, input$ubar_ylabel,
input$ubar_coltitle, input$ubar_colsub, input$ubar_colaxis,
input$ubar_collabel, input$ubar_fontmain, input$ubar_fontsub,
input$ubar_fontaxis, input$ubar_fontlab, input$ubar_cexmain,
input$ubar_cexsub, input$ubar_cexaxis, input$ubar_cexlab, input$leg_yn,
input$leg_x, input$leg_y, name_bar(), point_bar(), colours_bar(),
input$leg_boxtype, input$leg_boxcol,
input$leg_boxlty, input$leg_boxlwd, input$leg_boxborcol, input$leg_boxxjust,
input$leg_boxyjust, input$leg_textcol, input$leg_textfont, input$leg_textcolumns,
input$leg_texthoriz, input$leg_title, input$leg_titlecol, input$leg_textadj,
input$ubar_plottext, input$ubar_text_x_loc, input$ubar_text_y_loc,
input$ubar_textcolor, input$ubar_textfont, input$ubar_textsize,
input$ubar_mtextplot, input$ubar_mtext_side, input$ubar_mtext_line,
input$ubar_mtextadj, input$ubar_mtextcolor, input$ubar_mtextfont,
input$ubar_mtextsize
)
})
| /scratch/gouwar.j/cran-all/cranData/xplorerr/inst/app-visualize/logic/logic_bar.R |
source("helper/bbar-plot.R")
# update variable selection for bar plots
observe({
updateSelectInput(session, 'bar2_select_x', choices = names(data()))
updateSelectInput(session, 'bar2_select_y', choices = names(data()))
})
observeEvent(input$finalok, {
f_data <- final_split$train[, sapply(final_split$train, is.factor)]
# validate(need(!is.null(dim(f_data)), 'Please select two factor variables.'))
if (is.null(dim(f_data))) {
k <- final_split$train %>% map(is.factor) %>% unlist()
j <- names(which(k == TRUE))
fdata <- tibble::as_data_frame(f_data)
colnames(fdata) <- j
updateSelectInput(session, 'bar2_select_x',
choices = names(fdata), selected = names(fdata))
updateSelectInput(session, 'bar2_select_y',
choices = names(fdata), selected = names(fdata))
} else if (ncol(f_data) < 1) {
updateSelectInput(session, 'bar2_select_x',
choices = '', selected = '')
updateSelectInput(session, 'bar2_select_y',
choices = '', selected = '')
} else {
updateSelectInput(session, 'bar2_select_x', choices = names(f_data))
updateSelectInput(session, 'bar2_select_y', choices = names(f_data))
}
})
observeEvent(input$submit_part_train_per, {
f_data <- final_split$train[, sapply(final_split$train, is.factor)]
# validate(need(!is.null(dim(f_data)), 'Please select two factor variables.'))
if (is.null(dim(f_data))) {
k <- final_split$train %>% map(is.factor) %>% unlist()
j <- names(which(k == TRUE))
fdata <- tibble::as_data_frame(f_data)
colnames(fdata) <- j
updateSelectInput(session, 'bar2_select_x',
choices = names(fdata), selected = names(fdata))
updateSelectInput(session, 'bar2_select_y',
choices = names(fdata), selected = names(fdata))
} else if (ncol(f_data) < 1) {
updateSelectInput(session, 'bar2_select_x',
choices = '', selected = '')
updateSelectInput(session, 'bar2_select_y',
choices = '', selected = '')
} else {
updateSelectInput(session, 'bar2_select_x', choices = names(f_data))
updateSelectInput(session, 'bar2_select_y', choices = names(f_data))
}
})
# selected data
selected_x_bar2 <- reactive({
req(input$bar2_select_x)
bar_data <- final_split$train[, input$bar2_select_x]
})
selected_y_bar2 <- reactive({
req(input$bar2_select_y)
bar_data <- final_split$train[, input$bar2_select_y]
})
counts_bar2 <- reactive({
table(selected_x_bar2(), selected_y_bar2())
})
# dynamic UI for bar colors
output$ui_ncolbar2 <- renderUI({
ncol <- as.integer(input$ncolbar2)
if (ncol < 1) {
NULL
} else {
lapply(1:ncol, function(i) {
textInput(paste("n_bar2col_", i),
label = paste0("Bar ", i, " Color"),
value = 'blue')
})
}
})
colours_bar2 <- reactive({
ncol <- as.integer(input$ncolbar2)
if (ncol < 1) {
colors <- NULL
} else {
collect <- list(lapply(1:ncol, function(i) {
input[[paste("n_bar2col_", i)]]
}))
colors <- unlist(collect)
}
colors
})
# dynamic UI for bar border colors
output$ui_nborbar2 <- renderUI({
ncol <- as.integer(input$nborbar2)
if (ncol < 1) {
NULL
} else {
lapply(1:ncol, function(i) {
textInput(paste("n_bor2_", i),
label = paste0("Bar ", i, " Border Color"),
value = 'black')
})
}
})
borders_bar2 <- reactive({
ncol <- as.integer(input$nborbar2)
if (ncol < 1) {
colors <- NULL
} else {
collect <- list(lapply(1:ncol, function(i) {
input[[paste("n_bor2_", i)]]
}))
colors <- unlist(collect)
}
colors
})
# dynamic UI for bar labels
output$ui_nbarlabel2 <- renderUI({
ncol <- as.integer(input$nbarlabel2)
if (ncol < 1) {
NULL
} else {
lapply(1:ncol, function(i) {
textInput(paste("n_bar2label_", i),
label = paste0("Bar ", i, " Label"))
})
}
})
labels_bar2 <- reactive({
ncol <- as.integer(input$nbarlabel2)
if (ncol < 1) {
colors <- NULL
} else {
collect <- list(lapply(1:ncol, function(i) {
input[[paste("n_bar2label_", i)]]
}))
colors <- unlist(collect)
}
colors
})
# dynamic UI for bar width
output$ui_nbarwidth2 <- renderUI({
ncol <- as.integer(input$nbarwidth2)
if (ncol < 1) {
NULL
} else {
lapply(1:ncol, function(i) {
numericInput(paste("n_bar2width_", i),
label = paste0("Bar ", i, " Width"),
value = 1, min = 1)
})
}
})
widths_bar2 <- reactive({
ncol <- as.integer(input$nbarwidth2)
if (ncol < 1) {
colors <- NULL
} else {
collect <- list(lapply(1:ncol, function(i) {
input[[paste("n_bar2width_", i)]]
}))
colors <- unlist(collect)
}
colors
})
# dynamic UI for bar space
# output$ui_nbarspace2 <- renderUI({
# ncol <- as.integer(input$nbarspace2)
#
# lapply(1:ncol, function(i) {
# numericInput(paste("n_bar2space_", i),
# label = paste0("n_bar2space_", i),
# value = 0, min = 0, max = 2, step = 1)
# })
# })
#
# spaces_bar2 <- reactive({
# ncol <- as.integer(input$nbarspace2)
#
# collect <- list(lapply(1:ncol, function(i) {
# input[[paste("n_bar2space_", i)]]
# }))
#
# colors <- unlist(collect)
#
# })
# # dynamic UI for shading density
# output$ui_nbardensity2 <- renderUI({
# ncol <- as.integer(input$nbardensity2)
# lapply(1:ncol, function(i) {
# numericInput(paste("n_bar2density_", i),
# label = paste0("Bar ", i, " Density"),
# value = 1, min = 1)
# })
# })
# density_bar2 <- reactive({
# ncol <- as.integer(input$nbardensity2)
# collect <- list(lapply(1:ncol, function(i) {
# input[[paste("n_bar2density_", i)]]
# }))
# colors <- unlist(collect)
# })
# # dynamic UI for shading angle
# output$ui_nbarangle2 <- renderUI({
# ncol <- as.integer(input$nbarangle2)
# lapply(1:ncol, function(i) {
# numericInput(paste("n_bar2angle_", i),
# label = paste0("Bar ", i, " Shading Angle"),
# value = 1, min = 1)
# })
# })
# angle_bar2 <- reactive({
# ncol <- as.integer(input$nbarangle2)
# collect <- list(lapply(1:ncol, function(i) {
# input[[paste("n_bar2angle_", i)]]
# }))
# colors <- unlist(collect)
# })
# dynamic UI for legend names
output$ui_bar2_legnames <- renderUI({
ncol <- as.integer(input$bar2_legnames)
if (ncol < 1) {
NULL
} else {
lapply(1:ncol, function(i) {
textInput(paste("n_namesbar2_", i),
label = paste0("Legend Name ", i))
})
}
})
# dynamic UI for legend border
output$ui_bar2_legpoint <- renderUI({
ncol <- as.integer(input$bar2_leg_point)
if (ncol < 1) {
NULL
} else {
lapply(1:ncol, function(i) {
numericInput(paste("n_pointbar2_", i),
label = paste0("Legend Point ", i), value = 15)
})
}
})
# vector of legend names
name_bar2 <- reactive({
ncol <- as.integer(input$bar2_legnames)
if (ncol < 1) {
names <- NULL
} else {
collect <- list(lapply(1:ncol, function(i) {
input[[paste("n_namesbar2_", i)]]
}))
names <- unlist(collect)
}
names
})
# vector of point types
point_bar2 <- reactive({
ncol <- as.integer(input$bar2_leg_point)
if (ncol < 1) {
names <- NULL
} else {
collect <- list(lapply(1:ncol, function(i) {
input[[paste("n_pointbar2_", i)]]
}))
names <- unlist(collect)
}
names
})
output$bbar_plot_1 <- renderPlot({
barplot(height = counts_bar2(), horiz = as.logical(input$bar2_horiz),
beside = as.logical(input$bar2_beside), main = input$bar2_title,
xlab = input$bar2_xlabel, ylab = input$bar2_ylabel)
})
output$bbar_plot_2 <- renderPlot({
barplot(height = counts_bar2(), horiz = as.logical(input$bar2_horiz),
beside = as.logical(input$bar2_beside), main = input$bar2_title,
xlab = input$bar2_xlabel, ylab = input$bar2_ylabel,
col = colours_bar2(), border = borders_bar2(), width = widths_bar2(),
names.arg = labels_bar2())
})
output$bbar_plot_3 <- renderPlot({
barplot(height = counts_bar2(), horiz = as.logical(input$bar2_horiz),
beside = as.logical(input$bar2_beside), main = input$bar2_title,
xlab = input$bar2_xlabel, ylab = input$bar2_ylabel,
col = colours_bar2(), border = borders_bar2(), width = widths_bar2(),
names.arg = labels_bar2(), axes = input$bar2_axes, axis.lty = input$bar2_axislty,
offset = input$bar2_offset)
})
output$bbar_plot_4 <- renderPlot({
bar_plotb(
counts_bar2(), as.logical(input$bar2_horiz), colours_bar2(),
borders_bar2(), besides = as.logical(input$bar2_beside),
title = input$bar2_title, xlab = input$bar2_xlabel,
labels_bar2(), width = widths_bar2(), axes = input$bar2_axes, axislty = input$bar2_axislty,
offset = input$bar2_offset, ylab = input$bar2_ylabel,
leg = as.logical(input$bar2_leg_yn), leg_x = input$bar2_leg_x,
leg_y = input$bar2_leg_y, legend = name_bar2(),
leg_point = point_bar2(), leg_colour = colours_bar2(),
leg_boxtype = input$bar2_leg_boxtype,
leg_boxcol = input$bar2_leg_boxcol,
leg_boxlty = input$bar2_leg_boxlty,
leg_boxlwd = input$bar2_leg_boxlwd,
leg_boxborcol = input$bar2_leg_boxborcol,
leg_boxxjust = input$bar2_leg_boxxjust,
leg_boxyjust = input$bar2_leg_boxyjust,
leg_textcol = input$bar2_leg_textcol,
leg_textfont = input$bar2_leg_textfont,
leg_textcolumns = input$bar2_leg_textcolumns,
leg_texthoriz = input$bar2_leg_texthoriz,
leg_title = input$bar2_leg_title,
leg_titlecol = input$bar2_leg_titlecol,
leg_textadj = input$bar2_leg_textadj)
})
output$bbar_plot_5 <- renderPlot({
bar_plotb(
counts_bar2(), as.logical(input$bar2_horiz), colours_bar2(),
borders_bar2(), besides = as.logical(input$bar2_beside),
title = input$bar2_title, xlab = input$bar2_xlabel,
labels_bar2(), width = widths_bar2(), axes = input$bar2_axes, axislty = input$bar2_axislty,
offset = input$bar2_offset, ylab = input$bar2_ylabel,
leg = as.logical(input$bar2_leg_yn), leg_x = input$bar2_leg_x,
leg_y = input$bar2_leg_y, legend = name_bar2(),
leg_point = point_bar2(), leg_colour = colours_bar2(),
leg_boxtype = input$bar2_leg_boxtype,
leg_boxcol = input$bar2_leg_boxcol,
leg_boxlty = input$bar2_leg_boxlty,
leg_boxlwd = input$bar2_leg_boxlwd,
leg_boxborcol = input$bar2_leg_boxborcol,
leg_boxxjust = input$bar2_leg_boxxjust,
leg_boxyjust = input$bar2_leg_boxyjust,
leg_textcol = input$bar2_leg_textcol,
leg_textfont = input$bar2_leg_textfont,
leg_textcolumns = input$bar2_leg_textcolumns,
leg_texthoriz = input$bar2_leg_texthoriz,
leg_title = input$bar2_leg_title,
leg_titlecol = input$bar2_leg_titlecol,
leg_textadj = input$bar2_leg_textadj,
colmain = input$bar2_coltitle,
colaxis = input$bar2_colaxis, collab = input$bar2_collabel,
cexmain = input$bar2_cexmain,
cexaxis = input$bar2_cexaxis, cexlab = input$bar2_cexlab,
fontmain = input$bar2_fontmain,
fontaxis = input$bar2_fontaxis, fontlab = input$bar2_fontlab,
text_p = input$bar2_plottext, text_x_loc = input$bar2_text_x_loc,
text_y_loc = input$bar2_text_y_loc,
text_col = input$bar2_textcolor, text_font = input$bar2_textfont,
text_size = input$bar2_textsize,
m_text = input$bar2_mtextplot, m_side = input$bar2_mtext_side,
m_line = input$bar2_mtext_line,
m_adj = input$bar2_mtextadj, m_col = input$bar2_mtextcolor,
m_font = input$bar2_mtextfont, m_cex = input$bar2_mtextsize
)
})
output$bbar_plot_final <- renderPlot({
bar_plotb(
counts_bar2(), as.logical(input$bar2_horiz), colours_bar2(),
borders_bar2(), besides = as.logical(input$bar2_beside),
title = input$bar2_title, xlab = input$bar2_xlabel,
labels_bar2(), width = widths_bar2(), axes = input$bar2_axes, axislty = input$bar2_axislty,
offset = input$bar2_offset, ylab = input$bar2_ylabel,
leg = as.logical(input$bar2_leg_yn), leg_x = input$bar2_leg_x,
leg_y = input$bar2_leg_y, legend = name_bar2(),
leg_point = point_bar2(), leg_colour = colours_bar2(),
leg_boxtype = input$bar2_leg_boxtype,
leg_boxcol = input$bar2_leg_boxcol,
leg_boxlty = input$bar2_leg_boxlty,
leg_boxlwd = input$bar2_leg_boxlwd,
leg_boxborcol = input$bar2_leg_boxborcol,
leg_boxxjust = input$bar2_leg_boxxjust,
leg_boxyjust = input$bar2_leg_boxyjust,
leg_textcol = input$bar2_leg_textcol,
leg_textfont = input$bar2_leg_textfont,
leg_textcolumns = input$bar2_leg_textcolumns,
leg_texthoriz = input$bar2_leg_texthoriz,
leg_title = input$bar2_leg_title,
leg_titlecol = input$bar2_leg_titlecol,
leg_textadj = input$bar2_leg_textadj,
colmain = input$bar2_coltitle,
colaxis = input$bar2_colaxis, collab = input$bar2_collabel,
cexmain = input$bar2_cexmain,
cexaxis = input$bar2_cexaxis, cexlab = input$bar2_cexlab,
fontmain = input$bar2_fontmain,
fontaxis = input$bar2_fontaxis, fontlab = input$bar2_fontlab,
text_p = input$bar2_plottext, text_x_loc = input$bar2_text_x_loc,
text_y_loc = input$bar2_text_y_loc,
text_col = input$bar2_textcolor, text_font = input$bar2_textfont,
text_size = input$bar2_textsize,
m_text = input$bar2_mtextplot, m_side = input$bar2_mtext_side,
m_line = input$bar2_mtext_line,
m_adj = input$bar2_mtextadj, m_col = input$bar2_mtextcolor,
m_font = input$bar2_mtextfont, m_cex = input$bar2_mtextsize
)
})
| /scratch/gouwar.j/cran-all/cranData/xplorerr/inst/app-visualize/logic/logic_bar2.R |
source('helper/barly1.R')
source('helper/bobar.R')
source('helper/unibar.R')
observeEvent(input$finalok, {
f_data <- final_split$train[, sapply(final_split$train, is.factor)]
# validate(need(!dim(f_data)[2] == 0, 'No factor variables in the data.'))
if (is.null(dim(f_data))) {
k <- final_split$train %>% map(is.factor) %>% unlist()
j <- names(which(k == TRUE))
fdata <- tibble::as_data_frame(f_data)
colnames(fdata) <- j
updateSelectInput(session, 'barly1_select_x',
choices = names(fdata), selected = names(fdata))
updateSelectInput(session, 'bobar1_select_x',
choices = names(fdata), selected = names(fdata))
updateSelectInput(session, 'hibar1_select_x',
choices = names(fdata), selected = names(fdata))
} else if (dim(f_data)[2] == 0) {
updateSelectInput(session, 'barly1_select_x', choices = '', selected = '')
updateSelectInput(session, 'bobar1_select_x', choices = '', selected = '')
updateSelectInput(session, 'hibar1_select_x', choices = '', selected = '')
} else {
updateSelectInput(session, 'barly1_select_x', choices = names(f_data))
updateSelectInput(session, 'bobar1_select_x', choices = names(f_data))
updateSelectInput(session, 'hibar1_select_x', choices = names(f_data))
}
})
observeEvent(input$submit_part_train_per, {
f_data <- final_split$train[, sapply(final_split$train, is.factor)]
# validate(need(!dim(f_data)[2] == 0, 'No factor variables in the data.'))
if (is.null(dim(f_data))) {
k <- final_split$train %>% map(is.factor) %>% unlist()
j <- names(which(k == TRUE))
fdata <- tibble::as_data_frame(f_data)
colnames(fdata) <- j
updateSelectInput(session, 'barly1_select_x',
choices = names(fdata), selected = names(fdata))
updateSelectInput(session, 'bobar1_select_x',
choices = names(fdata), selected = names(fdata))
updateSelectInput(session, 'hibar1_select_x',
choices = names(fdata), selected = names(fdata))
} else if (dim(f_data)[2] == 0) {
updateSelectInput(session, 'barly1_select_x', choices = '', selected = '')
updateSelectInput(session, 'bobar1_select_x', choices = '', selected = '')
updateSelectInput(session, 'hibar1_select_x', choices = '', selected = '')
} else {
updateSelectInput(session, 'barly1_select_x', choices = names(f_data))
updateSelectInput(session, 'bobar1_select_x', choices = names(f_data))
updateSelectInput(session, 'hibar1_select_x', choices = names(f_data))
}
})
output$barly1_plot_1 <- plotly::renderPlotly({
barly1(data = final_split$train, x_data = input$barly1_select_x,
title = input$barly1_title, x_title = input$barly1_xlabel,
y_title = input$barly1_ylabel, bar_col = input$barly1_color,
b_text = input$barly1_btext)
})
output$bobar1_plot_1 <- rbokeh::renderRbokeh({
bobar(data = final_split$train, x_data = input$bobar1_select_x,
fig_title = input$bobar1_title, x_lab = input$bobar1_xlabel,
y_lab = input$bobar1_ylabel, x_grid = input$bobar1_xgrid,
y_grid = input$bobar1_ygrid, bar_width = input$bobar1_width,
bar_hover = input$bobar1_hover, bar_col = input$bobar1_color,
bar_f_alpha = input$bobar1_alpha, bar_l_col = input$bobar1_lcolor,
bar_l_alpha = input$bobar1_lalpha)
})
output$hibar1_plot_1 <- highcharter::renderHighchart({
highbar(data = final_split$train, column = input$hibar1_select_x,
title = input$hibar1_title, name = input$hibar1_xlabel)
})
| /scratch/gouwar.j/cran-all/cranData/xplorerr/inst/app-visualize/logic/logic_bar_plot_1.R |
source('helper/barly2.R')
source('helper/bobar2.R')
source('helper/bibar.R')
observeEvent(input$finalok, {
f_data <- final_split$train[, sapply(final_split$train, is.factor)]
# validate(need(!dim(f_data)[2] == 0, 'No factor variables in the data.'))
if (is.null(dim(f_data))) {
k <- final_split$train %>% map(is.factor) %>% unlist()
j <- names(which(k == TRUE))
fdata <- tibble::as_data_frame(f_data)
colnames(fdata) <- j
updateSelectInput(session, 'barly2_select_x',
choices = names(fdata), selected = names(fdata))
updateSelectInput(session, 'barly2_select_y',
choices = names(fdata), selected = names(fdata))
updateSelectInput(session, 'bobar2_select_x',
choices = names(fdata), selected = names(fdata))
updateSelectInput(session, 'bobar2_select_y',
choices = names(fdata), selected = names(fdata))
updateSelectInput(session, 'hibar2_select_x',
choices = names(fdata), selected = names(fdata))
updateSelectInput(session, 'hibar2_select_y',
choices = names(fdata), selected = names(fdata))
} else if (dim(f_data)[2] == 0) {
updateSelectInput(session, 'barly2_select_x', choices = '', selected = '')
updateSelectInput(session, 'barly2_select_y', choices = '', selected = '')
updateSelectInput(session, 'bobar2_select_x', choices = '', selected = '')
updateSelectInput(session, 'bobar2_select_y', choices = '', selected = '')
updateSelectInput(session, 'hibar2_select_x', choices = '', selected = '')
updateSelectInput(session, 'hibar2_select_y', choices = '', selected = '')
} else {
updateSelectInput(session, 'barly2_select_x', choices = names(f_data))
updateSelectInput(session, 'barly2_select_y', choices = names(f_data))
updateSelectInput(session, 'bobar2_select_x', choices = names(f_data))
updateSelectInput(session, 'bobar2_select_y', choices = names(f_data))
updateSelectInput(session, 'hibar2_select_x', choices = names(f_data))
updateSelectInput(session, 'hibar2_select_y', choices = names(f_data))
}
})
observeEvent(input$submit_part_train_per, {
f_data <- final_split$train[, sapply(final_split$train, is.factor)]
# validate(need(!dim(f_data)[2] == 0, 'No factor variables in the data.'))
if (is.null(dim(f_data))) {
k <- final_split$train %>% map(is.factor) %>% unlist()
j <- names(which(k == TRUE))
fdata <- tibble::as_data_frame(f_data)
colnames(fdata) <- j
updateSelectInput(session, 'barly2_select_x',
choices = names(fdata), selected = names(fdata))
updateSelectInput(session, 'barly2_select_y',
choices = names(fdata), selected = names(fdata))
updateSelectInput(session, 'bobar2_select_x',
choices = names(fdata), selected = names(fdata))
updateSelectInput(session, 'bobar2_select_y',
choices = names(fdata), selected = names(fdata))
updateSelectInput(session, 'hibar2_select_x',
choices = names(fdata), selected = names(fdata))
updateSelectInput(session, 'hibar2_select_y',
choices = names(fdata), selected = names(fdata))
} else if (dim(f_data)[2] == 0) {
updateSelectInput(session, 'barly2_select_x', choices = '', selected = '')
updateSelectInput(session, 'barly2_select_y', choices = '', selected = '')
updateSelectInput(session, 'bobar2_select_x', choices = '', selected = '')
updateSelectInput(session, 'bobar2_select_y', choices = '', selected = '')
updateSelectInput(session, 'hibar2_select_x', choices = '', selected = '')
updateSelectInput(session, 'hibar2_select_y', choices = '', selected = '')
} else {
updateSelectInput(session, 'barly2_select_x', choices = names(f_data))
updateSelectInput(session, 'barly2_select_y', choices = names(f_data))
updateSelectInput(session, 'bobar2_select_x', choices = names(f_data))
updateSelectInput(session, 'bobar2_select_y', choices = names(f_data))
updateSelectInput(session, 'hibar2_select_x', choices = names(f_data))
updateSelectInput(session, 'hibar2_select_y', choices = names(f_data))
}
})
output$barly2_plot_1 <- plotly::renderPlotly({
barly2(data = final_split$train, x = input$barly2_select_x,
y = input$barly2_select_y, title = input$barly2_title,
x_title = input$barly2_xlabel, y_title = input$barly2_ylabel)
})
output$bobar2_plot_1 <- rbokeh::renderRbokeh({
bobar2(data = final_split$train, var_1 = input$bobar2_select_x,
var_2 = input$bobar2_select_y, fig_title = input$bobar2_title,
x_lab = input$bobar2_xlabel, y_lab = input$bobar2_ylabel,
x_grid = input$bobar2_xgrid, y_grid = input$bobar2_ygrid,
legend_loc = input$bobar2_legloc, bar_pos = input$bobar2_type,
bar_hover = input$bobar2_hover, bar_width = input$bobar2_width,
bar_f_alpha = input$bobar2_alpha)
})
output$hibar2_plot_1 <- highcharter::renderHighchart({
bibar(data = final_split$train, x = input$hibar2_select_x,
y = input$hibar2_select_y, horizontal = input$hibar2_horiz,
stacked = input$hibar2_stack)
})
| /scratch/gouwar.j/cran-all/cranData/xplorerr/inst/app-visualize/logic/logic_bar_plot_2.R |
library(shiny)
source("helper/ubox-plot.R")
# update variable selection for bar plots
observe({
updateSelectInput(session, 'ubox_select', choices = names(data()))
})
observeEvent(input$finalok, {
num_data <- final_split$train[, sapply(final_split$train, is.numeric)]
if (is.null(dim(num_data))) {
k <- final_split$train %>% map(is.numeric) %>% unlist()
j <- names(which(k == TRUE))
numdata <- tibble::as_data_frame(num_data)
colnames(numdata) <- j
updateSelectInput(session, 'ubox_select',
choices = names(numdata), selected = names(numdata))
} else if (ncol(num_data) < 1) {
updateSelectInput(session, 'ubox_select',
choices = '', selected = '')
} else {
updateSelectInput(session, 'ubox_select', choices = names(num_data))
}
})
observeEvent(input$submit_part_train_per, {
num_data <- final_split$train[, sapply(final_split$train, is.numeric)]
if (is.null(dim(num_data))) {
k <- final_split$train %>% map(is.numeric) %>% unlist()
j <- names(which(k == TRUE))
numdata <- tibble::as_data_frame(num_data)
colnames(numdata) <- j
updateSelectInput(session, 'ubox_select',
choices = names(numdata), selected = names(numdata))
} else if (ncol(num_data) < 1) {
updateSelectInput(session, 'ubox_select',
choices = '', selected = '')
} else {
updateSelectInput(session, 'ubox_select', choices = names(num_data))
}
})
# selected data
ubox_data <- reactive({
req(input$ubox_select)
box_data <- final_split$train[, input$ubox_select]
})
# bar plot*
output$ubox_plot_1 <- renderPlot({
box_plotu(ubox_data(), input$ubox_title, input$ubox_xlabel, input$ubox_ylabel,
input$ubox_colour, input$ubox_borcolour)
})
output$ubox_plot_2 <- renderPlot({
box_plotu(ubox_data(), input$ubox_title, input$ubox_xlabel, input$ubox_ylabel,
input$ubox_colour, input$ubox_borcolour, as.logical(input$ubox_horiz),
as.logical(input$ubox_notch), input$ubox_range,
as.logical(input$ubox_outline), as.logical(input$ubox_varwidth))
})
output$ubox_plot_3 <- renderPlot({
box_plotu(ubox_data(), input$ubox_title, input$ubox_xlabel, input$ubox_ylabel,
input$ubox_colour, input$ubox_borcolour, as.logical(input$ubox_horiz),
as.logical(input$ubox_notch), input$ubox_range,
as.logical(input$ubox_outline), as.logical(input$ubox_varwidth),
text_p = input$ubox_plottext, text_x_loc = input$ubox_text_x_loc, text_y_loc =
input$ubox_text_y_loc, text_col = input$ubox_textcolor, text_font = input$ubox_textfont,
text_size = input$ubox_textsize, m_text = input$ubox_mtextplot, m_side = input$ubox_mtext_side,
m_line = input$ubox_mtext_line, m_adj = input$ubox_mtextadj, m_col = input$ubox_mtextcolor,
m_font = input$ubox_mtextfont, m_cex = input$ubox_mtextsize)
})
# bar plot
output$ubox_plot_4 <- renderPlot({
box_plotu(
ubox_data(), input$ubox_title, input$ubox_xlabel, input$ubox_ylabel,
input$ubox_colour, input$ubox_borcolour, as.logical(input$ubox_horiz),
as.logical(input$ubox_notch), input$ubox_range,
as.logical(input$ubox_outline), as.logical(input$ubox_varwidth),
input$ubox_coltitle, input$ubox_colsub, input$ubox_colaxis,
input$ubox_collabel, input$ubox_fontmain, input$ubox_fontsub,
input$ubox_fontaxis, input$ubox_fontlab, input$ubox_cexmain,
input$ubox_cexsub, input$ubox_cexaxis, input$ubox_cexlab,
text_p = input$ubox_plottext, text_x_loc = input$ubox_text_x_loc, text_y_loc =
input$ubox_text_y_loc, text_col = input$ubox_textcolor, text_font = input$ubox_textfont,
text_size = input$ubox_textsize, m_text = input$ubox_mtextplot, m_side = input$ubox_mtext_side,
m_line = input$ubox_mtext_line, m_adj = input$ubox_mtextadj, m_col = input$ubox_mtextcolor,
m_font = input$ubox_mtextfont, m_cex = input$ubox_mtextsize
)
})
# bar plot
output$ubox_plot_final <- renderPlot({
box_plotu(
ubox_data(), input$ubox_title, input$ubox_xlabel, input$ubox_ylabel,
input$ubox_colour, input$ubox_borcolour, as.logical(input$ubox_horiz),
as.logical(input$ubox_notch), input$ubox_range,
as.logical(input$ubox_outline), as.logical(input$ubox_varwidth),
input$ubox_coltitle, input$ubox_colsub, input$ubox_colaxis,
input$ubox_collabel, input$ubox_fontmain, input$ubox_fontsub,
input$ubox_fontaxis, input$ubox_fontlab, input$ubox_cexmain,
input$ubox_cexsub, input$ubox_cexaxis, input$ubox_cexlab,
text_p = input$ubox_plottext, text_x_loc = input$ubox_text_x_loc, text_y_loc =
input$ubox_text_y_loc, text_col = input$ubox_textcolor, text_font = input$ubox_textfont,
text_size = input$ubox_textsize, m_text = input$ubox_mtextplot, m_side = input$ubox_mtext_side,
m_line = input$ubox_mtext_line, m_adj = input$ubox_mtextadj, m_col = input$ubox_mtextcolor,
m_font = input$ubox_mtextfont, m_cex = input$ubox_mtextsize
)
})
# plot download
# output$box_downloadGraph <- downloadHandler(
# filename <- function() {
# paste(input$box_fileName, ".png")
# },
# content <- function(file) {
# png(file)
# plot <- box_plot(
# box_plotu(
# selectedVar(),
# input$box_col, input$box_bordercol, input$box_title,
# input$box_subtitle, input$box_xlabel, input$box_ylabel,
# input$box_coltitle, input$box_colsub, input$box_colaxis,
# input$box_collabel, input$box_fontmain, input$box_fontsub,
# input$box_fontaxis, input$box_fontlab, input$box_cexmain,
# input$box_cexsub, input$box_cexaxis, input$box_cexlab,
# input$box_plottext, input$box_text_x_loc, input$box_text_y_loc,
# input$box_textcolor, input$box_textfont, input$box_textsize,
# input$box_mtextplot, input$box_mtext_side, input$box_mtext_line,
# input$box_mtextadj, input$box_mtextcolor, input$box_mtextfont,
# input$box_mtextsize
# )
# )
# print(plot)
# dev.off()
# }
# )
| /scratch/gouwar.j/cran-all/cranData/xplorerr/inst/app-visualize/logic/logic_box.R |
library(shiny)
source("helper/bbox-plot.R")
# update variable selection for bar plots
observe({
updateSelectInput(session, 'bbox_select_x', choices = names(filt_data$p))
updateSelectInput(session, 'bbox_select_y', choices = names(filt_data$p))
})
observeEvent(input$finalok, {
num_data <- final_split$train[, sapply(final_split$train, is.numeric)]
f_data <- final_split$train[, sapply(final_split$train, is.factor)]
if (is.null(dim(f_data))) {
k <- final_split$train %>% map(is.factor) %>% unlist()
j <- names(which(k == TRUE))
fdata <- tibble::as_data_frame(f_data)
colnames(fdata) <- j
updateSelectInput(session, inputId = "bbox_select_x",
choices = names(fdata))
} else {
updateSelectInput(session, 'bbox_select_x', choices = names(f_data))
}
if (is.null(dim(num_data))) {
k <- final_split$train %>% map(is.numeric) %>% unlist()
j <- names(which(k == TRUE))
numdata <- tibble::as_data_frame(num_data)
colnames(numdata) <- j
updateSelectInput(session, 'bbox_select_y',
choices = names(numdata), selected = names(numdata))
} else if (ncol(num_data) < 1) {
updateSelectInput(session, 'bbox_select_y',
choices = '', selected = '')
} else {
updateSelectInput(session, 'bbox_select_y', choices = names(num_data))
}
})
observeEvent(input$submit_part_train_per, {
num_data <- final_split$train[, sapply(final_split$train, is.numeric)]
f_data <- final_split$train[, sapply(final_split$train, is.factor)]
if (is.null(dim(f_data))) {
k <- final_split$train %>% map(is.factor) %>% unlist()
j <- names(which(k == TRUE))
fdata <- tibble::as_data_frame(f_data)
colnames(fdata) <- j
updateSelectInput(session, inputId = "bbox_select_x",
choices = names(fdata))
} else {
updateSelectInput(session, 'bbox_select_x', choices = names(f_data))
}
if (is.null(dim(num_data))) {
k <- final_split$train %>% map(is.numeric) %>% unlist()
j <- names(which(k == TRUE))
numdata <- tibble::as_data_frame(num_data)
colnames(numdata) <- j
updateSelectInput(session, 'bbox_select_y',
choices = names(numdata), selected = names(numdata))
} else if (ncol(num_data) < 1) {
updateSelectInput(session, 'bbox_select_y',
choices = '', selected = '')
} else {
updateSelectInput(session, 'bbox_select_y', choices = names(num_data))
}
})
f_split <- reactiveValues(num_data = NULL)
num_data1 <- eventReactive(input$button_split_no, {
numdata <- final_split$train[, sapply(final_split$train, is.factor)]
if (is.factor(numdata)) {
out <- 1
} else {
out <- ncol(numdata)
}
out
})
num_data2 <- eventReactive(input$submit_part_train_per, {
numdata <- final_split$train[, sapply(final_split$train, is.factor)]
if (is.factor(numdata)) {
out <- 1
} else {
out <- ncol(numdata)
}
out
})
observeEvent(input$button_split_no, {
f_split$num_data <- num_data1()
})
observeEvent(input$submit_part_train_per, {
f_split$num_data <- num_data2()
})
# selected data
bbox_x <- eventReactive(input$box2_create, {
# req(input$bbox_select_x)
if (f_split$num_data > 0) {
box_data <- final_split$train[, input$bbox_select_x]
} else {
box_data <- NULL
}
box_data
})
bbox_y <- eventReactive(input$box2_create, {
# req(input$bbox_select_y)
box_data <- final_split$train[, input$bbox_select_y]
})
n_labels <- eventReactive(input$box2_create, {
if (!is.null(bbox_x())) {
k <- nlevels(bbox_x())
}
k
})
observeEvent(input$box2_create, {
# req(input$bbox_select_x)
if (!is.null(bbox_x())) {
updateNumericInput(session, 'nbox2label', value = n_labels())
}
})
# dynamic UI for histogram colors
output$ui_ncolbox2 <- renderUI({
ncol <- as.integer(input$ncolbox2)
lapply(1:ncol, function(i) {
textInput(paste("n_box2col_", i), label = paste0("Box Color ", i),
value = 'blue')
})
})
colours_box2 <- reactive({
ncol <- as.integer(input$ncolbox2)
collect <- list(lapply(1:ncol, function(i) {
input[[paste("n_box2col_", i)]]
}))
colors <- unlist(collect)
})
# dynamic UI for histogram border colors
output$ui_nborbox2 <- renderUI({
ncol <- as.integer(input$nborbox2)
lapply(1:ncol, function(i) {
textInput(paste("n_box2bor_", i), label = paste0("Border Color ", i),
value = 'black')
})
})
borders_box2 <- reactive({
ncol <- as.integer(input$nborbox2)
collect <- list(lapply(1:ncol, function(i) {
input[[paste("n_box2bor_", i)]]
}))
colors <- unlist(collect)
})
output$ui_nbox2label <- renderUI({
ncol <- as.integer(input$nbox2label)
if (ncol < 1) {
NULL
} else {
lapply(1:ncol, function(i) {
textInput(paste("n_box2label_", i),
label = paste0("Label ", i))
})
}
})
labels_box2 <- reactive({
ncol <- as.integer(input$nbox2label)
if (ncol < 1) {
colors <- NULL
} else {
collect <- list(lapply(1:ncol, function(i) {
input[[paste("n_box2label_", i)]]
}))
colors <- unlist(collect)
}
colors
})
output$ui_box2_legnames <- renderUI({
ncol <- as.integer(input$box2_legnames)
if (ncol < 1) {
NULL
} else {
lapply(1:ncol, function(i) {
textInput(paste("n_legnamesbox2_", i),
label = paste0("Legend Name ", i))
})
}
})
output$ui_box2_legpoint <- renderUI({
ncol <- as.integer(input$box2_leg_point)
if (ncol < 1) {
NULL
} else {
lapply(1:ncol, function(i) {
numericInput(paste("n_pointbox2_", i),
label = paste0("Legend Point ", i), value = 15)
})
}
})
name_box2 <- reactive({
ncol <- as.integer(input$box2_legnames)
if (ncol < 1) {
colors <- NULL
} else {
collect <- list(lapply(1:ncol, function(i) {
input[[paste("n_legnamesbox2_", i)]]
}))
colors <- unlist(collect)
}
colors
})
point_box2 <- reactive({
ncol <- as.integer(input$box2_leg_point)
if (ncol < 1) {
colors <- NULL
} else {
collect <- list(lapply(1:ncol, function(i) {
input[[paste("n_pointbox2_", i)]]
}))
colors <- unlist(collect)
}
colors
})
# bar plot
output$bbox_plot_1 <- renderPlot({
if (!is.null(bbox_x())) {
box_plotb(bbox_x(), bbox_y(), title = input$bbox_title, subs = input$bbox_subtitle,
xlabel = input$bbox_xlabel, ylabel = input$bbox_ylabel)
}
})
output$bbox_plot_2 <- renderPlot({
box_plotb(bbox_x(), bbox_y(), title = input$bbox_title, subs = input$bbox_subtitle,
xlabel = input$bbox_xlabel, ylabel = input$bbox_ylabel, horiz = as.logical(input$bbox_horiz),
notches = as.logical(input$bbox_notch), ranges = input$bbox_range, outlines = as.logical(input$bbox_outline),
varwidths = as.logical(input$bbox_varwidth))
})
output$bbox_plot_3 <- renderPlot({
box_plotb(bbox_x(), bbox_y(), title = input$bbox_title, subs = input$bbox_subtitle,
xlabel = input$bbox_xlabel, ylabel = input$bbox_ylabel, horiz = as.logical(input$bbox_horiz),
notches = as.logical(input$bbox_notch), ranges = input$bbox_range, outlines = as.logical(input$bbox_outline),
varwidths = as.logical(input$bbox_varwidth), color = colours_box2(), borders = borders_box2(),
labels = labels_box2())
})
# bar plot
output$bbox_plot_5 <- renderPlot({
box_plotb(
bbox_x(), bbox_y(), title = input$bbox_title, subs = input$bbox_subtitle,
xlabel = input$bbox_xlabel, ylabel = input$bbox_ylabel, horiz = as.logical(input$bbox_horiz),
notches = as.logical(input$bbox_notch), ranges = input$bbox_range, outlines = as.logical(input$bbox_outline),
varwidths = as.logical(input$bbox_varwidth), color = colours_box2(), borders = borders_box2(),
text_p = input$bbox_plottext, text_x_loc = input$bbox_text_x_loc,
text_y_loc = input$bbox_text_y_loc, text_col = input$bbox_textcolor, text_font = input$bbox_textfont,
text_size = input$bbox_textsize, m_text = input$bbox_mtextplot, m_side = input$bbox_mtext_side,
m_line = input$bbox_mtext_line, m_adj = input$bbox_mtextadj, m_col = input$bbox_mtextcolor,
m_font = input$bbox_mtextfont, m_cex = input$bbox_mtextsize
)
})
# bar plot
output$bbox_plot_6 <- renderPlot({
box_plotb(
bbox_x(), bbox_y(), title = input$bbox_title, subs = input$bbox_subtitle,
xlabel = input$bbox_xlabel, ylabel = input$bbox_ylabel, horiz = as.logical(input$bbox_horiz),
notches = as.logical(input$bbox_notch), ranges = input$bbox_range, outlines = as.logical(input$bbox_outline),
varwidths = as.logical(input$bbox_varwidth), color = colours_box2(), borders = borders_box2(),
labels = labels_box2(), input$bbox_coltitle, input$bbox_colsub, input$bbox_colaxis,
input$bbox_collabel, fontmain = input$bbox_fontmain, fontsub = input$bbox_fontsub,
fontaxis = input$bbox_fontaxis, fontlab = input$bbox_fontlab, input$bbox_cexmain,
input$bbox_cexsub, input$bbox_cexaxis, input$bbox_cexlab,
text_p = input$bbox_plottext, text_x_loc = input$bbox_text_x_loc,
text_y_loc = input$bbox_text_y_loc, text_col = input$bbox_textcolor, text_font = input$bbox_textfont,
text_size = input$bbox_textsize, m_text = input$bbox_mtextplot, m_side = input$bbox_mtext_side,
m_line = input$bbox_mtext_line, m_adj = input$bbox_mtextadj, m_col = input$bbox_mtextcolor,
m_font = input$bbox_mtextfont, m_cex = input$bbox_mtextsize
)
})
# bar plot
output$bbox_plot_final <- renderPlot({
box_plotb(
bbox_x(), bbox_y(), title = input$bbox_title, subs = input$bbox_subtitle,
xlabel = input$bbox_xlabel, ylabel = input$bbox_ylabel, horiz = as.logical(input$bbox_horiz),
notches = as.logical(input$bbox_notch), ranges = input$bbox_range, outlines = as.logical(input$bbox_outline),
varwidths = as.logical(input$bbox_varwidth), color = colours_box2(), borders = borders_box2(),
labels = labels_box2(), input$bbox_coltitle, input$bbox_colsub, input$bbox_colaxis,
input$bbox_collabel, fontmain = input$bbox_fontmain, fontsub = input$bbox_fontsub,
fontaxis = input$bbox_fontaxis, fontlab = input$bbox_fontlab, input$bbox_cexmain,
input$bbox_cexsub, input$bbox_cexaxis, input$bbox_cexlab,
text_p = input$bbox_plottext, text_x_loc = input$bbox_text_x_loc,
text_y_loc = input$bbox_text_y_loc, text_col = input$bbox_textcolor, text_font = input$bbox_textfont,
text_size = input$bbox_textsize, m_text = input$bbox_mtextplot, m_side = input$bbox_mtext_side,
m_line = input$bbox_mtext_line, m_adj = input$bbox_mtextadj, m_col = input$bbox_mtextcolor,
m_font = input$bbox_mtextfont, m_cex = input$bbox_mtextsize
)
})
# plot download
# output$box_downloadGraph <- downloadHandler(
# filename <- function() {
# paste(input$box_fileName, ".png")
# },
# content <- function(file) {
# png(file)
# plot <- box_plot(
# box_plotu(
# selectedVar(),
# input$box_col, input$box_bordercol, input$box_title,
# input$box_subtitle, input$box_xlabel, input$box_ylabel,
# input$box_coltitle, input$box_colsub, input$box_colaxis,
# input$box_collabel, input$box_fontmain, input$box_fontsub,
# input$box_fontaxis, input$box_fontlab, input$box_cexmain,
# input$box_cexsub, input$box_cexaxis, input$box_cexlab,
# input$box_plottext, input$box_text_x_loc, input$box_text_y_loc,
# input$box_textcolor, input$box_textfont, input$box_textsize,
# input$box_mtextplot, input$box_mtext_side, input$box_mtext_line,
# input$box_mtextadj, input$box_mtextcolor, input$box_mtextfont,
# input$box_mtextsize
# )
# )
# print(plot)
# dev.off()
# }
# )
| /scratch/gouwar.j/cran-all/cranData/xplorerr/inst/app-visualize/logic/logic_box2.R |
source('helper/boxly1.R')
source('helper/bobox.R')
observeEvent(input$finalok, {
num_data <- final_split$train[, sapply(final_split$train, is.numeric)]
if (is.null(dim(num_data))) {
k <- final_split$train %>% map(is.numeric) %>% unlist()
j <- names(which(k == TRUE))
numdata <- tibble::as_data_frame(num_data)
colnames(numdata) <- j
updateSelectInput(session, 'boxly1_select_x',
choices = names(numdata), selected = names(numdata))
updateSelectInput(session, 'bobox1_select_x',
choices = names(numdata), selected = names(numdata))
} else if (ncol(num_data) < 1) {
updateSelectInput(session, 'boxly1_select_x',
choices = '', selected = '')
updateSelectInput(session, 'bobox1_select_x',
choices = '', selected = '')
} else {
updateSelectInput(session, 'boxly1_select_x', choices = names(num_data))
updateSelectInput(session, 'bobox1_select_x', choices = names(num_data))
}
})
observeEvent(input$submit_part_train_per, {
num_data <- final_split$train[, sapply(final_split$train, is.numeric)]
if (is.null(dim(num_data))) {
k <- final_split$train %>% map(is.numeric) %>% unlist()
j <- names(which(k == TRUE))
numdata <- tibble::as_data_frame(num_data)
colnames(numdata) <- j
updateSelectInput(session, 'boxly1_select_x',
choices = names(numdata), selected = names(numdata))
updateSelectInput(session, 'bobox1_select_x',
choices = names(numdata), selected = names(numdata))
} else if (ncol(num_data) < 1) {
updateSelectInput(session, 'boxly1_select_x',
choices = '', selected = '')
updateSelectInput(session, 'bobox1_select_x',
choices = '', selected = '')
} else {
updateSelectInput(session, 'boxly1_select_x', choices = names(num_data))
updateSelectInput(session, 'bobox1_select_x', choices = names(num_data))
}
})
output$boxly1_plot_1 <- plotly::renderPlotly({
boxly1(data = final_split$train, y = input$boxly1_select_x,
title = input$boxly1_title, name = input$boxly1_xlabel,
x_title = NULL, y_title = input$boxly1_ylabel)
})
output$bobox1_plot_1 <- rbokeh::renderRbokeh({
bobox(data = final_split$train, x_data = input$bobox1_select_x,
fig_title = input$bobox1_title, x_lab = input$bobox1_xlabel,
y_lab = input$bobox1_ylabel, ,
x_grid = input$bobox1_xgrid, y_grid = input$bobox1_ygrid,
box_w = input$bobox1_width, box_col = input$bobox1_color,
box_alp = input$bobox1_alpha, box_l_col = input$bobox1_lcolor,
box_out_gly = input$bobox1_oshape, box_out_size = input$bobox1_osize)
})
| /scratch/gouwar.j/cran-all/cranData/xplorerr/inst/app-visualize/logic/logic_box_plot_1.R |
source('helper/boxly2.R')
source('helper/bobox2.R')
source('helper/hibox2.R')
observeEvent(input$finalok, {
num_data <- final_split$train[, sapply(final_split$train, is.numeric)]
if (is.null(dim(num_data))) {
k <- final_split$train %>% map(is.numeric) %>% unlist()
j <- names(which(k == TRUE))
numdata <- tibble::as_data_frame(num_data)
colnames(numdata) <- j
updateSelectInput(session, 'boxly2_select_y',
choices = names(numdata), selected = names(numdata))
updateSelectInput(session, 'bobox2_select_y',
choices = names(numdata), selected = names(numdata))
updateSelectInput(session, 'hibox2_select_y',
choices = names(numdata), selected = names(numdata))
} else if (ncol(num_data) < 1) {
updateSelectInput(session, 'boxly2_select_y', choices = '', selected = '')
updateSelectInput(session, 'bobox2_select_y', choices = '', selected = '')
updateSelectInput(session, 'hibox2_select_y', choices = '', selected = '')
} else {
updateSelectInput(session, 'boxly2_select_y', choices = names(num_data))
updateSelectInput(session, 'bobox2_select_y', choices = names(num_data))
updateSelectInput(session, 'hibox2_select_y', choices = names(num_data))
}
f_data <- final_split$train[, sapply(final_split$train, is.factor)]
# validate(need(!dim(f_data)[2] == 0, 'No factor variables in the data.'))
if (is.null(dim(f_data))) {
k <- final_split$train %>% map(is.factor) %>% unlist()
j <- names(which(k == TRUE))
fdata <- tibble::as_data_frame(f_data)
colnames(fdata) <- j
updateSelectInput(session, 'boxly2_select_x',
choices = names(fdata), selected = names(fdata))
updateSelectInput(session, 'bobox2_select_x',
choices = names(fdata), selected = names(fdata))
updateSelectInput(session, 'hibox2_select_x',
choices = names(fdata), selected = names(fdata))
} else if (dim(f_data)[2] == 0) {
updateSelectInput(session, 'boxly2_select_x', choices = '', selected = '')
updateSelectInput(session, 'bobox2_select_x', choices = '', selected = '')
updateSelectInput(session, 'hibox2_select_x', choices = '', selected = '')
} else {
updateSelectInput(session, 'boxly2_select_x', choices = names(f_data))
updateSelectInput(session, 'bobox2_select_x', choices = names(f_data))
updateSelectInput(session, 'hibox2_select_x', choices = names(f_data))
}
})
observeEvent(input$submit_part_train_per, {
num_data <- final_split$train[, sapply(final_split$train, is.numeric)]
if (is.null(dim(num_data))) {
k <- final_split$train %>% map(is.numeric) %>% unlist()
j <- names(which(k == TRUE))
numdata <- tibble::as_data_frame(num_data)
colnames(numdata) <- j
updateSelectInput(session, 'boxly2_select_y',
choices = names(numdata), selected = names(numdata))
updateSelectInput(session, 'bobox2_select_y',
choices = names(numdata), selected = names(numdata))
updateSelectInput(session, 'hibox2_select_y',
choices = names(numdata), selected = names(numdata))
} else if (ncol(num_data) < 1) {
updateSelectInput(session, 'boxly2_select_y', choices = '', selected = '')
updateSelectInput(session, 'bobox2_select_y', choices = '', selected = '')
updateSelectInput(session, 'hibox2_select_y', choices = '', selected = '')
} else {
updateSelectInput(session, 'boxly2_select_y', choices = names(num_data))
updateSelectInput(session, 'bobox2_select_y', choices = names(num_data))
updateSelectInput(session, 'hibox2_select_y', choices = names(num_data))
}
f_data <- final_split$train[, sapply(final_split$train, is.factor)]
# validate(need(!dim(f_data)[2] == 0, 'No factor variables in the data.'))
if (is.null(dim(f_data))) {
k <- final_split$train %>% map(is.factor) %>% unlist()
j <- names(which(k == TRUE))
fdata <- tibble::as_data_frame(f_data)
colnames(fdata) <- j
updateSelectInput(session, 'boxly2_select_x',
choices = names(fdata), selected = names(fdata))
updateSelectInput(session, 'bobox2_select_x',
choices = names(fdata), selected = names(fdata))
updateSelectInput(session, 'hibox2_select_x',
choices = names(fdata), selected = names(fdata))
} else if (dim(f_data)[2] == 0) {
updateSelectInput(session, 'boxly2_select_x', choices = '', selected = '')
updateSelectInput(session, 'bobox2_select_x', choices = '', selected = '')
updateSelectInput(session, 'hibox2_select_x', choices = '', selected = '')
} else {
updateSelectInput(session, 'boxly2_select_x', choices = names(f_data))
updateSelectInput(session, 'bobox2_select_x', choices = names(f_data))
updateSelectInput(session, 'hibox2_select_x', choices = names(f_data))
}
})
output$boxly2_plot_1 <- plotly::renderPlotly({
boxly2(data = final_split$train, y = input$boxly2_select_y,
x = input$boxly2_select_x, title = input$boxly2_title,
x_title = input$boxly2_ylabel, y_title = input$boxly2_ylabel)
})
output$bobox2_plot_1 <- rbokeh::renderRbokeh({
bobox2(data = final_split$train, y_data = input$bobox2_select_y,
x_data = input$bobox2_select_x, fig_title = input$bobox2_title,
x_lab = input$bobox2_ylabel, y_lab = input$bobox2_ylabel,
x_grid = input$bobox2_xgrid, y_grid = input$bobox2_ygrid,
box_w = input$bobox2_width, box_alp = input$bobox2_alpha,
box_out_gly = input$bobox2_oshape, box_out_size = input$bobox2_osize,
legend_loc = input$bobox2_legloc)
})
output$hibox2_plot_1 <- highcharter::renderHighchart({
highbox(data = final_split$train, y = input$hibox2_select_y,
x = input$hibox2_select_x, title = input$hibox2_title,
xax_title = input$hibox2_ylabel, yax_title = input$hibox2_ylabel)
})
| /scratch/gouwar.j/cran-all/cranData/xplorerr/inst/app-visualize/logic/logic_box_plot_2.R |
observeEvent(input$sample_data_yes, {
updateNavbarPage(session, 'mainpage', selected = 'tab_upload')
updateNavlistPanel(session, 'navlist_up', 'tab_use_sample')
})
file_upload_options <- eventReactive(input$upload_files_yes, {
fluidRow(
column(3, align = 'center',
actionButton(
inputId = 'upload_csv_file',
label = 'CSV',
width = '120px'
)
),
column(3, align = 'center',
actionButton(
inputId = 'upload_xls_file',
label = 'XLS',
width = '120px'
)
),
column(3, align = 'center',
actionButton(
inputId = 'upload_xlsx_file',
label = 'XLSX',
width = '120px'
)
),
column(3, align = 'center',
actionButton(
inputId = 'upload_json_file',
label = 'JSON',
width = '120px'
)
),
column(12, br()),
column(3, align = 'center',
actionButton(
inputId = 'upload_stata_file',
label = 'STATA',
width = '120px'
)
),
column(3, align = 'center',
actionButton(
inputId = 'upload_spss_file',
label = 'SPSS',
width = '120px'
)
),
column(3, align = 'center',
actionButton(
inputId = 'upload_sas_file',
label = 'SAS',
width = '120px'
)
),
column(3, align = 'center',
actionButton(
inputId = 'upload_rds_file',
label = 'RDS',
width = '120px'
)
)
)
})
output$upload_file_links <- renderUI({
file_upload_options()
})
observeEvent(input$upload_csv_file, {
updateNavbarPage(session, 'mainpage', selected = 'tab_upload')
updateNavlistPanel(session, 'navlist_up', 'tab_uploadfile')
updateTabsetPanel(session, 'tab_uploadfile', selected = 'tab_upload_csv')
})
observeEvent(input$upload_xls_file, {
updateNavbarPage(session, 'mainpage', selected = 'tab_upload')
updateNavlistPanel(session, 'navlist_up', 'tab_uploadfile')
updateTabsetPanel(session, 'tabset_upload', selected = 'tab_upload_excel')
})
observeEvent(input$upload_xlsx_file, {
updateNavbarPage(session, 'mainpage', selected = 'tab_upload')
updateNavlistPanel(session, 'navlist_up', 'tab_uploadfile')
updateTabsetPanel(session, 'tabset_upload', selected = 'tab_upload_excel')
})
observeEvent(input$upload_json_file, {
updateNavbarPage(session, 'mainpage', selected = 'tab_upload')
updateNavlistPanel(session, 'navlist_up', 'tab_uploadfile')
updateTabsetPanel(session, 'tabset_upload', selected = 'tab_upload_json')
})
observeEvent(input$upload_stata_file, {
updateNavbarPage(session, 'mainpage', selected = 'tab_upload')
updateNavlistPanel(session, 'navlist_up', 'tab_uploadfile')
updateTabsetPanel(session, 'tabset_upload', selected = 'tab_upload_stata')
})
observeEvent(input$upload_spss_file, {
updateNavbarPage(session, 'mainpage', selected = 'tab_upload')
updateNavlistPanel(session, 'navlist_up', 'tab_uploadfile')
updateTabsetPanel(session, 'tabset_upload', selected = 'tab_upload_spss')
})
observeEvent(input$upload_sas_file, {
updateNavbarPage(session, 'mainpage', selected = 'tab_upload')
updateNavlistPanel(session, 'navlist_up', 'tab_uploadfile')
updateTabsetPanel(session, 'tabset_upload', selected = 'tab_upload_sas')
})
observeEvent(input$upload_rds_file, {
updateNavbarPage(session, 'mainpage', selected = 'tab_upload')
updateNavlistPanel(session, 'navlist_up', 'tab_uploadfile')
updateTabsetPanel(session, 'tabset_upload', selected = 'tab_upload_rds')
}) | /scratch/gouwar.j/cran-all/cranData/xplorerr/inst/app-visualize/logic/logic_dataoptions.R |
# Exit ---------------------------------------------------------------
observe({
if (isTRUE(input$mainpage == "exit")) {
stopApp()
}
})
| /scratch/gouwar.j/cran-all/cranData/xplorerr/inst/app-visualize/logic/logic_exit_button.R |
filt_ui <- eventReactive(input$button_filt_yes, {
fluidRow(
column(12, align = 'center',
selectInput(
inputId = 'dplyr_filter',
label = 'Filter:',
choices = '',
selected = '',
width = '120px'
)
),
column(12, align = 'center',
selectInput(
inputId = 'dplyr_filt_op',
label = 'Select Operator',
choices = c('<', '>', '<=', '>=', '=='),
selected = '',
width = '120px'
)
),
column(12, align = 'center',
textInput(
inputId = 'dplyr_filt_val',
label = 'Value',
value = '20',
width = '120px'
)
),
column(12, align = 'center',
br(),
br(),
actionButton(inputId = 'submit_dply_filt', label = 'Filter', width = '120px', icon = icon('check')),
bsTooltip("submit_dply_filt", "Click here to filter data.",
"bottom", options = list(container = "body"))
)
)
})
output$filt_render <- renderUI(
filt_ui()
)
observeEvent(input$button_filt_yes, {
updateSelectInput(
session,
inputId = "dplyr_filter",
choices = names(final_sel$a),
selected = names(final_sel$a)
)
})
observeEvent(input$submit_dply_selvar, {
updateSelectInput(
session,
inputId = "dplyr_filter",
choices = names(finalsel()),
selected = names(finalsel())
)
})
filt_data <- reactiveValues(p = NULL)
observeEvent(input$submit_dply_selvar, {
filt_data$p <- final_sel$a
})
observeEvent(input$button_filt_yes, {
filt_data$p <- final_sel$a
})
observeEvent(input$submit_dply_filt, {
filt_data$p <- filt_data$p %>%
filter_(paste(input$dplyr_filter, input$dplyr_filt_op, input$dplyr_filt_val))
})
observeEvent(input$button_filt_no, {
filt_data$p <- final_sel$a
})
observeEvent(input$button_filt_no, {
updateNavbarPage(session, 'mainpage', selected = 'tab_scr')
updateNavlistPanel(session, 'navlist_trans', 'tab_screen')
})
filttrans <- eventReactive(input$button_filt_yes, {
fluidRow(
column(6, align = 'left',
actionButton(inputId='filt2dvarsel', label="Select Variables", icon = icon("long-arrow-left"))
),
column(6, align = 'right',
actionButton(inputId='filt2screen', label="Screen Data", icon = icon("long-arrow-right"))
)
)
})
output$filt_trans <- renderUI({
filttrans()
})
observeEvent(input$filt2dvarsel, {
updateNavbarPage(session, 'mainpage', selected = 'tab_trans')
updateNavlistPanel(session, 'navlist_trans', 'tab_selvar')
})
observeEvent(input$filt2screen, {
updateNavbarPage(session, 'mainpage', selected = 'tab_scr')
updateNavlistPanel(session, 'navlist_trans', 'tab_screen')
})
# filtered <- eventReactive(input$submit_dply_filt, {
# k <- final_sel() %>%
# filter_(paste(input$dplyr_filter, input$dplyr_filt_op, input$dplyr_filt_val))
# k
# # k <- filter_(final_sel(), paste(input$dplyr_filter, input$dplyr_filt_op, input$dplyr_filt_val))
# # k
# }) | /scratch/gouwar.j/cran-all/cranData/xplorerr/inst/app-visualize/logic/logic_filter.R |
source('helper/ggunibar.R')
observeEvent(input$finalok, {
f_data <- final_split$train[, sapply(final_split$train, is.factor)]
# validate(need(!dim(f_data)[2] == 0, 'No factor variables in the data.'))
if (is.null(dim(f_data))) {
k <- final_split$train %>% map(is.factor) %>% unlist()
j <- names(which(k == TRUE))
fdata <- tibble::as_data_frame(f_data)
colnames(fdata) <- j
updateSelectInput(session, 'gbar_select_x',
choices = names(fdata), selected = names(fdata))
} else if (dim(f_data)[2] == 0) {
updateSelectInput(session, 'gbar_select_x', choices = '', selected = '')
} else {
updateSelectInput(session, 'gbar_select_x', choices = names(f_data))
}
})
observeEvent(input$submit_part_train_per, {
f_data <- final_split$train[, sapply(final_split$train, is.factor)]
# validate(need(!dim(f_data)[2] == 0, 'No factor variables in the data.'))
if (is.null(dim(f_data))) {
k <- final_split$train %>% map(is.factor) %>% unlist()
j <- names(which(k == TRUE))
fdata <- tibble::as_data_frame(f_data)
colnames(fdata) <- j
updateSelectInput(session, 'gbar_select_x',
choices = names(fdata), selected = names(fdata))
} else if (dim(f_data)[2] == 0) {
updateSelectInput(session, 'gbar_select_x', choices = '', selected = '')
} else {
updateSelectInput(session, 'gbar_select_x', choices = names(f_data))
}
})
gselectedbar <- reactive({
req(input$gbar_select_x)
out <- final_split$train %>%
select(input$gbar_select_x)
out
})
ybarmax <- reactive({
out <- gselectedbar() %>%
select(1) %>%
table() %>%
max
out
})
output$ui_gbaryrange_min <- renderUI({
df <- final_split$train
if (is.null(df)) return(NULL)
numericInput('gbary_range_min', 'Y Axis Min', value = 0, min = 0)
})
output$ui_gbaryrange_max <- renderUI({
df <- final_split$train
if (is.null(df)) return(NULL)
numericInput('gbary_range_max', 'Y Axis Max', value = ybarmax())
})
output$gbar_plot_1 <- renderPlot({
ggbar1(data = final_split$train, column = input$gbar_select_x,
horizontal = input$gbar_horiz,
title = input$gbar_title, sub = input$gbar_subtitle,
xlab = input$gbar_xlabel, ylab = input$gbar_ylabel,
bar_col = input$gbar_barcol, bor_col = input$gbar_borcol)
})
output$gbar_plot_2 <- renderPlot({
ggbar1(data = final_split$train, column = input$gbar_select_x,
horizontal = input$gbar_horiz,
bar_col = input$gbar_barcol, bor_col = input$gbar_borcol,
title = input$gbar_title, sub = input$gbar_subtitle,
xlab = input$gbar_xlabel, ylab = input$gbar_ylabel,
yaxlimit = TRUE, y1 = input$gbary_range_min, y2 = input$gbary_range_max,
remove_xax = input$gbar_remx, remove_yax = input$gbar_remy)
})
output$gbar_plot_3 <- renderPlot({
ggbar1(data = final_split$train, column = input$gbar_select_x,
horizontal = input$gbar_horiz, title = input$gbar_title,
sub = input$gbar_subtitle, xlab = input$gbar_xlabel,
bar_col = input$gbar_barcol, bor_col = input$gbar_borcol,
ylab = input$gbar_ylabel, yaxlimit = TRUE, y1 = input$gbary_range_min,
y2 = input$gbary_range_max, remove_xax = input$gbar_remx,
remove_yax = input$gbar_remy, add_text = input$gbar_text,
xloc = input$gbar_text_x_loc, yloc = input$gbar_text_y_loc,
label = input$gbar_plottext, tex_color = input$gbar_textcolor,
tex_size = input$gbar_textsize)
})
output$gbar_plot_4 <- renderPlot({
ggbar1(data = final_split$train, column = input$gbar_select_x,
horizontal = input$gbar_horiz, title = input$gbar_title,
sub = input$gbar_subtitle, xlab = input$gbar_xlabel,
bar_col = input$gbar_barcol, bor_col = input$gbar_borcol,
ylab = input$gbar_ylabel, yaxlimit = TRUE, y1 = input$gbary_range_min,
y2 = input$gbary_range_max, remove_xax = input$gbar_remx,
remove_yax = input$gbar_remy, add_text = input$gbar_text,
xloc = input$gbar_text_x_loc, yloc = input$gbar_text_y_loc,
label = input$gbar_plottext, tex_color = input$gbar_textcolor,
tex_size = input$gbar_textsize, title_col = input$gbar_title_col,
title_fam = input$gbar_title_fam, title_face = input$gbar_title_font,
title_size = input$gbar_title_size, title_hjust = input$gbar_title_hjust,
title_vjust = input$gbar_title_vjust, sub_col = input$gbar_sub_col,
sub_fam = input$gbar_sub_fam, sub_face = input$gbar_subtitle_font,
sub_size = input$gbar_sub_size, sub_hjust = input$gbar_sub_hjust,
sub_vjust = input$gbar_sub_vjust, xax_col = input$gbar_xlab_col,
xax_fam = input$gbar_xlab_fam, xax_face = input$gbar_xlab_font,
xax_size = input$gbar_xlab_size, xax_hjust = input$gbar_xlab_hjust,
xax_vjust = input$gbar_xlab_vjust, yax_col = input$gbar_ylab_col,
yax_fam = input$gbar_ylab_fam, yax_face = input$gbar_ylab_font,
yax_size = input$gbar_ylab_size, yax_hjust = input$gbar_ylab_hjust,
yax_vjust = input$gbar_ylab_vjust)
})
output$gbar_plot_5 <- renderPlot({
ggbar1(data = final_split$train, column = input$gbar_select_x,
horizontal = input$gbar_horiz, title = input$gbar_title,
sub = input$gbar_subtitle, xlab = input$gbar_xlabel,
bar_col = input$gbar_barcol, bor_col = input$gbar_borcol,
ylab = input$gbar_ylabel, yaxlimit = TRUE, y1 = input$gbary_range_min,
y2 = input$gbary_range_max, remove_xax = input$gbar_remx,
remove_yax = input$gbar_remy, add_text = input$gbar_text,
xloc = input$gbar_text_x_loc, yloc = input$gbar_text_y_loc,
label = input$gbar_plottext, tex_color = input$gbar_textcolor,
tex_size = input$gbar_textsize, title_col = input$gbar_title_col,
title_fam = input$gbar_title_fam, title_face = input$gbar_title_font,
title_size = input$gbar_title_size, title_hjust = input$gbar_title_hjust,
title_vjust = input$gbar_title_vjust, sub_col = input$gbar_sub_col,
sub_fam = input$gbar_sub_fam, sub_face = input$gbar_subtitle_font,
sub_size = input$gbar_sub_size, sub_hjust = input$gbar_sub_hjust,
sub_vjust = input$gbar_sub_vjust, xax_col = input$gbar_xlab_col,
xax_fam = input$gbar_xlab_fam, xax_face = input$gbar_xlab_font,
xax_size = input$gbar_xlab_size, xax_hjust = input$gbar_xlab_hjust,
xax_vjust = input$gbar_xlab_vjust, yax_col = input$gbar_ylab_col,
yax_fam = input$gbar_ylab_fam, yax_face = input$gbar_ylab_font,
yax_size = input$gbar_ylab_size, yax_hjust = input$gbar_ylab_hjust,
yax_vjust = input$gbar_ylab_vjust, theme = input$gbar_theme)
})
output$gbar_plot_6 <- renderPlot({
ggbar1(data = final_split$train, column = input$gbar_select_x,
horizontal = input$gbar_horiz, title = input$gbar_title,
sub = input$gbar_subtitle, xlab = input$gbar_xlabel,
bar_col = input$gbar_barcol, bor_col = input$gbar_borcol,
ylab = input$gbar_ylabel, yaxlimit = TRUE, y1 = input$gbary_range_min,
y2 = input$gbary_range_max, remove_xax = input$gbar_remx,
remove_yax = input$gbar_remy, add_text = input$gbar_text,
xloc = input$gbar_text_x_loc, yloc = input$gbar_text_y_loc,
label = input$gbar_plottext, tex_color = input$gbar_textcolor,
tex_size = input$gbar_textsize, title_col = input$gbar_title_col,
title_fam = input$gbar_title_fam, title_face = input$gbar_title_font,
title_size = input$gbar_title_size, title_hjust = input$gbar_title_hjust,
title_vjust = input$gbar_title_vjust, sub_col = input$gbar_sub_col,
sub_fam = input$gbar_sub_fam, sub_face = input$gbar_subtitle_font,
sub_size = input$gbar_sub_size, sub_hjust = input$gbar_sub_hjust,
sub_vjust = input$gbar_sub_vjust, xax_col = input$gbar_xlab_col,
xax_fam = input$gbar_xlab_fam, xax_face = input$gbar_xlab_font,
xax_size = input$gbar_xlab_size, xax_hjust = input$gbar_xlab_hjust,
xax_vjust = input$gbar_xlab_vjust, yax_col = input$gbar_ylab_col,
yax_fam = input$gbar_ylab_fam, yax_face = input$gbar_ylab_font,
yax_size = input$gbar_ylab_size, yax_hjust = input$gbar_ylab_hjust,
yax_vjust = input$gbar_ylab_vjust, theme = input$gbar_theme)
}) | /scratch/gouwar.j/cran-all/cranData/xplorerr/inst/app-visualize/logic/logic_gbar.R |
source('helper/ggbibar.R')
observeEvent(input$finalok, {
f_data <- final_split$train[, sapply(final_split$train, is.factor)]
# validate(need(!dim(f_data)[2] == 0, 'No factor variables in the data.'))
if (is.null(dim(f_data))) {
k <- final_split$train %>% map(is.factor) %>% unlist()
j <- names(which(k == TRUE))
fdata <- tibble::as_data_frame(f_data)
colnames(fdata) <- j
updateSelectInput(session, 'gbar2_select_x',
choices = names(fdata), selected = names(fdata))
updateSelectInput(session, 'gbar2_select_y',
choices = names(fdata), selected = names(fdata))
} else if (dim(f_data)[2] == 0) {
updateSelectInput(session, 'gbar2_select_x', choices = '', selected = '')
updateSelectInput(session, 'gbar2_select_y', choices = '', selected = '')
} else {
updateSelectInput(session, 'gbar2_select_x', choices = names(f_data))
updateSelectInput(session, 'gbar2_select_y', choices = names(f_data))
}
})
observeEvent(input$submit_part_train_per, {
f_data <- final_split$train[, sapply(final_split$train, is.factor)]
# validate(need(!dim(f_data)[2] == 0, 'No factor variables in the data.'))
if (is.null(dim(f_data))) {
k <- final_split$train %>% map(is.factor) %>% unlist()
j <- names(which(k == TRUE))
fdata <- tibble::as_data_frame(f_data)
colnames(fdata) <- j
updateSelectInput(session, 'gbar2_select_x',
choices = names(fdata), selected = names(fdata))
updateSelectInput(session, 'gbar2_select_y',
choices = names(fdata), selected = names(fdata))
} else if (dim(f_data)[2] == 0) {
updateSelectInput(session, 'gbar2_select_x', choices = '', selected = '')
updateSelectInput(session, 'gbar2_select_y', choices = '', selected = '')
} else {
updateSelectInput(session, 'gbar2_select_x', choices = names(f_data))
updateSelectInput(session, 'gbar2_select_y', choices = names(f_data))
}
})
gselectedbar2 <- reactive({
req(input$gbar_select_x)
out <- final_split$train %>%
select(input$gbar2_select_x, input$gbar2_select_y)
out
})
ybar2max <- reactive({
out <- gselectedbar2() %>%
select(1, 2) %>%
table() %>%
max
out
})
output$ui_gbar2yrange_min <- renderUI({
df <- final_split$train
if (is.null(df)) return(NULL)
numericInput('gbar2y_range_min', 'Y Axis Min', value = 0, min = 0)
})
output$ui_gbar2yrange_max <- renderUI({
df <- final_split$train
if (is.null(df)) return(NULL)
numericInput('gbar2y_range_max', 'Y Axis Max', value = ybar2max())
})
output$gbar2_plot_1 <- renderPlot({
ggbibar(data = final_split$train, x = input$gbar2_select_x,
y = input$gbar2_select_y,
stacked = input$gbar2_stack, horizontal = input$gbar2_horiz,
title = input$gbar2_title, sub = input$gbar2_subtitle,
xlab = input$gbar2_xlabel, ylab = input$gbar2_ylabel)
})
output$gbar2_plot_2 <- renderPlot({
ggbibar(data = final_split$train, x = input$gbar2_select_x,
y = input$gbar2_select_y,
stacked = input$gbar2_stack, horizontal = input$gbar2_horiz,
title = input$gbar2_title, sub = input$gbar2_subtitle,
xlab = input$gbar2_xlabel, ylab = input$gbar2_ylabel,
yaxlimit = TRUE, y1 = input$gbar2y_range_min, y2 = input$gbar2y_range_max,
remove_xax = input$gbar2_remx, remove_yax = input$gbar2_remy)
})
output$gbar2_plot_3 <- renderPlot({
ggbibar(data = final_split$train, x = input$gbar2_select_x,
y = input$gbar2_select_y,
stacked = input$gbar2_stack, horizontal = input$gbar2_horiz,
title = input$gbar2_title, sub = input$gbar2_subtitle,
xlab = input$gbar2_xlabel, ylab = input$gbar2_ylabel,
yaxlimit = TRUE, y1 = input$gbar2y_range_min,
y2 = input$gbar2y_range_max, remove_xax = input$gbar2_remx,
remove_yax = input$gbar2_remy, add_text = input$gbar2_text,
xloc = input$gbar2_text_x_loc, yloc = input$gbar2_text_y_loc,
label = input$gbar2_plottext, tex_color = input$gbar2_textcolor,
tex_size = input$gbar2_textsize)
})
output$gbar2_plot_4 <- renderPlot({
ggbibar(data = final_split$train, x = input$gbar2_select_x,
y = input$gbar2_select_y,
stacked = input$gbar2_stack, horizontal = input$gbar2_horiz,
title = input$gbar2_title, sub = input$gbar2_subtitle,
xlab = input$gbar2_xlabel, ylab = input$gbar2_ylabel,
yaxlimit = TRUE, y1 = input$gbar2y_range_min,
y2 = input$gbar2y_range_max, remove_xax = input$gbar2_remx,
remove_yax = input$gbar2_remy, add_text = input$gbar2_text,
xloc = input$gbar2_text_x_loc, yloc = input$gbar2_text_y_loc,
label = input$gbar2_plottext, tex_color = input$gbar2_textcolor,
tex_size = input$gbar2_textsize, title_col = input$gbar2_title_col,
title_fam = input$gbar2_title_fam, title_face = input$gbar2_title_font,
title_size = input$gbar2_title_size, title_hjust = input$gbar2_title_hjust,
title_vjust = input$gbar2_title_vjust, sub_col = input$gbar2_sub_col,
sub_fam = input$gbar2_sub_fam, sub_face = input$gbar2_subtitle_font,
sub_size = input$gbar2_sub_size, sub_hjust = input$gbar2_sub_hjust,
sub_vjust = input$gbar2_sub_vjust, xax_col = input$gbar2_xlab_col,
xax_fam = input$gbar2_xlab_fam, xax_face = input$gbar2_xlab_font,
xax_size = input$gbar2_xlab_size, xax_hjust = input$gbar2_xlab_hjust,
xax_vjust = input$gbar2_xlab_vjust, yax_col = input$gbar2_ylab_col,
yax_fam = input$gbar2_ylab_fam, yax_face = input$gbar2_ylab_font,
yax_size = input$gbar2_ylab_size, yax_hjust = input$gbar2_ylab_hjust,
yax_vjust = input$gbar2_ylab_vjust)
})
output$gbar2_plot_5 <- renderPlot({
ggbibar(data = final_split$train, x = input$gbar2_select_x,
y = input$gbar2_select_y,
stacked = input$gbar2_stack, horizontal = input$gbar2_horiz,
title = input$gbar2_title, sub = input$gbar2_subtitle,
xlab = input$gbar2_xlabel, ylab = input$gbar2_ylabel,
yaxlimit = TRUE, y1 = input$gbar2y_range_min,
y2 = input$gbar2y_range_max, remove_xax = input$gbar2_remx,
remove_yax = input$gbar2_remy, add_text = input$gbar2_text,
xloc = input$gbar2_text_x_loc, yloc = input$gbar2_text_y_loc,
label = input$gbar2_plottext, tex_color = input$gbar2_textcolor,
tex_size = input$gbar2_textsize, title_col = input$gbar2_title_col,
title_fam = input$gbar2_title_fam, title_face = input$gbar2_title_font,
title_size = input$gbar2_title_size, title_hjust = input$gbar2_title_hjust,
title_vjust = input$gbar2_title_vjust, sub_col = input$gbar2_sub_col,
sub_fam = input$gbar2_sub_fam, sub_face = input$gbar2_subtitle_font,
sub_size = input$gbar2_sub_size, sub_hjust = input$gbar2_sub_hjust,
sub_vjust = input$gbar2_sub_vjust, xax_col = input$gbar2_xlab_col,
xax_fam = input$gbar2_xlab_fam, xax_face = input$gbar2_xlab_font,
xax_size = input$gbar2_xlab_size, xax_hjust = input$gbar2_xlab_hjust,
xax_vjust = input$gbar2_xlab_vjust, yax_col = input$gbar2_ylab_col,
yax_fam = input$gbar2_ylab_fam, yax_face = input$gbar2_ylab_font,
yax_size = input$gbar2_ylab_size, yax_hjust = input$gbar2_ylab_hjust,
yax_vjust = input$gbar2_ylab_vjust, theme = input$gbar2_theme)
})
output$gbar2_plot_6 <- renderPlot({
ggbibar(data = final_split$train, x = input$gbar2_select_x,
y = input$gbar2_select_y,
stacked = input$gbar2_stack, horizontal = input$gbar2_horiz,
title = input$gbar2_title, sub = input$gbar2_subtitle,
xlab = input$gbar2_xlabel, ylab = input$gbar2_ylabel,
yaxlimit = TRUE, y1 = input$gbar2y_range_min,
y2 = input$gbar2y_range_max, remove_xax = input$gbar2_remx,
remove_yax = input$gbar2_remy, add_text = input$gbar2_text,
xloc = input$gbar2_text_x_loc, yloc = input$gbar2_text_y_loc,
label = input$gbar2_plottext, tex_color = input$gbar2_textcolor,
tex_size = input$gbar2_textsize, title_col = input$gbar2_title_col,
title_fam = input$gbar2_title_fam, title_face = input$gbar2_title_font,
title_size = input$gbar2_title_size, title_hjust = input$gbar2_title_hjust,
title_vjust = input$gbar2_title_vjust, sub_col = input$gbar2_sub_col,
sub_fam = input$gbar2_sub_fam, sub_face = input$gbar2_subtitle_font,
sub_size = input$gbar2_sub_size, sub_hjust = input$gbar2_sub_hjust,
sub_vjust = input$gbar2_sub_vjust, xax_col = input$gbar2_xlab_col,
xax_fam = input$gbar2_xlab_fam, xax_face = input$gbar2_xlab_font,
xax_size = input$gbar2_xlab_size, xax_hjust = input$gbar2_xlab_hjust,
xax_vjust = input$gbar2_xlab_vjust, yax_col = input$gbar2_ylab_col,
yax_fam = input$gbar2_ylab_fam, yax_face = input$gbar2_ylab_font,
yax_size = input$gbar2_ylab_size, yax_hjust = input$gbar2_ylab_hjust,
yax_vjust = input$gbar2_ylab_vjust, theme = input$gbar2_theme)
})
| /scratch/gouwar.j/cran-all/cranData/xplorerr/inst/app-visualize/logic/logic_gbar2.R |
source('helper/ggbox1.R')
observeEvent(input$finalok, {
num_data <- final_split$train[, sapply(final_split$train, is.numeric)]
if (is.null(dim(num_data))) {
k <- final_split$train %>% map(is.numeric) %>% unlist()
j <- names(which(k == TRUE))
numdata <- tibble::as_data_frame(num_data)
colnames(numdata) <- j
updateSelectInput(session, 'gbox_select_x',
choices = names(numdata), selected = names(numdata))
} else if (ncol(num_data) < 1) {
updateSelectInput(session, 'gbox_select_x',
choices = '', selected = '')
} else {
updateSelectInput(session, 'gbox_select_x', choices = names(num_data))
}
})
observeEvent(input$submit_part_train_per, {
num_data <- final_split$train[, sapply(final_split$train, is.numeric)]
if (is.null(dim(num_data))) {
k <- final_split$train %>% map(is.numeric) %>% unlist()
j <- names(which(k == TRUE))
numdata <- tibble::as_data_frame(num_data)
colnames(numdata) <- j
updateSelectInput(session, 'gbox_select_x',
choices = names(numdata), selected = names(numdata))
} else if (ncol(num_data) < 1) {
updateSelectInput(session, 'gbox_select_x',
choices = '', selected = '')
} else {
updateSelectInput(session, 'gbox_select_x', choices = names(num_data))
}
})
gselectedbox <- reactive({
req(input$gbox_select_x)
out <- final_split$train %>%
select(input$gbox_select_x)
out
})
yboxmax <- reactive({
out <- gselectedbox() %>%
select(1) %>%
max
out
})
output$ui_gboxyrange_min <- renderUI({
df <- final_split$train
if (is.null(df)) return(NULL)
numericInput('gboxy_range_min', 'Y Axis Min', value = 0, min = 0)
})
output$ui_gboxyrange_max <- renderUI({
df <- final_split$train
if (is.null(df)) return(NULL)
numericInput('gboxy_range_max', 'Y Axis Max', value = yboxmax())
})
output$gbox_plot_1 <- renderPlot({
ggbox1(data = final_split$train, y = input$gbox_select_x,
horizontal = input$gbox_horiz, notch = input$gbox_notch,
title = input$gbox_title, sub = input$gbox_subtitle,
xlab = input$gbox_xlabel, ylab = input$gbox_ylabel,
fill = input$gbox_fill, col = input$gbox_col)
})
output$gbox_plot_2 <- renderPlot({
ggbox1(data = final_split$train, y = input$gbox_select_x,
horizontal = input$gbox_horiz, notch = input$gbox_notch,
title = input$gbox_title, sub = input$gbox_subtitle,
xlab = input$gbox_xlabel, ylab = input$gbox_ylabel,
fill = input$gbox_fill, col = input$gbox_col,
o_col = input$gbox_ocol, o_fill = input$gbox_ofill,
o_shape = input$gbox_oshape, o_alpha = input$gbox_oalpha,
o_size = input$gbox_osize
)
})
output$gbox_plot_3 <- renderPlot({
ggbox1(data = final_split$train, y = input$gbox_select_x,
horizontal = input$gbox_horiz, notch = input$gbox_notch,
title = input$gbox_title, sub = input$gbox_subtitle,
xlab = input$gbox_xlabel, ylab = input$gbox_ylabel,
fill = input$gbox_fill, col = input$gbox_col,
o_col = input$gbox_ocol, o_fill = input$gbox_ofill,
o_shape = input$gbox_oshape, o_alpha = input$gbox_oalpha,
o_size = input$gbox_osize, add_jitter = input$gbox_jitter,
j_width = input$gbox_jwidth, j_height = input$gbox_jheight,
j_fill = input$gbox_jfill, j_col = input$gbox_jcol,
j_shape = input$gbox_jshape, j_size = input$gbox_jsize,
j_alpha = input$gbox_jalpha
)
})
output$gbox_plot_4 <- renderPlot({
ggbox1(data = final_split$train, y = input$gbox_select_x,
horizontal = input$gbox_horiz, notch = input$gbox_notch,
title = input$gbox_title, sub = input$gbox_subtitle,
xlab = input$gbox_xlabel, ylab = input$gbox_ylabel,
fill = input$gbox_fill, col = input$gbox_col,
o_col = input$gbox_ocol, o_fill = input$gbox_ofill,
o_shape = input$gbox_oshape, o_alpha = input$gbox_oalpha,
o_size = input$gbox_osize, add_jitter = input$gbox_jitter,
j_width = input$gbox_jwidth, j_height = input$gbox_jheight,
j_fill = input$gbox_jfill, j_col = input$gbox_jcol,
j_shape = input$gbox_jshape, j_size = input$gbox_jsize,
j_alpha = input$gbox_jalpha, yaxlimit = TRUE,
y1 = input$gboxy_range_min, y2 = input$gboxy_range_max,
remove_xax = input$gbox_remx, remove_yax = input$gbox_remy
)
})
output$gbox_plot_5 <- renderPlot({
ggbox1(data = final_split$train, y = input$gbox_select_x,
horizontal = input$gbox_horiz, notch = input$gbox_notch,
title = input$gbox_title, sub = input$gbox_subtitle,
xlab = input$gbox_xlabel, ylab = input$gbox_ylabel,
fill = input$gbox_fill, col = input$gbox_col,
o_col = input$gbox_ocol, o_fill = input$gbox_ofill,
o_shape = input$gbox_oshape, o_alpha = input$gbox_oalpha,
o_size = input$gbox_osize, add_jitter = input$gbox_jitter,
j_width = input$gbox_jwidth, j_height = input$gbox_jheight,
j_fill = input$gbox_jfill, j_col = input$gbox_jcol,
j_shape = input$gbox_jshape, j_size = input$gbox_jsize,
j_alpha = input$gbox_jalpha, yaxlimit = TRUE,
y1 = input$gboxy_range_min, y2 = input$gboxy_range_max,
remove_xax = input$gbox_remx, remove_yax = input$gbox_remy,
add_text = input$gbox_text, xloc = input$gbox_text_x_loc,
yloc = input$gbox_text_y_loc, label = input$gbox_plottext,
tex_color = input$gbox_textcolor, tex_size = input$gbox_textsize
)
})
output$gbox_plot_6 <- renderPlot({
ggbox1(data = final_split$train, y = input$gbox_select_x,
horizontal = input$gbox_horiz, notch = input$gbox_notch,
title = input$gbox_title, sub = input$gbox_subtitle,
xlab = input$gbox_xlabel, ylab = input$gbox_ylabel,
fill = input$gbox_fill, col = input$gbox_col,
o_col = input$gbox_ocol, o_fill = input$gbox_ofill,
o_shape = input$gbox_oshape, o_alpha = input$gbox_oalpha,
o_size = input$gbox_osize, add_jitter = input$gbox_jitter,
j_width = input$gbox_jwidth, j_height = input$gbox_jheight,
j_fill = input$gbox_jfill, j_col = input$gbox_jcol,
j_shape = input$gbox_jshape, j_size = input$gbox_jsize,
j_alpha = input$gbox_jalpha, yaxlimit = TRUE,
y1 = input$gboxy_range_min, y2 = input$gboxy_range_max,
remove_xax = input$gbox_remx, remove_yax = input$gbox_remy,
add_text = input$gbox_text, xloc = input$gbox_text_x_loc,
yloc = input$gbox_text_y_loc, label = input$gbox_plottext,
tex_color = input$gbox_textcolor, tex_size = input$gbox_textsize,
title_col = input$gbox_title_col,
title_fam = input$gbox_title_fam, title_face = input$gbox_title_font,
title_size = input$gbox_title_size, title_hjust = input$gbox_title_hjust,
title_vjust = input$gbox_title_vjust, sub_col = input$gbox_sub_col,
sub_fam = input$gbox_sub_fam, sub_face = input$gbox_subtitle_font,
sub_size = input$gbox_sub_size, sub_hjust = input$gbox_sub_hjust,
sub_vjust = input$gbox_sub_vjust, xax_col = input$gbox_xlab_col,
xax_fam = input$gbox_xlab_fam, xax_face = input$gbox_xlab_font,
xax_size = input$gbox_xlab_size, xax_hjust = input$gbox_xlab_hjust,
xax_vjust = input$gbox_xlab_vjust, yax_col = input$gbox_ylab_col,
yax_fam = input$gbox_ylab_fam, yax_face = input$gbox_ylab_font,
yax_size = input$gbox_ylab_size, yax_hjust = input$gbox_ylab_hjust,
yax_vjust = input$gbox_ylab_vjust
)
})
output$gbox_plot_7 <- renderPlot({
ggbox1(data = final_split$train, y = input$gbox_select_x,
horizontal = input$gbox_horiz, notch = input$gbox_notch,
title = input$gbox_title, sub = input$gbox_subtitle,
xlab = input$gbox_xlabel, ylab = input$gbox_ylabel,
fill = input$gbox_fill, col = input$gbox_col,
o_col = input$gbox_ocol, o_fill = input$gbox_ofill,
o_shape = input$gbox_oshape, o_alpha = input$gbox_oalpha,
o_size = input$gbox_osize, add_jitter = input$gbox_jitter,
j_width = input$gbox_jwidth, j_height = input$gbox_jheight,
j_fill = input$gbox_jfill, j_col = input$gbox_jcol,
j_shape = input$gbox_jshape, j_size = input$gbox_jsize,
j_alpha = input$gbox_jalpha, yaxlimit = TRUE,
y1 = input$gboxy_range_min, y2 = input$gboxy_range_max,
remove_xax = input$gbox_remx, remove_yax = input$gbox_remy,
add_text = input$gbox_text, xloc = input$gbox_text_x_loc,
yloc = input$gbox_text_y_loc, label = input$gbox_plottext,
tex_color = input$gbox_textcolor, tex_size = input$gbox_textsize,
title_col = input$gbox_title_col,
title_fam = input$gbox_title_fam, title_face = input$gbox_title_font,
title_size = input$gbox_title_size, title_hjust = input$gbox_title_hjust,
title_vjust = input$gbox_title_vjust, sub_col = input$gbox_sub_col,
sub_fam = input$gbox_sub_fam, sub_face = input$gbox_subtitle_font,
sub_size = input$gbox_sub_size, sub_hjust = input$gbox_sub_hjust,
sub_vjust = input$gbox_sub_vjust, xax_col = input$gbox_xlab_col,
xax_fam = input$gbox_xlab_fam, xax_face = input$gbox_xlab_font,
xax_size = input$gbox_xlab_size, xax_hjust = input$gbox_xlab_hjust,
xax_vjust = input$gbox_xlab_vjust, yax_col = input$gbox_ylab_col,
yax_fam = input$gbox_ylab_fam, yax_face = input$gbox_ylab_font,
yax_size = input$gbox_ylab_size, yax_hjust = input$gbox_ylab_hjust,
yax_vjust = input$gbox_ylab_vjust, theme = input$gbox_theme
)
})
output$gbox_plot_8 <- renderPlot({
ggbox1(data = final_split$train, y = input$gbox_select_x,
horizontal = input$gbox_horiz, notch = input$gbox_notch,
title = input$gbox_title, sub = input$gbox_subtitle,
xlab = input$gbox_xlabel, ylab = input$gbox_ylabel,
fill = input$gbox_fill, col = input$gbox_col,
o_col = input$gbox_ocol, o_fill = input$gbox_ofill,
o_shape = input$gbox_oshape, o_alpha = input$gbox_oalpha,
o_size = input$gbox_osize, add_jitter = input$gbox_jitter,
j_width = input$gbox_jwidth, j_height = input$gbox_jheight,
j_fill = input$gbox_jfill, j_col = input$gbox_jcol,
j_shape = input$gbox_jshape, j_size = input$gbox_jsize,
j_alpha = input$gbox_jalpha, yaxlimit = TRUE,
y1 = input$gboxy_range_min, y2 = input$gboxy_range_max,
remove_xax = input$gbox_remx, remove_yax = input$gbox_remy,
add_text = input$gbox_text, xloc = input$gbox_text_x_loc,
yloc = input$gbox_text_y_loc, label = input$gbox_plottext,
tex_color = input$gbox_textcolor, tex_size = input$gbox_textsize,
title_col = input$gbox_title_col,
title_fam = input$gbox_title_fam, title_face = input$gbox_title_font,
title_size = input$gbox_title_size, title_hjust = input$gbox_title_hjust,
title_vjust = input$gbox_title_vjust, sub_col = input$gbox_sub_col,
sub_fam = input$gbox_sub_fam, sub_face = input$gbox_subtitle_font,
sub_size = input$gbox_sub_size, sub_hjust = input$gbox_sub_hjust,
sub_vjust = input$gbox_sub_vjust, xax_col = input$gbox_xlab_col,
xax_fam = input$gbox_xlab_fam, xax_face = input$gbox_xlab_font,
xax_size = input$gbox_xlab_size, xax_hjust = input$gbox_xlab_hjust,
xax_vjust = input$gbox_xlab_vjust, yax_col = input$gbox_ylab_col,
yax_fam = input$gbox_ylab_fam, yax_face = input$gbox_ylab_font,
yax_size = input$gbox_ylab_size, yax_hjust = input$gbox_ylab_hjust,
yax_vjust = input$gbox_ylab_vjust, theme = input$gbox_theme
)
}) | /scratch/gouwar.j/cran-all/cranData/xplorerr/inst/app-visualize/logic/logic_gbox.R |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.