Hi @pieterjanvc
Perhaps I did not express myself clearly enough. Let's have a look at the following example data frame, which is similar to the original:
data.frame(
StockA = c(15, 20, 26, 10, 5),
StockB = c(27, 16, 15, 10, 23),
date = as.factor(c("2020-03-01",
"2020-03-02","2020-03-03",
"2020-03-04","2020-03-04"))
)
What I try to do is to divide all column values of the columns StockA and StockB by the values in a certain row. For example, I want all values in the columns StockA and StockB to be divided by the values in row 2020-03-02 (i.e. 20 and 16 respectively). Therefore the values in this row are normalized to 1 and the other values are adjusted accordingly. But I did not find any code for this, because I do not want to select the corresponding lines for the code by [x,] but by explicitly mentioning the date of the row. In addition, the original data frame is much larger, so it is not possible to do it manually by just dividing each column by the row value.
Hopefully it is clearer now and thanks in advance.