add_file_in_dir {shinydrive}R Documentation

Add / suppress / edit a file

Description

Add / suppress / edit a file

Usage

add_file_in_dir(
  file,
  dir,
  yml,
  name,
  description = "",
  date_time_format = "%Y%m%d_%H%M%s"
)

edit_file_in_dir(
  id,
  dir,
  yml,
  name = NULL,
  description = NULL,
  file = NULL,
  date_time_format = "%Y%m%d_%H%M%s"
)

suppress_file_in_dir(id, dir, yml)

get_yaml_info(
  yml,
  recorded_name = TRUE,
  date_time_format = "%Y%m%d_%H%M%s",
  add_img = FALSE,
  img_size = 30
)

Arguments

file

character file (to copy) path.

dir

character directory path.

yml

character yaml configuration file full path.

name

character file name.

description

character file description.

date_time_format

character DateTime format.

id

character file id in yaml.

recorded_name

logical : add recorded name (with date_time extension) in output ?

add_img

logical : Use in shiny module for adding file extension img.

img_size

integer : Use in shiny module for adding file extension img.

Value

These functions return a logical indicating if operation succeeded or not

Examples

## Not run: 

yml <- file.path(getwd(), "test_sfm/config.yml") # will be created

dir <- file.path(getwd(), "test_sfm")
dir.create(dir)

file <- system.file("translate/translate.csv", package = "shinydrive")

# add one first file
add_file_in_dir(
  file = file,
  dir = dir,
  yml = yml,
  name = "translate1",
  description = ""
)

yaml::yaml.load_file(yml)
list.files(dir)
get_yaml_info(yml)

# add second file
add_file_in_dir(
  file = file,
  dir = dir,
  yml = yml,
  name = "translate_2",
  description = "This is cool"
)

yaml::yaml.load_file(yml)
list.files(dir)
get_yaml_info(yml, recorded_name = F)

# modify first file
edit_file_in_dir(
  id = "2", 
  dir = dir, 
  yml = yml,
  name = "translate_2_mod",
  description = "So cool"
)

yaml::yaml.load_file(yml)
list.files(dir)

# suppress first file
suppress_file_in_dir(id = "1", dir = dir, yml = yml)

yaml::yaml.load_file(yml)
list.files(dir)


## End(Not run)


[Package shinydrive version 0.1.3 Index]