This function can improve your workflow.
It is inspired by usethis::rename_files()
, but its scope
is more oriented towards analysis script.
Arguments
- old, new
Old and new file names (with or without
.R
extensions).- warn_conflicts
One of
"default"
: will be check more thoroughly depending on the situation. If only moving directory, and"all"
otherwise."all"
(larger scope: ifold = "data/my-streets.csv|my_streets"
will check for objects namedmy_streets
, other files likemy-streets.R
, etc.),"exact"
will only search for"data/my-streets.csv"
in documents"none"
will not search for references in documents and will rename.
- overwrite
whether to overwrite
new
if it already exists. Be careful.- action
One of
"rename"
or"test"
- force
Use case
Let's say you have an analysis and work on a certain subject.
You want to rename a figure for clarity.
For example, you had an input file named data/my-streets.csv
and you now want to
rename it to
Here is what rename_files2()
does for you, before it renames files.
Look for potential name conflict
Look for data frame name conflicts
Sends information to clipboard
Will work well for you if you tend to name your objects using snake case and naming objects with snake case or kebab-case.
The philosophy is to inform you of manual steps required before actually performing file renaming.
A way to be less strict is to us