-
Notifications
You must be signed in to change notification settings - Fork 1
/
app_GPRvisualizer.R
61 lines (50 loc) · 1.43 KB
/
app_GPRvisualizer.R
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
if(!require("devtools")) install.packages("devtools")
devtools::install_github("emanuelhuber/RGPR")
library(RGPR)
if(!require("shiny")) install.packages("shiny")
library(shiny)
options(shiny.maxRequestSize = 30*1024^2)
# Define UI for data upload app ----
ui <- fluidPage(
# App title ----
titlePanel("Uploading GPR Files"),
# Sidebar layout with input and output definitions ----
sidebarLayout(
# Sidebar panel for inputs ----
sidebarPanel(
# Input: Select a file ----
fileInput("file1", "Choose GPR File",
multiple = TRUE
)
),
# Main panel for displaying outputs ----
mainPanel(
# Output: Data file ----
# tableOutput("contents")
plotOutput("plot1",width = "800px", height = "400px")
)
)
)
# Define server logic to read selected file ----
server <- function(input, output) {
# output$contents <- renderTable({
output$plot1 <- renderPlot({
# input$file1 will be NULL initially. After the user selects
# and uploads a file, head of that data file by default,
# or all rows if selected, will be shown.
req(input$file1)
# print(input$file1$datapath)
tryCatch(
{
x <- RGPR::readGPR(dsn = input$file1$datapath)
},
error = function(e) {
# return a safeError if a parsing error occurs
stop(safeError(e))
}
)
plot(x)
})
}
# Create Shiny app ----
shinyApp(ui, server)