DS4PS / cpp-528-spr-2021

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

Lab 03 - Lab Tutorial Data Steps, here::here() #26

Open kirstenronning opened 3 years ago

kirstenronning commented 3 years ago

Hello, I am working on the Lab Tutorial, Data Steps section. I successfully saved the utilities.R and it seems to be running. However, I am running into issues on the project_data_steps.R file.

I have the following code: `import::here("build_year", "RELEVANT_FILES", "obtain_crosswalk", "create_final_metadata_file",

notice the use of here::here() that points to the .R file

         # where all these R objects are created
         .from = here::here("labs:wk03:utilities.R"),
         .character_only = TRUE)`

When I run it, I am receiving this message: Error: Cannot assign name to different value in the given environment. Name already in use.

cenuno commented 3 years ago

Hi @kirstenronning ,

My first instinct is to make sure you restart R and clear the global environment. The second step after that involves inspecting your relative path.

You're currently giving "labs:wk03:utilities.R" but I would expect the path to look like "labs/wk03/utilities.R". The delimiter here needs to be forward slash - / - rather than a colon. Try revising that and let me know how it goes.

kirstenronning commented 3 years ago

I cleared out my global environment, and resaved the utilities.R file with the forward slash. There seems to be no errors when I run this chunk of code, however when I move to the next one: for (relevant_file in RELEVANT_FILES) { print(paste0("Starting on ", relevant_file[["year"]])) build_year(fn1 = relevant_file[["fullcount"]], fn2 = relevant_file[["sample"]], year = relevant_file[["year"]]) if (relevant_file[["year"]] < 2010) { print("Finished! Moving onto the next decade.") } else { print("Finished! No more data to parse.") } }

I get an error that Error in file(file, "rt") : cannot open the connection In addition: Warning messages: 1: In file(file, "rt") : 'raw = FALSE' but '/Users/Kirsten/Documents/cpp-528-spr-2021-group-04-v2/data/raw/' is not a regular file 2: In file(file, "rt") :

Then, when I go back to run the first line, I get the same Error message from before:

Error: Cannot assign name to different value in the given environment. Name already in use.

cenuno commented 3 years ago

Hi @kirstenronning ,

Do you have the data/ directories? This happened to Meghan yesterday where she didn't realize she needed the data/ and data/raw/, data/wrangling/ and data/rodeo/ sub-directories. Try making those directories first and then restart and re-run this file.

kirstenronning commented 3 years ago

In my RStudio, I do have data/, data/raw/, data/rodeo/, and data/wrangling/. I did not have them last week, so I reopened a new RStudio Project in hopes of having all of the necessary files for this week's lab.

Screen Shot 2021-03-30 at 2 41 30 PM
cenuno commented 3 years ago

Thank you for the screenshot. I think you are not within your CPP 528 Group Project inside of RStudio which is a dependency in order to use here::here().

To get inside of the project, double click on the .Rproj file located within your cpp-528-spr-2021-group-04-v2 root directory.

cenuno commented 3 years ago

Screenshot 2021-03-30 145641

Here is what your RStudio should look like after you do click on the .Rproj file. Note that your project name will look different than mine; however, the file path under "New Folder" should read Home/cpp-528... rather than Home/Documents/...

kirstenronning commented 3 years ago

I did that, so now my file path reads Home/cpp-528... and now there aren't any of the sub-directories in my data/ folder. Do I need to manually add them now and start the tutorial over again?

cenuno commented 3 years ago

There's a lot of possibilities: entering the project could have moved you out of one branch and into another. You'd have to use GitHub Desktop to confirm.

If you need to just get started on the lab, recreating the folders yourself once more is the best bet.

cenuno commented 3 years ago

^however, if there is no data/raw/, you'd need to manually download the .zip files and unzip them again. This is where having a teammate who has done these data steps really comes into handy because you can just pull in the changes into main, create a new feature branch, and all those files will be readily available to you.

kirstenronning commented 3 years ago

I started manually adding the folders to my RStudio, but now my GitHub Desktop is not functioning as I would expect it to. It has 2 changed files on the sidebar, and I do not even know what they are (".DS_Store" and "labs/.DS-Store")? So I think that I am going to manually add the .zip files into my data/raw folder, because GitHub Desktop is really confusing me.

