Data analysis using R - Answers, Branching, and Looping - Lecture 2 (Part 1)

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

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

  • @michelainajohnson1737
    @michelainajohnson1737 Год назад +2

    Are the presentation slides and assignments still available? If so, how might I access them?

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

      Slides, assignments, data, and answers are still available form my website:
      - lectures can be downloaded from here: dannyarends.nl/lectures/
      - A zip file with all the assignments, answers and data is here: dannyarends.nl/assignments/Answers.zip
      in case you run into an issue (some people had issues with downloading via MS Edge), try another browser. If you still aren't able to download, or get a corrupted download, feel free to send me an email (my email address is in the about section) and I can send you the lectures, assignments, answers and data via email.

  • @Arsonist13
    @Arsonist13 7 месяцев назад +2

    Thanks!

    • @DannyArends
      @DannyArends  7 месяцев назад

      You're welcome, thanks for your support

  • @021.sohanurrahman6
    @021.sohanurrahman6 Год назад +1

    thanks sir. i enjoyed your teaching

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

      Thanks for taking the time to leave me a comment and let me know. And enjoy learning R

  • @tamimhekmatpey2729
    @tamimhekmatpey2729 Год назад +1

    How can I get a copy of the Zoom voting csv file?

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

      I don't think I have that file anymore (since I moved jobs) I will look for it in my backup see if I can find it.

    • @tamimhekmatpey2729
      @tamimhekmatpey2729 Год назад +1

      @@DannyArends thanks Danny .. I learned a lot from your lecture on R . Job well done sir !

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

      You're welcome, good to hear you learned a lot.

  • @datascience1274
    @datascience1274 2 года назад +1

    Hi Danny, great content. I have a question about the code below. I don't seem to be able to explain why they included [,1] in the code. What is the theoretical explanation behind that?
    The code doesn't work without it. Thanks a lot in advance.
    for(i in c(2,6:11)){
    a=(abs(scale(Data[,i])[,1])

    • @DannyArends
      @DannyArends  2 года назад

      That's tricky without knowing what Data is, my guess is that the scale function takes a vector, but outputs a matrix (perhaps you can input multiple vectors as separate parameters), so they use [,1] to take the first column of the matrix return by the scale function. I'd look at the code/help of ?scale to see what the output is.
      The code looks weird though, especially the Data = Data[a,] which overwrites Data. If nothing is lower than 3 the Data variable is put to NULL and the code would crash on the next iteration.
      I'd be very sceptical about this code. It contains too many code smells (hard coded column indexes, overwriting the variable your working with in the loop while you're working on it, using Data as variable name (non-speaking name), a variable named a). This code seems wrong and unmaintainable no one will know what it's supposed to do and how it does it in 9 months time.

    • @datascience1274
      @datascience1274 2 года назад

      @@DannyArends thanks a lot. I think that probably the scale function returns a list. So Data[a,] takes all the TRUE values (less than 3) stored in a. Is that possible?

    • @DannyArends
      @DannyArends  2 года назад +1

      Yes it keeps the rows from Data for which the scaled absolute values are below 3 for the columns mentioned in the for-loop.
      Ps. If scale returns a list, using [[1]] instead of [,1] would be the preferred way of selecting the first element

    • @datascience1274
      @datascience1274 2 года назад

      @@DannyArends thank you so much