trimSum
trims (shortens) a vector in such a way that
the last or first value represents the sum of trimmed values. User needs
to specify the desired length of a trimmed vector.trimSum(x, n, right=TRUE, na.rm=FALSE, ...)
NA
values when applying a functiontrim
x <- 1:10
trimSum(x, n=5)
trimSum(x, n=5, right=FALSE)
x[9] <- NA
trimSum(x, n=5)
trimSum(x, n=5, na.rm=TRUE)
Run the code above in your browser using DataLab