Data Frame dividing column values by the respective row value

Hi,

It's not entirely clear what you like to do, so maybe if my suggestion below is not what you are looking for, create a reprex following the guide below. A reprex consists of the minimal code and data needed to recreate the issue/question you're having. You can find instructions how to build and share one here:

You can use the group_by() from dplyr to perform actions on certain rows like this

library(dplyr)

#Generate some random data
set.seed(10)
myData = data.frame(
  date = as.Date(sample(c("2020-11-19", "2020-11-18"), 10, replace = T)),
  val1 = 1:10, val2 = runif(10))

myData
#>          date val1       val2
#> 1  2020-11-19    1 0.65165567
#> 2  2020-11-19    2 0.56773775
#> 3  2020-11-18    3 0.11350898
#> 4  2020-11-18    4 0.59592531
#> 5  2020-11-18    5 0.35804998
#> 6  2020-11-19    6 0.42880942
#> 7  2020-11-18    7 0.05190332
#> 8  2020-11-18    8 0.26417767
#> 9  2020-11-19    9 0.39879073
#> 10 2020-11-19   10 0.83613414

#Apply functions by group (in this case date)
myData %>% group_by(date) %>%
  mutate(val1 = scale(val1)[,1],
         val2 = (val2 - min(val2)) / (max(val2) - min(val2)))
#> # A tibble: 10 x 3
#> # Groups:   date [2]
#>    date          val1   val2
#>    <date>       <dbl>  <dbl>
#>  1 2020-11-19 -1.14   0.578 
#>  2 2020-11-19 -0.892  0.386 
#>  3 2020-11-18 -1.16   0.113 
#>  4 2020-11-18 -0.675  1     
#>  5 2020-11-18 -0.193  0.563 
#>  6 2020-11-19  0.0991 0.0686
#>  7 2020-11-18  0.772  0     
#>  8 2020-11-18  1.25   0.390 
#>  9 2020-11-19  0.842  0     
#> 10 2020-11-19  1.09   1

Created on 2020-11-19 by the reprex package (v0.3.0)

Hope this helps,
PJ