You can just use sum(people$Weight)
.
sum
sums up a vector, and people$Weight
retrieves the weight column from your data frame.
Note - you can get built-in help by using ?sum
, ?colSums
, etc. (by the way, colSums
will give you the sum for each column).