folderGadget {jsTreeR}R Documentation

Folder gadget

Description

Shiny gadget allowing to manipulate one or more folders.

Usage

folderGadget(
  dirs = ".",
  tabs = FALSE,
  recursive = TRUE,
  all.files = FALSE,
  trash = FALSE
)

Arguments

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 dirs argument

recursive, all.files

options passed to list.files; even if all.files = TRUE, '.git' and '.Rproj.user' folders are always discarded

trash

logical, whether to add a trash to the gadget, allowing to restore the files or folders you delete

Value

No return value, just launches a Shiny gadget.

Note

You can run the gadget for the current directory from the Addins menu within RStudio ('Explore current folder').

Examples

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))
}

[Package jsTreeR version 2.6.0 Index]