importList

0th

Percentile

Import a list

Creates variables in the workspace corresponding to the elements of a list

Usage
importList(x, ask = TRUE)
Arguments
x
List to be imported
ask
Should R ask the user to confirm the new variables before creating them? (default is TRUE)
Details

The importList function creates variables in the parent environment (generally the global workspace) corresponding to each of the elements of the list object x. If the names of these elements do not correspond to legitimate variables names they are converted using the make.names functions to valid variables names.

Value

0 if the user chooses not to import the variables, otherwise invisibly returns 1.

Warning

This package is under development, and has been released only due to teaching constraints. Until this notice disappears from the help files, you should assume that everything in the package is subject to change. Backwards compatibility is NOT guaranteed. Functions may be deleted in future versions and new syntax may be inconsistent with earlier versions. For the moment at least, this package should be treated with extreme caution.

See Also

unlist, attach

Aliases
  • importList
Examples
library(lsr) data <- c(1,2,3,4,5) group <- c("group A","group A","group B","group B","group B") # the split function creates a list with two elements # named "group A" and "group B", each containing the # data for the respective groups data.list <- split( data, group ) # The data.list variable looks like this: # $`group A` # [1] 1 2 # # $`group B` # [1] 3 4 5 # importing the list with the default value of ask = TRUE will # cause R to wait on the user's approval. Typing this: # importList( data.list ) # would produce the following output: # Names of variables to be created: # [1] "group.A" "group.B" # Create these variables? [y/n] # If the user then types y, the new variables are created. # this version will silently import the variables. importList( x = data.list, ask = FALSE )
Documentation reproduced from package lsr, version 0.5, License: GPL-3

Community examples

Looks like there are no examples yet.