Well, i have sort of a solution, but I find it be very "clunky" (dirty).
$test.df
X1 X2 X3
1 1 2 3
2 2 2 1
3 1 3 1
4 3 1 1
this is my solutiuon
test.df <- read.delim2(file = "test.df.txt")
i <- c(2:3)
tmp <- data.frame()
tmp2<- list()
tmp2[[1]]<- test.df[,1]
for (col_i in i) {
print(col_i)
tmp <- apply(test.df[1:col_i], 1, sum)
tmp2[[col_i]] <- tmp
}
But I was hoping to find something more elegant and slick, if possible.
This post is more suitable at SO.
This post does not fit the theme of this forum.