I am trying to write a loop that will summarize my set of matrices that all start with the same name plus a number (e.g. “day11”). However, in each run of the loop the number of matrices varies.
Without the loop it can be done once like this:
combmat<-(day1+day3+day4+day5+day6+day8+day9+day10+day11+day12+day13+day14+day15+day16+day17+day18+day19+day20+day22+day23+day24+day25+day26+day27+day28+day29)
I have tried
sum(list=ls(pattern="^day"))
without any luck …
Thank you!
Maybe something like
will work for you
getreturns the value of a named object. Soget("x")would return the variable x