magik of R implicit return [R for BE/BA]

posted by ElMaestro  – Belgium?, 2019-04-27 22:34 (521 d 21:46 ago) – Posting: # 20254
Views: 4,315

Hi all,

"smart" lost this round.

I always use explicit return(something) in my functions, when they are supposed to return a value regardless of whether it is a list, numeric, NULL or data frame some other thingy.

Yes, that involves tapping a few times more on the keyboard but it does solve a lot of problems and best of all, it makes code readable.

In language like C you would never run into this phenomenon. You declare explicitly which type the function returns and you will be bombarded with errors or warnings if you fail to return the right type of if you forget the return statement. I find it very comfortable.

I could be wrong, but...

Best regards,
ElMaestro

R's base package has 274 reserved words and operators, along with 1761 functions. I can use 18 of them (about 14 of them properly). I believe this makes me the Donald Trump of programming.

Complete thread:

Activity
 Admin contact
21,090 posts in 4,398 threads, 1,469 registered users;
online 17 (1 registered, 16 guests [including 4 identified bots]).
Forum time: Wednesday 20:21 CEST (Europe/Vienna)

When puzzled, it never hurts to read the primary documents 
a rather simple and self-evident principle that has, nonetheless,
completely disappeared from large sectors
of the American experience.    Stephen Jay Gould

The Bioequivalence and Bioavailability Forum is hosted by
BEBAC Ing. Helmut Schütz
HTML5