function(input, output, session) {
## Outputs
list_1 <- callModule(masanData, "masan", stringsAsFactors=FALSE)
# df_react_1 <- callModule(masanData, "masan",
# stringsAsFactors = FALSE)
df_react_1 <- reactive({
df_1 <- list_1$df_1
df_1()
})
df_react_2 <- reactive({
df_2 <- list_1$df_path
df_2()
})
react_affy_raw <- reactive({
affy_raw <- list_1$affy_raw
affy_raw()
})
react_expr_raw <- reactive({
expr_raw <- list_1$expr_raw
expr_raw()[1:5,1:5]
})
output$table_1 <- renderDataTable({
df_react_1()
})
output$table_2 <- renderDataTable({
df_react_2()
})
output$dt_expr_raw <- renderDataTable({
as.data.frame(react_expr_raw()[1:5, 1:5])
})
# Render Prints
output$render_affy_raw <- renderPrint({
head(react_affy_raw())
})
output$render_sel_input_ui_1 <- renderPrint({
input$sel_input_ui_1
})
output$render_sel_input_ui_2 <- renderPrint({
input$sel_input_ui_2
})
# Combine the selected variables into a new data frame
selectedData <- reactive({
iris[, c(input$xcol, input$ycol)]
})
clusters <- reactive({
kmeans(selectedData(), input$clusters)
})
output$plot1 <- renderPlot({
palette(c("#E41A1C", "#377EB8", "#4DAF4A", "#984EA3",
"#FF7F00", "#FFFF33", "#A65628", "#F781BF", "#999999"))
par(mar = c(5.1, 4.1, 0, 1))
plot(selectedData(),
col = clusters()$cluster,
pch = 20, cex = 3)
points(clusters()$centers, pch = 4, cex = 4, lwd = 4)
})
output$select_input_ui_1 <- renderUI({
validate(
need(df_react_1(), message="df_1() needed for renderUI 1")
)
list_items <- as.list(colnames(df_react_1()))
selectInput("sel_input_ui_1", label=h6("Color"),
choices=list_items)
})
output$select_input_ui_2 <- renderUI({
validate(
need(df_react_1(), message="df_1() needed for renderUI 1")
)
list_items <- as.list(colnames(df_react_1()))
selectInput("sel_input_ui_2", label=h6("Shape"),
choices=list_items)
})
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.