folderGadget | R Documentation |
Shiny gadget allowing to manipulate one or more folders.
folderGadget(
dirs = ".",
tabs = FALSE,
recursive = TRUE,
all.files = FALSE,
trash = FALSE
)
dirs |
character vector of paths to some folders |
tabs |
logical, whether to display the trees in tabs; this option is
effective only when there are two folders in the |
recursive , all.files |
options passed to |
trash |
logical, whether to add a trash to the gadget, allowing to restore the files or folders you delete |
No return value, just launches a Shiny gadget.
You can run the gadget for the current directory from the Addins menu within RStudio ('Explore current folder').
library(jsTreeR)
# copy a folder to a temporary location for the illustration:
tmpDir <- tempdir()
folder <- file.path(tmpDir, "htmlwidgets")
htmlwidgets <- system.file("htmlwidgets", package = "jsTreeR")
R.utils::copyDirectory(htmlwidgets, folder)
# we use a copy because the actions performed in the gadget are
# actually executed on the files system!
# explore and manipulate the folder (drag-and-drop, right-click):
if(interactive()){
folderGadget(folder)
}
# the 'trash' option allows to restore the elements you delete:
if(interactive()){
folderGadget(folder, trash = TRUE)
}
# you can open several folders:
folder1 <- file.path(folder, "lib")
folder2 <- file.path(folder, "gadget")
if(interactive()){
folderGadget(c(folder1, folder2))
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.