Description Usage Arguments Value Examples
Loops through the elements of a list and adds a name_id column to data.frames corresponding to the provided names.
1 | rename_list(my_list, names = NULL)
|
my_list |
a list; list elements may or may not have names |
names |
character vector; the names of the elements of the list, if the list is unnamed |
a list
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | ## Not run:
# example 1
paths <- list.files(directory)
files <- lapply(paths, fread)
rename_list(list = files, names = paths)
## End(Not run)
# example 2
l <- purrr::rerun(5, x = list(a = head(mtcars), b = head(iris), c = list(o = 1, p = list(q = head(airquality), u = 1:10))), y = head(mtcars))
rename_list(l, names = paste0("id", 1:5))
names(l) <- paste0("id", 1:5)
rename_list(l)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.