I want to be able to see summary output for few columns of iris (inbuilt dataset) inside loop using below construct, I saw here , mget might be a solution but guess its not. Can someone help here with the latest & effective way to run it
l <- c("Sepal.Length","Sepal.Width")
for(i in l){
print(summary( mget(paste0("iris$",l))))
}
I get an error on running above
Error: value for ‘iris$Sepal.Length’ not found
Q2 How would this work for different dataframe
l <- c("iris","mtcars")
for(i in l){
print(summary( mget(l)))
}