View source: R/reindeeR_database.R
rename_bundles | R Documentation |
This function simplifies renaming of bundles.
rename_bundles(emuDBhandle, bundles)
rename_bundles(emuDBhandle, bundles)
emuDBhandle |
An emuR database handle |
bundles |
data.frame like object with the columns
It is worth noting that |
from |
A tibble or data.frame with columns "session" and "name", identifying the bundle to rename. The usual procedure is to first invoke list_bundles and then filter out the bundles the user wants to rename. |
to |
A vector of strings containing new names of the bundles in |
simulate |
Boolean; Should the bundle renaming just be simulated, or actually performed? |
The user it expected to supply a data frame and tibble with "session" and
"name" columns, and a vector of new bundle names with the length as the
number of rows in the from
data.frame. The function will then rename all
bundle directories and all files in the bundle directories to the new name
one by one.
Bundle renaming is a sensitive process and many things can go wrong.
Therefore the function will by default simulate the file renaming and return
a summary of the plan for the user to review. The user may then enter the
same arguments again and set simylate=TRUE
to actually perform the renaming.
If the database is part of a git repository, the changes will be committed and pushed
Either the updated bundle listing, or a tibble showing the file renaming plan.
emuR::rename_bundles
## Not run:
library(dplyr)
reindeer:::create_ae_db() -> emuDBhandle
r <- list_bundles(emuDBhandle) %>%
dplyr::mutate(to=toupper(name)) %>%
dplyr::mutate(to=stringr::str_replace(to,"([A-Z]+)([0-9]+)","\\1-\\2")) %>%
dplyr::mutate(to=tolower(to))
print(rename_bundles(emuDBhandle,r[1:2,c("session","name")],r[1:2,"to"],simulate=TRUE))
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.