You can use ? followed by the function() or class(variable) it can provide you the class (or data type) of the output it can return.
It's not suggested to do so for every function you use, so you can try explicitly converting your output into the required data type for the functions or operations that you are performing.
Some function has a default return type of the output that it returns, except those few you can try converting others as long as the conversion is possible and valid.
You can use functions such as unlist(), as.[array/character/data frame/Date], etc that are vailable in R for conversions.