Let’s say I have a list of objects in the global environment. How would I pull only those that have a specific attribute set?
x1 <- 1:10
x2 <- 1:10
x3 <- 1:10
x4 <- 1:10
x5 <- 1:10
attr(x1, "foo") <- "bar"
attr(x5, "foo") <- "bar"
How do I pull x1 and x5 based on the fact that they have the attribute “foo” as “bar”?
Here is one way to do it