79168556

Date: 2024-11-08 02:03:51
Score: 2.5
Natty:
Report link

Does this do what you're looking for?

df$Percentage <- 
  rowSums(df[as.character(yrs)]) /
  rowSums(
    outer(df$CofQYr, yrs, FUN = function(x, y) y <= (yrs[length(yrs)]-as.integer(x))) *
    as.matrix(df[as.character(yrs)])[match(df$TRADE, ifelse(df$CofQYr=="Total", df$TRADE, NA)),]
  )
Reasons:
  • Low length (0.5):
  • Has code block (-0.5):
  • Ends in question mark (2):
  • Low reputation (0.5):
Posted by: Eonema