Я получаю следующую ошибку, когда читаю подходящий файл с помощью cycleRtools в приложении Shiny:
Exception in thread "main" java.lang.RuntimeException: java.io.FileNotFoundException: /tmp/RtmpVVHwXw/file1810323660 (No such file or directory)
at com.garmin.fit.csv.CSVTool.main(CSVTool.java:183)
Caused by: java.io.FileNotFoundException: /tmp/RtmpVVHwXw/file1810323660 (No such file or directory)
cannot open file '/tmp/RtmpVVHwXw/file1810323660_data.csv': No such file or directory
at java.io.FileInputStream.open0(Native Method)
at java.io.FileInputStream.open(FileInputStream.java:195)
at java.io.FileInputStream.<init>(FileInputStream.java:138)
at java.io.FileInputStream.<init>(FileInputStream.java:93)
at com.garmin.fit.csv.CSVTool.main(CSVTool.java:155)
Warning in file(file, "rt") :
Warning: Error in file: cannot open the connection
183: file
182: read.table
181: read.csv
180: read_fit
179: renderPlot [/srv/connect/apps/cycleapp/server.R#18]
177: func
137: drawPlot
123: <reactive:plotObj>
107: drawReactive
94: origRenderFunc
93: output$distPlot
13: runApp
12: fn
7: connect$retry
6: eval
5: eval
Вот мой код:
server.R
library(shiny)
library(cycleRtools)
# Define server logic required to draw a histogram ----
server <- function(input, output) {
observeEvent(input$submit, {
# Histogram of the Old Faithful Geyser Data ----
# with requested number of bins
# This expression that generates a histogram is wrapped in a call
# to renderPlot to indicate that:
#
# 1. It is "reactive" and therefore should be automatically
# re-executed when inputs (input$bins) change
# 2. Its output type is a plot
output$distPlot <- renderPlot({
intervaldata = read_fit(input$file, format=TRUE)
plot(x = intervaldata, # "x" is the data, for consistency with other methods.
y = 1:3, # Which plots should be created? see below.
xvar = "timer.min", # What should be plotted on the x axis?
xlab = "Time (min)", # x axis label.
laps = TRUE, # Should different laps be coloured?
breaks = TRUE) # Should stoppages in the ride be shown?
})})
}
ui.R
# Define UI for app that draws a histogram ----
ui <- fluidPage(
# App title ----
titlePanel("Hello Shiny!"),
# Sidebar layout with input and output definitions ----
sidebarLayout(
# Sidebar panel for inputs ----
sidebarPanel(
# Input: Slider for the number of bins ----
fileInput("file", label=h3("Upload .fit file."), accept=c(".fit")),
numericInput("FTP", label="Enter FTP", 150),
sliderInput("sRPE", label="Relative Perceived Effort", min=0, max=10, value=5),
actionButton("submit", label="Submit")
),
# Main panel for displaying outputs ----
mainPanel(
# Output: Histogram ----
plotOutput(outputId = "distPlot")
)
)
)
Интересно, что я не получаю сообщение об ошибке, если читаю файл через read_fit
в консоли R с теми же аргументами или без них. Затем я могу построить итоговый фрейм данных, как это делается в коде сервера.
Прошло много времени с тех пор, как я что-то делал с Shiny, но похоже, что проблема с jar? Заранее благодарим за помощь!