anyone-can-cook / rclass1

EDUC 260A: Introduction to Programming and Data Management Using R
https://anyone-can-cook.github.io/rclass1/
5 stars 5 forks source link

editing PS7 and PS8 #87

Closed ozanj closed 2 years ago

ozanj commented 2 years ago

Hey @augias -

I have an assignment for you regarding PS7 and PS8. obviously count this as part of your ten hours.

PS7 and PS8 problem sets are focused on creating the GPA variable from course-level data. we do this in two weeks rather than one cuz students find it too much for one week.

The assignment is this:

seems easy enough, right!

but there is a catch that (at least in the past) there are situations where if_else will not work. I believe I discuss this starting on slide 21 of the "data quality" lecture. I recall this has something to do w/ the labelled class. https://anyone-can-cook.github.io/rclass1/lectures/data_quality/data_quality.pdf

so if we can change any instances of ifelse in PS instructions/solutions, without any problems, then do so.

if problems will arise, then think of best approach and we can discuss.

happy to answer any questions you have. and thank you! ozan.

augias commented 2 years ago

Alright, ill hop on this when i get off tha bus.

ozanj commented 2 years ago

cool. thx fernando. doesn't have to be tonight. just before class on friday.

augias commented 2 years ago

Hey @ozanj finnaly getting a look at this. If we want students to use if_else, then the two logical outcomes have to be the same class.

For ps6 in question 2.4 you ask for NA for any grade higher than 4. Not possible with if_else, but we can change the instructions to say "change values for anything greater than 4 to 999. Another common missing value.

Same for Q2.5.

Q 2.8 we can use if_else because the two outcome conditions are numeric.

I recommend either "change values > 4 to 9999" or change all instructions to say "use base R's ifelse() function.

For ps 8 there's only one call to ifelse and its similar to the previous where we ask for mixed class outputs. Again I recommend we change instructions to 9999 instead of NA and explain why, or stick to ifelse and forget using if_else until labelled classes become a concern (which they are not in the four cases i outlined above)

Tell me what your choice is. I'll update both problem sets and we / I can tell students to download the problem set anew tomorrow.

ozanj commented 2 years ago

Let's go with base R ifelse but add a bit of explanation why on ps instructions.

Does this seem like a good decision to u?

On Thu, Nov 3, 2022, 9:25 PM Fernando Mora @.***> wrote:

Hey @ozanj https://github.com/ozanj finnaly getting a look at this. If we want students to use if_else, then the two logical outcomes have to be the same class.

For ps6 in question 2.4 you ask for NA for any grade higher than 4. Not possible with if_else, but we can change the instructions to say "change values for anything greater than 4 to 999. Another common missing value.

Same for Q2.5.

Q 2.8 we can use if_else because the two outcome conditions are numeric.

I recommend either "change values > 4 to 9999" or change all instructions to say "use base R's ifelse() function.

For ps 8 there's only one call to ifelse and its similar to the previous where we ask for mixed class outputs. Again I recommend we change instructions to 9999 instead of NA and explain why, or stick to ifelse and forget using if_else until labelled classes become a concern (which they are not in the four cases i outlined above)

Tell me what your choice is. I'll update both problem sets and we / I can tell students to download the problem set anew tomorrow.

— Reply to this email directly, view it on GitHub https://github.com/anyone-can-cook/rclass1/issues/87#issuecomment-1302951565, or unsubscribe https://github.com/notifications/unsubscribe-auth/AHGH2XPNYOEBWNWUQHMKNKLWGSFYNANCNFSM6AAAAAARVQVSZA . You are receiving this because you were mentioned.Message ID: @.***>

augias commented 2 years ago

You bet. I'll put an explanation at the first mention of ifelse() in q2

Ps7 and 8 will be live after we finish watching the british baking show 8-)

ozanj commented 2 years ago

Thx big guy!

In ps instructions u can refer to relevant section of lecture where I explain this

On Thu, Nov 3, 2022, 9:45 PM Fernando Mora @.***> wrote:

You bet. I'll put an explanation at the first mention of ifelse() in q2

Ps7 and 8 will be live after we finish watching the british baking show 8-)

— Reply to this email directly, view it on GitHub https://github.com/anyone-can-cook/rclass1/issues/87#issuecomment-1302963242, or unsubscribe https://github.com/notifications/unsubscribe-auth/AHGH2XO4OGOHNY5P4XKAITTWGSIEDANCNFSM6AAAAAARVQVSZA . You are receiving this because you were mentioned.Message ID: @.***>

augias commented 2 years ago

Give this a once-over if you can? https://ucla.app.box.com/file/879199341857?s=ht6c3t1dck4crnyb83inrt49ayi7wc9w

new wording on the question and a note below the example code chunk for Q2.4 that reads

Create and retain a new crsgradb_v2 variable that replaces all values greater than 4 in crsgradb to NA (hint: you can use the mutate() and base R's ifelse() functions to either replace the value to NA or keep the current value of the variable based on whether the expression you specify evaluates to TRUE or FALSE). See below...

-code chunk-

"Note: we ask you to use ifelse()from base R and not tidyverse's if_else because the latter does not allow you to mix two classes of variables to your output. In our case, if_else would evaluate NA as a logical class and the crsgradb as numeric and cause an error. You can check lecture notes about this topic on slide 21."

ozanj commented 2 years ago

👍👍👍

On Thu, Nov 3, 2022, 10:22 PM Fernando Mora @.***> wrote:

Give this a once-over if you can? https://ucla.app.box.com/file/879199341857?s=ht6c3t1dck4crnyb83inrt49ayi7wc9w

new wording on the question and a note below the example code chunk for Q2.4 that reads

Create and retain a newcrsgradb_v2variable that replaces all values greater than 4 incrsgradbtoNA(hint: you can use themutate()and base R’sifelse()functions to either replace thevalue toNAor keep the current value of the variable based on whether the expression you specifyevaluates toTRUEorFALSE). See below. . .

-code chunk-

"Note: we ask you to use ifelse()from base R and not tidyverse's if_else because the latter does not allow you to mix two classes of variables to your output. In our case, if_else would evaluate NA as a logical class and the crsgradb as numeric and cause an error. You can check lecture notes https://anyone-can-cook.github.io/rclass1/lectures/data_quality/data_quality.pdf about this topic on slide 21."

— Reply to this email directly, view it on GitHub https://github.com/anyone-can-cook/rclass1/issues/87#issuecomment-1302990589, or unsubscribe https://github.com/notifications/unsubscribe-auth/AHGH2XN3IQIIBOISMPUQLYLWGSMOPANCNFSM6AAAAAARVQVSZA . You are receiving this because you were mentioned.Message ID: @.***>