6
I have a data.frame
with 13 columns and 78 rows. I need to do it for each column ((x1/x2)^12)-1
, being x1
the value in the first row of the first column, x2
the value contained in the second row of the first column, and I need to apply this function to all lines. To automate the process I thought to use the function rollapply
, the problem is in the function design. How can I, in r, use the successive values of a column as arguments of a function?
"where X1 is the value contained in the first row of the first column, x2 is the value contained in the second row of the first column, and this function must be applied for all rows". Here you mean you need to apply the function to all columns, right?
– Carlos Cinelli