geanders / futureheatwaves

Functions to Identify and Characterize Heatwaves in Climate Projections
3 stars 0 forks source link

Return values #27

Closed ColinAE closed 8 years ago

ColinAE commented 8 years ago

I just remembered that R functions always returns the last expression evaluated. Therefore, all functions have return values. How should the documentation reflect functions whose return values are not meant to be used? Additionally, what return values should a function have if it is one of those functions?

For gen_hw_set (the newly renamed 'main' function), I could just return a success or fail flag (0 or 1).

geanders commented 8 years ago

Yes, I think a fail flag would be fine. For the documentation, I think we could put something like that it returns a binary flag, etc., and then add that, in running, it creates and writes files with identified and characterized heatwaves for the climate projections and cities input.

geanders commented 8 years ago

Check what I did for gen_hw_set. It now returns the model information (also still writes it out like it did before), since that's probably one of the first things someone would want to check to confirm everything ran well.

ColinAE commented 8 years ago

That works fine. I suppose this isn't actually a problem, since almost all of the functions have return values we wish to use.