Hi , please can you help me with the following :
the below is my original code:
addpercent <- function(x, mult = 100, FUN = round)
{percent <- FUN(x * mult)
paste(percent, "%", "")}
profits <- c(2100, 1430, 3580, 5230)
when i apply :
addpercent(profits, FUN = function(x){round(x / sum(x) * 100)})
profit values ONLY undergo the "" function(x){round(x / sum(x) * 100) "" and IGNORE THE ORIGINAL CODE
"" (x * mult) "" and gives the answer
FINE ..
BUT when i apply :
addpercent(profits, FUN = function(x){round(x + 100)})
profit values undergo ( BOTH ) the original code "" FUN(x * mult) "" FIRST, AND THEN undergo "" function(x){round(x + 100) "" and gives the answer
why is that difference r is treating the profit values with ??
much appreciate your help...