I have a number of large DFs and I want to loop through them. Instead of binding them together to make a big list I thought I should make a simple vector with their names an
In your own code, just replace print(nrow(i))
with print(nrow(get(i)))
, since i is: chr "DF1" etc.
for (i in MyDFs) {
print(nrow(get(i)))
}
[1] 3
[1] 3
[1] 3
Or
sapply(mget(MyDFs),nrow)
#DF1 DF2 DF3
# 3 3 3
If you don't want to create a vector MyDFs
sapply(mget(ls(pattern="DF")), nrow) #should also work