sum sum is a function that calculates the sum of a vector of values. Examples How do I get the sum of the values in a vector? Click to see solution sum(c(1,3,2,10,4)) [1] 20 How do I get the sum of the values in a vector when some of the values are: NA, NaN? Click to see solution sum(c(1,2,3,NaN), na.rm=T) [1] 6 sum(c(1,2,3,NA), na.rm=T) [1] 6 sum(c(1,2,NA,NaN,4), na.rm=T) [1] 7 abs min