class: title-slide, left, bottom <img src="data:image/png;base64,#img/session02/cracked_setwd.PNG" width="40%"/> # Using R Studio Projects ---- ## **Session 2** ### ### .right-column[ .footnote[Artwork by @allison_horst] ] --- # Working Directory If you tell R/R Studio to look for a file, or save a plot, it will (by default) look in a place called the working directory (wd) <img class="center" src="data:image/png;base64,#img/session02/working-directory.PNG"/> You can (usually) see your working directory path at the top of the console panel... ... it often defaults to the "Documents" folder. This example is ~/workshop-r/ and ~ is in Documents --- # Browsing in RStudio If you click the arrow next to the file pathway ~/workshop-r/ <img src="data:image/png;base64,#img/session02/working-directory.PNG"/> it will return you to the working directory and you can see all the files in that folder: <img class="center" src="data:image/png;base64,#img/session02/wd-files.PNG"/> --- class: center, middle # Organisation <img class="center"src="data:image/png;base64,#img/session02/cognitive-load.PNG" width="15%"/> Sooner or later (but probably sooner) you will wish to change where files are saved (and loaded from). Being organised is key: Reduces cognitive load (and frustration). .footnote[Artwork by @allison_horst] --- # RStudio Projects make it *far easier* for you to: 1) .blue[*Organise*] files and workflow 2) .blue[*Switch*] between projects 3) .blue[*Share*] scripts / projects with others .green[(when collaborating or getting assistance)] Recommended for all tasks (large or small). --- # Create a project File <svg viewBox="0 0 448 512" style="height:1em;position:relative;display:inline-block;top:.1em;" xmlns="http://www.w3.org/2000/svg"> <path d="M190.5 66.9l22.2-22.2c9.4-9.4 24.6-9.4 33.9 0L441 239c9.4 9.4 9.4 24.6 0 33.9L246.6 467.3c-9.4 9.4-24.6 9.4-33.9 0l-22.2-22.2c-9.5-9.5-9.3-25 .4-34.3L311.4 296H24c-13.3 0-24-10.7-24-24v-32c0-13.3 10.7-24 24-24h287.4L190.9 101.2c-9.8-9.3-10-24.8-.4-34.3z"></path></svg> New Project <svg viewBox="0 0 448 512" style="height:1em;position:relative;display:inline-block;top:.1em;" xmlns="http://www.w3.org/2000/svg"> <path d="M190.5 66.9l22.2-22.2c9.4-9.4 24.6-9.4 33.9 0L441 239c9.4 9.4 9.4 24.6 0 33.9L246.6 467.3c-9.4 9.4-24.6 9.4-33.9 0l-22.2-22.2c-9.5-9.5-9.3-25 .4-34.3L311.4 296H24c-13.3 0-24-10.7-24-24v-32c0-13.3 10.7-24 24-24h287.4L190.9 101.2c-9.8-9.3-10-24.8-.4-34.3z"></path></svg> New Directory <svg viewBox="0 0 448 512" style="height:1em;position:relative;display:inline-block;top:.1em;" xmlns="http://www.w3.org/2000/svg"> <path d="M190.5 66.9l22.2-22.2c9.4-9.4 24.6-9.4 33.9 0L441 239c9.4 9.4 9.4 24.6 0 33.9L246.6 467.3c-9.4 9.4-24.6 9.4-33.9 0l-22.2-22.2c-9.5-9.5-9.3-25 .4-34.3L311.4 296H24c-13.3 0-24-10.7-24-24v-32c0-13.3 10.7-24 24-24h287.4L190.9 101.2c-9.8-9.3-10-24.8-.4-34.3z"></path></svg> New Project Name the directory "workshop-r" Create as a subdirectory somewhere useful for you Create project! --- # RStudio Projects Now your working directory is your project directory: <img class="center" src="data:image/png;base64,#img/session02/workshop-r-project.PNG"/> R will save and load files from here (by default). If starting another project, repeat this process. --- class: middle, center # R Studio Projects Switching between projects is simple <img class="center" src="data:image/png;base64,#img/session02/project-list.PNG"/> --- # Acknowledgements Artwork by @allison_horst #### This work is licensed as Creative Commons Attribution ShareAlike 4.0 International To view a copy of this license, visit https://creativecommons.org/licenses/by/4.0/