我想使用ShinyFiles上传RData文件,但是我不知道该怎么做。
这对我不起作用:
library(shiny)
library(shinydashboard)
library(shinyFiles)
# Define UI for application that draws a histogram
ui <- dashboardPage(
dashboardHeader(),
dashboardSidebar(),
dashboardBody(
shinyFilesButton('files', label='File select', title='Please select a file', multiple=FALSE),
verbatimTextOutput("txt")
)
)
# Define server logic required to draw a histogram
server <- function(input, output) {
shinyFileChoose(input, 'files', root=c(root='/'), filetypes=c('', 'RData'))
output$txt <- renderPrint(
ls(parseFilePaths(roots= "/",selection = input$files))
)
}
# Run the application
shinyApp(ui = ui, server = server)
怎么了?我真的不明白parseFilesPaths是如何工作的,因为它获取到文件的路由,但是我无法使其工作。我也尝试过
files< - load(parseFilePaths(roots= "/",selection = input$files)$type)
但是它也没有起作用...
谢谢!
答案 0 :(得分:0)
我已经解决了。这里的解决方案(希望对其他人有帮助)
<script>
if (window.innerWidth <= 575){
$(window).on("scroll", function(){
var scrollPos = $(window).scrollTop();
if (scrollPos <= 0) {
$(".navbar-default").addClass("top-of-page");
} else {
$(".navbar-default").removeClass("top-of-page");
}
});
}
</script>