This function takes as an argument a named list and assigns values to the calling environment where the assignments have the same names as the list elements. For example, if the list is named list(a = 1, b = 2), then assignList(list) will create an object variable named a with a value of 1 and an object b a value of 2 in the calling environment.
Examples
# create a named list
myList <- list(a_TEMP = 1, b_TEMP = 2, c_TEMP = 'three')
ls() # What is in the environment before we assign the list?
#> [1] "myList"
assignList(myList)
ls() # What is in the environment after we assign the list?
#> [1] "a_TEMP" "b_TEMP" "c_TEMP" "myList"
any(ls() == 'a_TEMP') # Check if the variable a_TEMP was created in the environment
#> [1] TRUE
any(ls() == 'b_TEMP') # Check if the variable b_TEMP was created in the environment
#> [1] TRUE
any(ls() == 'c_TEMP') # Check if the variable c_TEMP was created in the environment
#> [1] TRUE
rm(a_TEMP, b_TEMP, c_TEMP) # Clean up the environment
