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

posted by ElMaestro  – Belgium?, 2019-04-27 20:34  – Posting: # 20254
Views: 2,086

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

Complete thread:

Activity
 Mix view
Bioequivalence and Bioavailability Forum |  Admin contact
19,879 posts in 4,214 threads, 1,364 registered users;
online 5 (0 registered, 5 guests [including 4 identified bots]).
Forum time (Europe/Vienna): 21:53 UTC

Statistics. A sort of elementary form of mathematics which consists of
adding things together and occasionally squaring them.    Stephen Senn

The BIOEQUIVALENCE / BIOAVAILABILITY FORUM is hosted by
BEBAC Ing. Helmut Schütz
HTML5