I\'m creating lots of datasets with a loop and I need to make sure that all these different datasets are properly named and stored in the workspace. My question is the following
You can use list2env()
.
list2env(AllDatasets, .GlobalEnv)
Now e
, f
, g
, h
and i
are available in your workspace (global environment in this case, you can specify a different environment in the second argument if you like).
To assign a name from a string you can use assign()
. E.g. in response to Marco's comment below:
D <- data.frame(rnorm(1:10), rnorm(1:2))
Name <- 'ThatOne'
assign(Name, D)
Or directly with a string:
assign('ThatOne', D)