cenuno commented 3 years ago

That sounds good. Those are Mac files that are artifacts of using Finder. Place .DS_Store in gitignore and you shouldn’t see that anymore.

— Cristian E. Nuno


From: kirstenronning @.> Sent: Tuesday, March 30, 2021 3:35:34 PM To: DS4PS/cpp-528-spr-2021 @.> Cc: Cristian Ernesto Nuno @.>; Comment @.> Subject: Re: [DS4PS/cpp-528-spr-2021] Lab 03 - Lab Tutorial Data Steps, here::here() (#26)

I started manually adding the folders to my RStudio, but now my GitHub Desktop is not functioning as I would expect it to. It has 2 changed files on the sidebar, and I do not even know what they are (".DS_Store" and "labs/.DS-Store")? So I think that I am going to manually add the .zip files into my data/raw folder, because GitHub Desktop is really confusing me.

— You are receiving this because you commented. Reply to this email directly, view it on GitHubhttps://github.com/DS4PS/cpp-528-spr-2021/issues/26#issuecomment-810623383, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AFZB2S5UYPCMQJKSRQ3VBX3TGJG3NANCNFSM42C3EQUA.

kirstenronning commented 3 years ago

Are there instructions for pulling the changes into main and getting the files onto my RStudio from the GitHub Desktop? I see the files are already added to data/raw on the main branch on GitHub Desktop, but I am unsure how to get them to my RStudio. I apologize if this was something that has already been covered. I feel comfortable pushing changes, but I do not know how to pull into RStudio.

cenuno commented 3 years ago

Yes this is covered in the week 02 lecture and tutorial: GitHub feature branch workflow

— Cristian E. Nuno


From: kirstenronning @.> Sent: Tuesday, March 30, 2021 3:56:55 PM To: DS4PS/cpp-528-spr-2021 @.> Cc: Cristian Ernesto Nuno @.>; Comment @.> Subject: Re: [DS4PS/cpp-528-spr-2021] Lab 03 - Lab Tutorial Data Steps, here::here() (#26)

Are there instructions for pulling the changes into main and getting the files onto my RStudio from the GitHub Desktop? I see the files are already added to data/raw on the main branch on GitHub Desktop, but I am unsure how to get them to my RStudio. I apologize if this was something that has already been covered. I feel comfortable pushing changes, but I do not know how to pull into RStudio.

— You are receiving this because you commented. Reply to this email directly, view it on GitHubhttps://github.com/DS4PS/cpp-528-spr-2021/issues/26#issuecomment-810631881, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AFZB2S3WL4L5L62YEHWNVZDTGJJLPANCNFSM42C3EQUA.

kirstenronning commented 3 years ago

I just rewatched both the Lecture and Tutorial videos, and I am not seeing explicit instructions for getting Remote Main to match Local Main in RStudio. All I saw was pressing the "Fetch Origin" button, which does not seem to affect my RStudio in any way when I press it.

cenuno commented 3 years ago

Glad you watched them! The explicit instructions are in the videos and are also documented in this document. See steps 20-23 on page 10.

RStudio is sometimes delayed when you act outside of it (i.e. whenever you use GitHub Desktop). If you're confident you've pulled in the latest changes into the main branch, close RStudio, reopen it, re-enter the Project, and you should now see the data files.

cenuno commented 3 years ago

...I am not seeing explicit instructions for getting Remote Main to match Local Main in RStudio. All I saw was pressing the "Fetch Origin" button, which does not seem to affect my RStudio in any way when I press it.

The order of operations here is that remote main is usually farther along in its history than local main. You're trying to get local main to match remote main: a small distinction but an important one to keep in mind.

That's why we click "Fetch Origin": to tell our local instance of the repo to collect the commits that have occurred since the last time main was updated. It's highly likely that your teammates have submitted a pull request that has changed remote main.

Once you click on that button, you should be prompted to "Pull Origin": this means pull in all the commits from remote main into my local version of main. You now you're fully up to date when the latest commit within the "Changes" tab on GitHub Desktop matches what you are seeing on your group's repo.