EDIT: I think using lapply / sapply here is causing too many problems. You should definitely use mget answer.
You can try:
mylist <- sapply(setdiff(ls(),"B"), get)
In some cases, i.e. if all the objects in your workspace are of the same type, sapply will return a vector. For instance:
sapply(setdiff(ls(),"B"), get) # AC # 1 3
Otherwise, it will return a list:
v <- list(1:2) sapply(setdiff(ls(),"B"), get)
Thus, using lapply instead of sapply here may be safer, as Josh O'Brien pointed out.
source share