fakeTextFile: Create a dummy text file in a directory.

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

View source: R/fakeTextFile.R

Description

Creates a dummy string of text, saves a text file in base::tempdir.

Usage

1
2
3
4
5
6
7
fakeTextFile(
  file_extension = ".R",
  dir_path = NULL,
  file_path = NULL,
  txt = NULL,
  n_lines = 1
)

Arguments

file_extension

Character value. File extension, default value is '.R'

dir_path

A character vector with the path to the folder where to save the text file. Default value is NULL and uses base::tempdir.

file_path

A character vector with the path, file name and extension of the created random file.

txt

An optional string (one line) or list of strings (multiple lines) to save in the text file. Randomly generated by default

n_lines

Positive none zero integer value. If 'txt' is not provided, 'n_lines' is the number of lines of text in the file.

Details

If not working inside an R project, dir_path has to be complete from root. To create an empty file, use 'txt = ""'.

Value

A list with two elements: - tmp_path: the path to the fake text file - txt: the dummy text string or list of strings

Author(s)

Alban Sagouis

See Also

For more flexibility in random string generation, see NCmisc::fakeLines. For more automated paragraph generation, see stringi::stri_rand_lipsum.

Examples

1
## Not run: fakeTextFile()

AlbanSagouis/myToolbox documentation built on Feb. 1, 2021, 1:08 p.m.