How can i substitute this code with a loop?
m1 <- ggplot(foo)
m2 <- ggplot(foo)
...
m9 <- ggplot(foo)
I guess i need something like get() to replace magic(), But get did not work here.
for (i in 1:9){
magic(i) <- ggplot(foo)
}
Use a list:
out <- list()
for (i in 1:9){
out[[i]] <- ggplot(foo)
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With