tree: Show directories as indented names

Description Usage Arguments Details Value Author(s) See Also Examples

View source: R/tree.R

Description

Show directories as indented names

Usage

1
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.

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.

Value

Prints an ASCII art of the directory tree.

Author(s)

Walmes Zeviani, walmes@ufpr.br.

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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
## 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")


## End(Not run)

walmes/wzRfun documentation built on Aug. 10, 2021, 2:19 p.m.