I want create an empty list which takes on the name of a dataframe and has empty elements inside based on the name of the dataframe
What I've Tried - Does Not Work
my_list_function <- function(thedata) {
list(
x = map(names(x), ~ .x = list())
))
}
I want to be able to run
my_list_function(mtcars)
and get the output:
Desired Output
list(
mtcars = list(
mpg = list(),
cyl = list(),
disp = list(),
hp = list(),
drat = list(),
wt = list(),
qseq = list(),
vs = list(),
am = list(),
gear = list(),
carb = list()
)
)