Learn R Programming

⚠️There's a newer version (0.9.3) of this package.Take me there.

This package extends the functionality of shiny by providing an API for client side access to the server file system. As many shiny apps are run locally this is equivalent to accessing the filesystem of the users own computer, without the overhead of copying files to temporary locations that is tied to the use of fileInput().

The package can be installed from CRAN using install.packages('shinyFiles').

Usage

The package is designed to make it extremely easy to implement file system access. An example of implementing a file chooser would be:

In the ui.R file

shinyUI(bootstrapPage(
    shinyFilesButton('files', label='File select', title='Please select a file', multiple=FALSE)
))

In the server.R file

shinyServer(function(input, output) {
    shinyFileChoose(input, 'files', root=c(root='.'), filetypes=c('', 'txt'))
})

It is equally simple to implement directly in your custom html file as it only requires a single <button> element. The equivalent of the above in raw html would be:

<button id="files" type="button" class="shinyFiles btn" data-title="Please select a file" data-selecttype="single">
    File select
</button>

For an overview of all the different modules try the shinyFilesExample() function in the package. It gives an overview of all the necessary code, along with descriptions and working examples.

Credit

The file icons used in the file system navigator is taken from FatCows Farm-Fresh Web Icons (http://www.fatcow.com/free-icons)

Copy Link

Version

Install

install.packages('shinyFiles')

Monthly Downloads

6,987

Version

0.6.2

License

GPL (>= 2)

Maintainer

Thomas Pedersen

Last Published

August 28th, 2016

Functions in shinyFiles (0.6.2)

dirGetter

Create a function that updates a folder tree based on the given restrictions
dirCreator

Create a function that creates a new directory
formatFiletype

Formats the value of the filetype argument
shinyFilesExample

Run a simple example app using the shinyFiles functionality
updateChildren

Update the children element to reflect current state
traverseDirs

Traverse and update a tree representing the file system
fileGetter

Create a function that returns fileinfo according to the given restrictions
shinyFiles-observers

Create a connection to the server side filesystem
shinyFiles-parsers

Convert the output of a selection to platform specific path(s)
getVolumes

Get a list of available volumes
shinyFiles-buttons

Create a button to summon a shinyFiles dialog