Projects
This lesson is called Projects, part of the Getting Started With R course. This lesson is called Projects, part of the Getting Started With R course.
Transcript
Click on the transcript to go to that point in the video. Please note that transcripts are auto generated and may contain minor inaccuracies.
Your Turn
Download the course project using this code:
install.packages("usethis")
library(usethis)
use_course("https://rfor.us/getting-started-materials")
Open the project and look at the files within it.
Note: By default, the project will download and open on your desktop. If you want to change the location, you can use this code (replace the C:/Users/david/Documents
with a file path that actually exists on your system):
use_course("https://rfor.us/getting-started-materials",
destdir = "C:/Users/david/Documents")
However, we've seen many people run into issues when trying to change the location of the download in this way. Instead, my recommendation would be to download it to the default location and, if desired, move the entire folder using the Finder (Mac) or File Explorer (Windows) app.
Learn More
The RStudio website has a good overview of projects, as does the Teach Data Science website.
If you want to go really deep, there’s a nice video on LinkedIn Learning titled Why should you use projects in RStudio?
Have any questions? Put them below and we will help you out!
Course Content
12 Lessons
You need to be signed-in to comment on this post. Login.
Ben Gunderson • September 11, 2023
Hi David,
This download course code worked on my personal mac, but I'm trying to get it working on my work Windows laptop. It keeps returning this error:
Help me troubleshoot?
Ben Gunderson • September 12, 2023
Forgot to mention: I made sure to update my version already! Saw you mentioned that as a solution in the public version of this course.
Ben Gunderson • September 12, 2023
Please disregard! I just had to install the vctrs package and it worked. :)
David Keyes Founder • September 13, 2023
Glad you figured it out!
Michele Parsons • September 15, 2023
When I try to download the course project I keept getting this error message:
Michele Parsons • September 15, 2023
Disregard...figured it out.
Samreen Chhabra • October 5, 2023
Hi David, I'm getting this error while downloading the project: trying URL 'https://cran.rstudio.com/bin/windows/contrib/4.3/usethis_2.2.2.zip' Content type 'application/zip' length 897217 bytes (876 KB) downloaded 876 KB
When I tried to manually type out the code, I got these: package ‘yaml’ successfully unpacked and MD5 sums checked package ‘usethis’ successfully unpacked and MD5 sums checked
I didn't get any of the 'yes' 'no' absolutely' options mentioned in the video- please help! Thank you!
David Keyes Founder • October 5, 2023
I'm not sure why you didn't get the yes/no messages, but it does seem like the package was installed. Can you please try running these two lines and let me know what happens?
Samreen Chhabra • October 6, 2023
Hi David, this code worked! Thank you so much.
Laura Bracun • October 29, 2023
I get an error "Error in library(usethis) : there is no package called ‘usethis’", it the file does not want to load for me
Laura Bracun • October 29, 2023
Peer certificate cannot be authenticated with given CA certificates: [] SSL certificate problem: certificate has expired, I get this error
David Keyes Founder • October 29, 2023
You almost certainly need to install the
usethis
package still. Please do this by running this in the consoleIf you tried this yesterday and it didn't work (possibly due to the certificate error you posted), please try again today. There were some issues yesterday with installing packages that should be resolved now.
Heather K • November 1, 2023
I would like to save the files to a different directory. I see "Prefer a different location? Cancel, try again, and specify
destdir
" I tried just running destdir 'C:/Users/myname/destination/' but that didn't work. Can you help? How do I "cancel"? Thanks!David Keyes Founder • November 3, 2023
I'm not sure how you cancel because I've never done this, but the location you're trying to save to in the code you shared almost certainly doesn't exist. You'll need to change
C:/Users/myname/destination/
to a real location and then it should work.Alberto Cabrera • November 3, 2023
install.packages("usethis") library("usethis") use_course("https:/rforus/getting-started-materials")
I wonder if it would be possible to modify the script so that the materials would be download in at already created directory. In my case "~/Documents/R-books/Getting started with R". I had already created a project jumping ahead the lesson.
David Keyes Founder • November 3, 2023
Yes, you can use the
destdir
argument to put the project in a different location if you'd like to.Alberto Cabrera • November 4, 2023
Thanks for the prompt reply, and the suggestion of using destdir. Unfortunately, I am not familiar with destdir and could not find examples.
Libby Heeren Coach • November 6, 2023
destdir
is an argument to theuse_course()
function, so you'd use it like this:use_course("https:/rforus/getting-started-materials", destdir = "C:/Users/libby/Documents/R for the Rest of Us")
(but with your own file path of course!)Nancy Moeller • January 12, 2024
I am having difficulty installing the example data. My error message is: Warning in install.packages : package ‘usethis’ is not available (for R version 3.4.1)
Is there another way for me to download the necessary files?
David Keyes Founder • January 12, 2024
Unfortunately, you're running a very old version of R. Are you able to update it? If so, this problem should go away.
Benoit Gauthier • January 15, 2024
Hi, David. Thanks for this exceptional free resource on R. I am attempting to use R on my Chromebook. So far, so good. Just a note that, to successfully install the "usethis" package, I had to issue the following commands first:
sudo apt-get install libssl-dev install.packages("openssl")
I am keeping notes on modules I need to install in addition to your instructions in case this is useful for another student.
Benoit Gauthier • January 15, 2024
To be clear, these are two separate commands:
sudo apt-get install libssl-dev
install.packages("openssl")
David Keyes Founder • January 15, 2024
Thanks!
Charles Obiorah • February 25, 2024
Hello David, how do I stay on course? I pasted the project link. And my PC took some time to process and I received this back : > install.packages("use this") Warning in install.packages : unable to access index for repository https://cran.rstudio.com/src/contrib: cannot open URL 'https://cran.rstudio.com/src/contrib/PACKAGES' WARNING: Rtools is required to build R packages but is not currently installed. Please download and install the appropriate version of Rtools before proceeding:
https://cran.rstudio.com/bin/windows/Rtools/ Installing package into ‘C:/Users/Obiorah/AppData/Local/R/win-library/4.3’ (as ‘lib’ is unspecified)
David Keyes Founder • February 26, 2024
You can safely ignore the warning about RTools. Were you able to open the new project in spite of this warning?
Charles Obiorah • February 27, 2024
Thank you, David, I just went to rest and started again at another time. Thankfully,, it downloaded. Though I took a while to figure how to key in the options(continuing with the delete of zip file or where to download it to)
pia Wollrab • March 5, 2024
what am I supposed to do with that? WARNING: Rtools is required to build R packages but is not currently installed. Please download and install the appropriate version of Rtools before proceeding: ... can not download/open you rproject please help
David Keyes Founder • March 6, 2024
You can safely ignore the warning about RTools.
Cyndhia Ramatchandirane • March 11, 2024
Hello, I have version 4.3.3, but I am getting the following error message:
David Keyes Founder • March 11, 2024
Hmm, I'm not totally sure what's going on here, but I recorded a video with a couple ideas. Let me know if this helps!
Cyndhia Ramatchandirane • March 11, 2024
Thanks David. Global CRAN was selected already. I called IT Support at work and the person I talked to is not sure what the issue is either, but someone else will try to help me tomorrow. I've also Googled it, and it seems some folks with the same issue advocated to uncheck "Use secure download method for HTTP." Seems like a connectivity problem? Will try again tomorrow.
unable to access index for repository https://cran.rstudio.com/src/contrib: cannot open URL 'https://cran.rstudio.com/src/contrib/PACKAGES'
David Keyes Founder • March 12, 2024
Ok, let me know how it goes! If you're still having trouble we can have your R in 3 Months coach jump on a call to help you debug.
Cyndhia Ramatchandirane • March 12, 2024
I have no idea why, but I just tried it again this morning (without IT's help), and the package installed! I haven't changed anything myself since yesterday evening. I had tried it with vpn on and off and had restarted my (work) computer, but yesterday it would not work. Moving forward now!
David Keyes Founder • March 12, 2024
Glad it worked now! You may be surprised to find out how often this experience of trying again on a different day works even for experienced programmers.
Sue Reinert • April 7, 2024
When I run the project code it says it was successfully run but I don't see a question about whether to download to the desktop and I can't open the project folder to look at the files in it. I am using R 4.3.3. not R 4.2.2 as the video has it. I have no coding experience whatsoever.
David Keyes Founder • April 8, 2024
Hmm, that's strange. Can you try it again and let me know if you get the same thing?
Sue Reinert • April 9, 2024
Thanks, my brother signed up for the course so he could help me and we worked it out today. He had already done a project for me in RStudio and I was using that RStudio for your project -- that was the problem. He helped me set up the course project in a different folder and that worked.
David Keyes Founder • April 9, 2024
Glad you got it figured out!
Claire Hazbun • May 14, 2024
I tried to use destdir to change the destination from my desktop to the folder I created for this course but got this error: Error: Directory 'C:Users/clairehazbun/Documents/R Practice' does not exist
I used this code, and I know the file pathway is correct because I also tried to set the working directory as the R Practice folder, and when I did that it spit out the pathway name (C:Users/clairehazbun/Documents/R Practice).
What am I doing wrong?
Libby Heeren Coach • May 14, 2024
Hi, Claire! Can you try putting a slash before "Users" and see if that runs? It would be
destdir = "C:/Users/clairehazbun/Documents/R Practice"
Pablo Rejos Urbina • June 29, 2024
The path should be "C:/Users/clairehazbun/Documents/R Practice" (you missed a slash character after C:).
BTW, not in your case, but in order to help other users, it's important to notice that you have to user the slash '/' character instead of the backslash '' (that Windows uses generally).
Claire Hazbun • May 14, 2024
thanks Libby! that certainly seems like it would be the fix, but I tried it and am getting the same error - Error: Directory 'C:/Users/clairehazbun/Documents/R Practice' does not exist.
David Keyes Founder • May 14, 2024
Could you try removing the
destdir
argument and seeing if that works? In other words, just run:Claire Hazbun • May 18, 2024
Hmm it's still going to my desktop instead of the preferred folder.
David Keyes Founder • May 20, 2024
Yes, my suggestion was to remove the
destdir
argument and just have it go to the Desktop. I think the easiest solution is just to do that and then have you manually copy the folder somewhere else if desired. Would that work for you?Doha Moussa • May 19, 2024
Hi David,
I am getting the following error message when I try to run the above code: > use_course("https://rfor.us/getting-started-materials") Error in use_course("https://rfor.us/getting-started-materials") : could not find function "use_course"
can you help? I have the latest version of RStudio/
David Keyes Founder • May 20, 2024
You likely either: a) haven't yet installed the
usethis
package or b) haven't loaded theusethis
package. If you need help to do this, let me know.Lindsey Trank • June 7, 2024
Hi David, I copied and pasted the course project and it says it was downloaded after I clicked "run" but I can't find the binary packages anywhere on my computer. I searched the path and still can't find it . Any suggestions?
David Keyes Founder • June 7, 2024
By default it goes to your desktop. Can you check there and let me know if it shows up?
Lindsey Trank • June 7, 2024
Hi David,
This is what is in the console:
The downloaded binary packages are in /var/folders/hw/nz_mf3hj4w34h_5r0fm1g21m0000gp/T//Rtmpq8gIBP/downloaded_packages
I can search that file path to find it, but within the downloaded_packages folder there is one zip file: usethis_2.2.3.tgz
I opened the zip file but not sure what to do from here. Thanks!
David Keyes Founder • June 7, 2024
Hmm, strange. Please try downloading this zip file and then clicking on the
getting-started.Rproj
file, which should open the project in RStudio.Lindsey Trank • June 19, 2024
Hi David, that zip file worked for downloading the project. Thank you for your help!
Caroline Kypson • August 28, 2024
Hi David, I keep getting this error code: Error in use_course("https://rfor.us/getting-started-materials") : could not find function "use_course" Could you let me know how I can fix it! Thanks!
David Keyes Founder • August 29, 2024
You almost certainly haven't installed and/or loaded the
usethis
package. Please make sure to runinstall.packages("usethis")
to install it, then runlibrary(usethis)
before running theuse_course()
function.Katherine Morales • September 15, 2024
Just a note to watch the Files in R video before the Projects video. On my end, the Course Content has Projects listed before Files in R
David Keyes Founder • September 16, 2024
Thank you! This is fixed now.
Raouf Kilada • October 8, 2024
I am trying to catchup....trying to download:
library(usethis)
I gothis message: ℹ Downloading into C:/Users/rkilada/Desktop/. ☐ Prefer a different location? Cancel, try again, and specify
destdir
. OK to proceed?1: Negative 2: Yes 3: Nope
the download failed...suggestions? Thank you
David Keyes Founder • October 8, 2024
That's odd. Did you get a specific message? In any case, you can download the zip file with this link too. Just unzip it and then click the
getting-started.Rproj
file to open the project in RStudio.Raouf Kilada • October 8, 2024
Thanks David....I got this error Access denied
John LeMay • October 13, 2024
David, how do you get the filepath tooltip to pop up when you type /? It does not provide me with a tooltip suggestion of paths like it does for you.
David Keyes Founder • October 14, 2024
Try hitting tab when you have the cursor inside the double quotes and it should work.