DS4PS / cpp-528-spr-2021

https://ds4ps.org/cpp-528-spr-2021/
0 stars 0 forks source link

What does `d2` represent in Lab 3 Tutorial? #20

Open Niagara1000 opened 3 years ago

Niagara1000 commented 3 years ago

Hi @cenuno ,

When I went over the tutorial for lab 3 again, I saw that d2 is assigned two different values. I was wondering why we use the variable d2 in the second screenshot below instead of an entirely different variable. Also, why are we re-assigning its value?


First value of d2

firstValueOfd2


Second value of d2

secondValueOfd2



EDIT : And another question I would like to add to this post is that I am unsure of why we run the code d.full <- d and then d <- d.full. In order to be able to knit my RMD, one of the changes I made was to delete d <- d.full. But I'm not sure if this was an essential code to keep.

Screen Shot 2021-03-28 at 9 59 38 AM



Thank you!

cenuno commented 3 years ago

Hi Archana,

That’s a great catch. That’s a mistake on my part. I should have created a new variable and not have reused d2.

In general, you avoid overwriting the same variable more than once so that you’re aware of it’s contents at all times. It also helps the reader understand what it means when it appears only once: which is why the use of %>% is so popular, it helps people understand what you’re doing to an object even when multiple functions are called that change the object’s value.

Cheers, Cristian

— Cristian E. Nuno


From: Niagara1000 @.> Sent: Sunday, March 28, 2021 9:57:16 AM To: DS4PS/cpp-528-spr-2021 @.> Cc: Cristian Ernesto Nuno @.>; Mention @.> Subject: [DS4PS/cpp-528-spr-2021] What does d2 represent in Lab 3 Tutorial? (#20)

Hi @cenunohttps://github.com/cenuno ,

When I went over the tutorial for lab 3 again, I saw that d2 is assigned two different values. I was wondering why we use the variable d2 in the second screenshot below instead of an entirely different variable. Also, why are we re-assigning its value?

First value of d2

[firstValueOfd2]https://user-images.githubusercontent.com/46457863/112760388-9fe9a080-8fab-11eb-978d-9d38b519f5d5.png

Second value of d2

[secondValueOfd2]https://user-images.githubusercontent.com/46457863/112760394-a5df8180-8fab-11eb-91bb-0457b5b1d9b6.png

Thank you!

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://github.com/DS4PS/cpp-528-spr-2021/issues/20, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AFZB2S3FTAPFS6FPD7Z2V5LTF5NWZANCNFSM4Z6G23RQ.

Niagara1000 commented 3 years ago

Hi Archana, That’s a great catch. That’s a mistake on my part. I should have created a new variable and not have reused d2. In general, you avoid overwriting the same variable more than once so that you’re aware of it’s contents at all times. It also helps the reader understand what it means when it appears only once: which is why the use of %>% is so popular, it helps people understand what you’re doing to an object even when multiple functions are called that change the object’s value. Cheers, Cristian — Cristian E. Nuno



Ohh ok, that makes sense.

Thank you! 🙏

Niagara1000 commented 3 years ago

Hi @cenuno ,

Another question I would like to add to this post is that I am unsure of why we run the code d.full <- d and then d <- d.full. In order to be able to knit my RMD, one of the changes I made was to delete d <- d.full. But I'm not sure if this was an essential code to keep.

Screen Shot 2021-03-28 at 9 59 38 AM



Thank you!

cenuno commented 3 years ago

Great observation. You do not need the d.full object.

It’s a practice used in tutorials to store a data frame that stores its state prior to mutations or dropping records.

Your intuition to remove is a good one in the sense that you’re picking up on what is needed and what is not. You’re building an R script that stores the necessary objects and demonstrating mastery of code in assembling an RMD file that is meant for a non technical audience.

— Cristian E. Nuno


From: Niagara1000 @.> Sent: Sunday, March 28, 2021 6:41:25 PM To: DS4PS/cpp-528-spr-2021 @.> Cc: Cristian Ernesto Nuno @.>; Mention @.> Subject: Re: [DS4PS/cpp-528-spr-2021] What does d2 represent in Lab 3 Tutorial? (#20)

Hi @cenunohttps://github.com/cenuno ,

Another question I would like to add to this post is that I am unsure of why we run the code d.full <- d and then d <- d.full. In order to be able to knit my RMD, one of the changes I made was to delete d <- d.full. But I'm not sure if this was an essential code to keep.

[Screen Shot 2021-03-28 at 9 59 38 AM]https://user-images.githubusercontent.com/46457863/112760733-f0adc900-8fac-11eb-8864-dbbd029f3975.png

Thank you!

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://github.com/DS4PS/cpp-528-spr-2021/issues/20#issuecomment-809009444, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AFZB2S3SNBOTE645ZYCHLBDTF7LELANCNFSM4Z6G23RQ.

Niagara1000 commented 3 years ago

Hi @cenuno ,

Another question I have regarding the following part of the Lab 3 Tutorial is I'm confused about why we create d2, a new variable, but then it's used under the sentence "Recall our steps so far" when we did not actually use it yet.

Instead of d2 what variable was supposed to be there in that code chunk?

Here is the screenshot for reference. I'm referring to the part right under the red box

secondValueOfd2
cenuno commented 3 years ago

d2 is a carbon copy of d.full. The “recall” section recalls the logic we used in our original data frame (d) within the “exploration of median home value” section.

It’s repeated for teaching purposes only.

— Cristian E. Nuno


From: Niagara1000 @.> Sent: Monday, March 29, 2021 9:38:47 AM To: DS4PS/cpp-528-spr-2021 @.> Cc: Cristian Ernesto Nuno @.>; Mention @.> Subject: Re: [DS4PS/cpp-528-spr-2021] What does d2 represent in Lab 3 Tutorial? (#20)

Hi @cenunohttps://github.com/cenuno ,

Another question I have regarding the following part of the Lab 3 Tutorial is I'm confused about why we create d2, a new variable, but then it's used under the sentence "Recall our steps so far" when we did not actually use it yet.

Instead of d2 what variable was supposed to be there in that code chunk?

Here is the screenshot for reference. I'm referring to the part right under the red box

[secondValueOfd2]https://user-images.githubusercontent.com/46457863/112869733-5021dc80-9072-11eb-90a0-3823a9781e47.png

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://github.com/DS4PS/cpp-528-spr-2021/issues/20#issuecomment-809531056, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AFZB2S42LJS3WGOJR2RRSLTTGCUJPANCNFSM4Z6G23RQ.

trioptre commented 3 years ago

Hi @cenuno -

Can you update/correct the lab 3 instructions to reflect the above? I thought my code was wrong and haven't been able to get it working properly. I wish I stumbled across this thread 22 days ago; i've been re-doing the lab over and over thinking I was doing something wrong!

cenuno commented 3 years ago

Hi Dave,

I have removed the use of d2 in the latter portion of the lab (see #53 for a detailed walk through of exactly which changes were made) This was not affecting other students which is why this change was not made sooner.

It is best practice to check in on GitHub issues to see what other students are going through. That is why they are public facing and searchable.

Cheers, Cristian