Introduction to R: Control Flow

Поделиться
HTML-код
  • Опубликовано: 22 авг 2024

Комментарии • 4

  • @musicspinner
    @musicspinner 3 года назад +1

    You've done an excellent job with this R series. 👌

  • @japhethjay4880
    @japhethjay4880 Год назад

    He actually wrote else if and says if else , I don’t think this guy is a programmer, but amazing tutorials love them, they’ve been quite helpful, keep up , you earned a like and a sub and references to your channel

  • @KuroSan97
    @KuroSan97 4 года назад +2

    Very nice video, when I was trying to work through the notebook. I wanted to try printing the name of passengers in Exercise 2 of Control Flow. I can't seem to do it from inside the loop. Any help would be appreciated.

    • @DataDaft
      @DataDaft  4 года назад +2

      If you wanted to print passenger names of all passengers one after the other you could do this:
      for (passenger in titanic_train$Name){
      print(passenger)
      }
      If you only wanted to print passengers names over age 64, you could do it with something like this:
      for (passenger in titanic_train$Name){
      if (titanic_train$Age[which(titanic_train$Name == passenger)] >= 65){
      print(passenger)
      }
      }