Say that I start with a dataframe. I want to perform a function on each row. The function will take multiple columns of the row as arguments. I want the end result to be a list of dataframes, where each dataframe corresponds to a row of the original dataframe. How can I do this? I am getting confused with the various apply functions and some other functions in the tidyverse.
Here is an example:
I start with this dataframe:
a <- data.frame(a= c(1,2), b=c(2,3), c=c(0,0))
I would like to perform a function that simply adds columns a, b, and c. The output is the result, where each row's sum is contained in a dataframe. The name of the dataframe should correspond to the row number.
b <- list(r1=data.frame(3), r2=data.frame(5))