Store (almost) all objects in workspace in a list
Let's say that I have many objects in my workspace (global environment)
and I want to store most of those in a list. Here's a simplified example:
# Put some objects in the workspace
A <- 1
B <- 2
C <- 3
I would like to store objects A and C in a list. Of course, I can do that
explicitly:
mylist <- list(A,C)
However, when the number of objects in the workspace is very large, this
would become rather cumbersome. Hence, I would like to do this differently
and attempted the following:
mylist <- list(setdiff(ls(),B))
But this obviously is not what I want, as it only stores the names of the
objects in the workspace.
Any suggestions on how I can do this?
Many thanks!
No comments:
Post a Comment