lnt_rename: Assign proper names to LexisNexis files

lnt_renameR Documentation

Assign proper names to LexisNexis files

Description

Give proper names to files downloaded from 'LexisNexis' based on search term and period retrieved from each file cover page. This information is not always delivered by LexisNexis though. If the information is not present in the file, new file names will be empty.

Usage

lnt_rename(
  x,
  encoding = "UTF-8",
  recursive = FALSE,
  report = TRUE,
  simulate = TRUE,
  verbose = FALSE
)

Arguments

x

Can be either a character vector of LexisNexis file name(s), folder name(s) or can be left blank (see example).

encoding

Encoding to be assumed for input files. Defaults to UTF-8 (the LexisNexis standard value).

recursive

A logical flag indicating whether subdirectories are searched for more files.

report

A logical flag indicating whether the function will return a report which files were renamed.

simulate

Should the renaming be simulated instead of actually done? This can help prevent accidental renaming of unrelated files which happen to be in the same directory as the files from 'LexisNexis'.

verbose

A logical flag indicating whether information should be printed to the screen.

Details

Warning: This will rename all supported files in a give folder.

Author(s)

Johannes B. Gruber

Examples

## Not run: 
# Copy sample file to current wd
lnt_sample()

# Rename files in current wd and report back if successful

report.df <- lnt_rename(
  recursive = FALSE,
  report = TRUE
)


# Or provide file name(s)
my_files <- list.files(
  pattern = ".txt", full.names = TRUE,
  recursive = TRUE, ignore.case = TRUE
)
report.df <- lnt_rename(
  x = my_files,
  recursive = FALSE,
  report = TRUE
)

# Or provide folder name(s)
report.df <- lnt_rename(x = getwd())

report.df

## End(Not run)

JBGruber/LexisNexisTools documentation built on April 18, 2024, 6:15 a.m.