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

posted by mittyri – Russia, 2019-04-27 22:23 (825 d 06:55 ago) – Posting: # 20253
Views: 5,128

(edited by mittyri on 2019-04-27 23:47)

Dear Detlew!

» Do you have the thousand sentences for me?
I have many of those, but for clarity I prefer a simplified version what was going on:

veryspecialfunction <- function(flag) {
  if (flag == 1) {
    "one"
  }
 
  if (flag == 2){
    "two"
  } 
}

Now running:
veryspecialfunction(2)
[1] "two"

veryspecialfunction(1)
# nothing here!
typeof(veryspecialfunction(1))
[1] "NULL"

Kind regards,
Mittyri

Complete thread:

Activity
 Admin contact
21,594 posts in 4,515 threads, 1,532 registered users;
online 20 (0 registered, 20 guests [including 3 identified bots]).
Forum time: Saturday 05:18 CEST (Europe/Vienna)

Restlessness is discontent –
and discontent is the first necessity of progress.
Show me a thoroughly satisfied man 
and I will show you a failure.    Thomas Alva Edison

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