Skip to content
This repository has been archived by the owner. It is now read-only.

Should I make an R Project for each assignment or all the assignments at once? #101

Open
ykdojo opened this issue Sep 22, 2015 · 7 comments

Comments

@ykdojo
Copy link

@ykdojo ykdojo commented Sep 22, 2015

Meaning, should I have multiple R projects in my repo or a single R project?

@samhinshaw
Copy link

@samhinshaw samhinshaw commented Sep 22, 2015

I believe @jennybc was advocating against multiple R projects, because then you would have nested R projects which could get messy. If I understood correctly, I believe the advice was simply to have one master R project containing subfolders with their own readme.mds. To organize this in RStudio, you can use the setwd() command when changing between, say, updating your "Master" readme.md and working on a specific homework assignment. Then, commit changes for the entire repository at once.

Your question is mentioned tangentially in the General Homework Guidelines under "Organization of your coursework repository".

I was also planning on spending some time looking through The unreasonable effectiveness of GitHub browsability before I got too far down the rabbit hole.

@BattaLiu
Copy link

@BattaLiu BattaLiu commented Sep 22, 2015

@jennybc
A related question, should we organize our local file that holds the master Rproject as the repository in Github? Or they will be the same every time we push our stuff?

@jennybc
Copy link
Member

@jennybc jennybc commented Sep 22, 2015

I advocate a one to one to one mapping between:

  • a directory on your computer (it can have subdirectories!)
  • an RStudio Project (just a directory w/ a .Rproj file)
  • a Git repo, that is connected to a GitHub remote

So @yosukesugishita NO I don't recommend multiple RStudio projects in a single repo. Now conceptually you could have a few "projects". In fact, think your course repo that way. You'll submit some work each week -- definitely separate little projects -- but they live together in one RStudio Project and Git repo.

@samhinshaw Thanks for your answer and links. Helpful!

@BattaLiu Not sure I completely follow. Am hoping what I said above answers your question?

@namanpaul
Copy link

@namanpaul namanpaul commented Sep 22, 2015

@BattaLiu I hope this helps, as per the "sample" repository @jennybc showed in the class today. Our repository would look like:

MAIN REPOSITORY

  • Homework directory
    • hw1 directory with all files for hw, easy to organize locally, and then push it
    • hw2
    • hw3
    • hw4... and so on.

Say, we are working in hw2 directory, created R markdown script, hw2.Rmd ; we need to be sure about having this hw2 directory as our current working directory, and everything would go smoothly.

Please suggest if this is correct @jennybc

@ykdojo
Copy link
Author

@ykdojo ykdojo commented Sep 23, 2015

Thank you for your comments, everyone.

I was wondering, what's the purpose of having an RStudio project in the first place?
What's the advantage of making an RStudio project over just using a simple folder?

@cheny19
Copy link
Member

@cheny19 cheny19 commented Sep 23, 2015

Having an RStudio project is that it helps you to group inputs, outputs and source files and other related files together. If you re-open the project, you can still see history commands.

For more detailed explanation, you can read here: https://stat545-ubc.github.io/block002_hello-r-workspace-wd-project.html#rstudio-projects, and here: https://support.rstudio.com/hc/en-us/articles/200526207-Using-Projects

@jennybc
Copy link
Member

@jennybc jennybc commented Sep 23, 2015

The two main purposes of having an RStudio project, beyond merely having the discipline to designate one directory per R project:

  • The foo.Rproj file gives you something to click on and launch an instance of R/RStudio, with working directory and a file browser pointed at a specific place.
  • Project-specific preferences about all sorts of things can be stored with the project (look at all the stuff that's configurable from Tools > Project Options.

This can mostly be achieved in an RStudio-free way (I was an Emacs + ESS user for > 10 years), but I find the RStudio Project approach is simply slicker.

Also, once your Projects start to have additional structure, such as being an R package or a build-able project with a Makefile, I'm pretty sure the RStudio Project-hood is necessary for some of the convenient support RStudio offers.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants