Problem with object types creating a function

Hi, can you provide a reproducible example of baseTot? It would make it easier to help and we don't have your dataset.