-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathserver.R
More file actions
39 lines (35 loc) · 1.08 KB
/
server.R
File metadata and controls
39 lines (35 loc) · 1.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
server <- function(input, output) {
dataCalcy <- reactive({
if (input$source == "default") {
data <- read.csv("history_20190929_084646.csv")
} else if (input$source == "file") {
data <- inputFile()
}
return(data)
})
inputFile <- reactive({
inFile <- input$calcyIV
if (is.null(inFile))
return(NULL)
df <- read.csv(inFile$datapath)
return(df)
})
mergedData <- reactive({
pokemonStats <- read_excel("PokemonStats.xlsx", sheet = 3)
dataPokemon <- dataCalcy()
dataPokemon$Nat <- dataPokemon$Nr
allDetails <- merge(dataPokemon, pokemonStats, by = "Nat")
return(allDetails)
})
output$tableCP <- DT::renderDataTable({
df <- mergedData()
filteredData <- df[df$CP >= input$cpRange[1] & df$CP <= input$cpRange[2], ]
displayData <- filteredData[ , c("Nr", "Name", "CP", "DPS", "Fast.move", "Special.move", "max.IV.", "Type I", "Type II")]
DT::datatable(displayData)
})
output$plot <- renderPlotly({
df <- dataCalcy()
plot_ly(df, x = ~CP, y = ~max.IV.)
})
}
shinyApp(ui = ui, server = server)