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

posted by mittyri – Russia, 2019-04-27 20:23 (721 d 03:45 ago) – Posting: # 20253
Views: 4,834

(edited by mittyri on 2019-04-27 21: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,419 posts in 4,475 threads, 1,511 registered users;
online 16 (0 registered, 16 guests [including 3 identified bots]).
Forum time: Sunday 00:09 UTC (Europe/Vienna)

Nothing fails like success because you do not learn anything from it.
The only thing we ever learn from is failure.
Success only confirms our superstitions.    Kenneth E. Boulding

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