79427701

Date: 2025-02-10 16:34:10
Score: 0.5
Natty:
Report link
relchange <- function(x, first = FALSE) {
  x[!is.na(x)] <- c(1, exp(diff(log(x[!is.na(x)]))))
  return(x)
}

relchange(dt$sale)
 [1]        NA        NA        NA        NA 1.0000000 0.6930112 1.3048314
 [8] 1.4211981 5.3062771 1.0084781 1.1261770 1.1349657
Reasons:
  • Low length (0.5):
  • Has code block (-0.5):
  • Low reputation (0.5):
Posted by: Adrian