You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In Analyzing Multiple Data Sets, several downsides of writing individual print statements are listed:
It doesn’t scale: if we want to print the elements in a vector that’s hundreds long, we’d be better off just typing them in.
It’s fragile: if we give it a longer vector, it only prints part of the data, and if we give it a shorter input, it returns NA values because we’re asking for elements that don’t exist!
As I was preparing for the live demo, I kept making typos when writing each print statement, which I think would be a great addition to the list of reasons to use a for loop. Making typos is a very relatable downside, and I think it would help drive home why for loops are useful.
In addition, the lesson mentions the length() function after showing that "a loop variable is just a variable that’s being used to record progress in a loop". When I was working through the lesson, this seemed out of order, because at that point we have moved on from the example where a for loop is used to repeatedly update the value of a variable. Moving the discussion of the length() function to immediately follow the vowels example will create a more organized lesson, and appease more experienced R users who may be thinking "why not just use length()?" a that moment.
The text was updated successfully, but these errors were encountered:
Hi @MadeleineGastonguay, thanks so much for taking time to bring this up! I think your suggestions are fantastic. Would you be willing to make a PR with the changes so we can discuss this further?
In Analyzing Multiple Data Sets, several downsides of writing individual print statements are listed:
As I was preparing for the live demo, I kept making typos when writing each print statement, which I think would be a great addition to the list of reasons to use a for loop. Making typos is a very relatable downside, and I think it would help drive home why for loops are useful.
In addition, the lesson mentions the
length()
function after showing that "a loop variable is just a variable that’s being used to record progress in a loop". When I was working through the lesson, this seemed out of order, because at that point we have moved on from the example where a for loop is used to repeatedly update the value of a variable. Moving the discussion of thelength()
function to immediately follow the vowels example will create a more organized lesson, and appease more experienced R users who may be thinking "why not just uselength()
?" a that moment.The text was updated successfully, but these errors were encountered: