Copies each element of a list into a separate variable in the workspace, using the list element names as variable names.
Value
Called primarily for its side effect of creating variables in the
workspace. Invisibly returns 1 if variables were created, 0
if the user declined.
Details
Creates one variable per list element in the calling environment
(usually the global workspace). All elements of x must be named;
passing an unnamed or partially-named list is an error. Element names that
are not valid R variable names are automatically converted using
make.names. An empty list produces a message and returns
invisibly without creating any variables.
Examples
values <- c(1, 2, 3, 4, 5)
group <- c("group A", "group A", "group B", "group B", "group B")
# split() returns a named list: one element per group
grp_list <- split(values, group)
# import silently (no confirmation prompt)
importList(grp_list, ask = FALSE)
if (FALSE) {
# interactive: shows variable names and asks for confirmation
importList(grp_list)
}