pkgdown/extra.css

Skip to contents

create_dir() creates a directory with a specified name. The user can choose to create another inner directory with the current date as its name. If the directory already exists, a message is printed.

Usage

create_dir(dir_name, date = FALSE)

Arguments

dir_name

The name of the directory to create.

date

If TRUE, a directory with the current date as name will be created inside the directory with dir_name.

Value

The relative file path of the created directory as a string.

Examples

# Create a directory with a specified name
create_dir("my_directory", date = FALSE)
#> [1] "my_directory"
unlink("my_directory", recursive = TRUE)  # Clean up the created directory

# Create a directory with a specified name and an inner directory with the current date as name
create_dir("my_directory", date = TRUE)
#> [1] "my_directory/2024_09_18"
unlink("my_directory", recursive = TRUE)  # Clean up the created directory

# Create a directory inside another directory
create_dir("outer_directory/inner_directory", date = FALSE)
#> [1] "outer_directory/inner_directory"
unlink("outer_directory", recursive = TRUE)  # Clean up the created directory

# Create a directory inside a pre existing one
create_dir("outer_directory", date = FALSE)
#> [1] "outer_directory"
create_dir("outer_directory/inner_directory", date = FALSE)
#> [1] "outer_directory/inner_directory"
unlink("outer_directory", recursive = TRUE)  # Clean up the created directory