Read the documentation for the sum()
function, most likely there are missing values (NA) in your data frame, if you want to ignore them, you need to set na.rm = TRUE
If you need more specific help, please provide a proper REPRoducible EXample (reprex) illustrating your issue.