Show directories as indented names

tree(path = ".", options = "-F --charset=ascii", linux = TRUE)

Arguments

path

character[1] Is the root directory. Default is the value of getwd().

options

character[1] String of options to be passed to tree shell command. Default is "-F --charset=ascii". See the available options with system("tree --help").

linux

logical[1] Default is TRUE and indicates that tree of the Linux SO is to be used. Otherwise, the R native approach will be used.

Value

Prints an ASCII art of the directory tree.

Details

This function calls tree if it is available is Linux OS. The call is made with system(). Otherwise, a (less sophisticated) R native approach is used.

See also

dir_tree() for an implementation entirely based on R and functional in all SO. Also, dir(), list.files() and list.dirs() can be useful in many circumstances.

Examples

# NOT RUN { tree() tree("../") tree("../", linux = FALSE) system("tree --help") tree(system.file(package = "lattice"), options = "-F --charset=ascii -L 1") tree(system.file(package = "lattice"), options = "-F --charset=ascii -L 2") # }