class: center, middle, inverse, title-slide .title[ # Marine Community Ecology 2024 ] .subtitle[ ## 0-Installing and organizing R ] .author[ ### Simon J. Brandl ] .institute[ ### The University of Texas at Austin ] .date[ ### 2024/01/01 (updated: 2024-01-21) ] --- background-image: url("images/IMG_7366.jpeg") background-size: cover class: center, top, inverse # Examining ecological communities in marine ecosystems using R --- class: inverse, center, middle # Copyright These slides are part of the course entitled 'Marine Community Ecology,' co-developed by **Dr. Simon J. Brandl** and **Dr. Jordan M. Casey** and taught at The University of Texas at Austin [Marine Science Institute](https://utmsi.utexas.edu/) All materials for the coding part of the course were created by the author using [R](https://www.r-project.org/) and [R Markdown](https://rmarkdown.rstudio.com/). Slideshows were produced using the [xaringan](https://github.com/yihui/xaringan) package. The [GitHub Companion Page](https://simonjbrandl.github.io/marinecommunityecology) was created using the [distill](https://rstudio.github.io/distill/). All code was written by Dr. Brandl and Dr. Casey. All photos used in these presentations were taken by Dr. Casey. All scripts, files, and images necessary to complete the coding exercises are provided on [Github](https://simonjbrandl.github.io/marinecommunityecology). --- class: center, middle # Format of coding lessons All coding lessons are structured as follows: 1) Watch a pre-recorded lecture that introduces you to the packages, operations, and objectives of each coding lesson. 2) Perform a set of relatively easy exercises at home, which are usually to be submitted as homework. We will go through their solutions in class. 3) Work through a set of harder exercises in class. This will allow you to work in groups and with your instructors to solve problems and deepen your coding skills. --- class: center, bottom <img src="0-overview_files/footsteps.png" style="position:absolute; right:0px; top:10px;"> # First steps # ๐ฃ .pull-left[1) Download the newest version of [R](https://www.r-project.org/) to your computer (click here for [Windows](https://cran.r-project.org/bin/windows/base/) or [macOS](https://cran.r-project.org/bin/macosx/)). <img src="images/RLogo.png" alt="drawing" width="150"/> ] .pull-right[2) For user-friendly coding with multiple panes and a GUI, download [RStudio](https://posit.co/download/rstudio-desktop/) to your computer. <img src="images/rstudio.png" alt="drawing" width="300"/> ] --- # Open RStudio .left-column[No need to open R separately. RStudio autonomously interfaces with R #๐] <img src="images/rsetup1.png" width="75%" /> --- # Create a new project .left-column[A project will keep all of your files in the same place, which is nice and tidy #๐งน] <img src="images/rsetup2.png" width="75%" /> --- # Select 'New Directory' .left-column[This allows you to host your project in a brand new local directory #๐] <img src="images/rsetup3.png" width="75%" /> --- # Select 'New Project' .left-column[This is our default selection for writing code. One day, you may create a package #๐ฆ] <img src="images/rsetup4.png" width="75%" /> --- # Name your project .left-column[You can locate the directory you want to save your project in during this step #๐] <img src="images/rsetup5.png" width="75%" /> --- # Confirm you're in the right project .left-column[You will see the files present within your project directory (bottom-right panel), as well as an indication which project you are currently working in (top right) #โ ] <img src="images/rsetup6.png" width="75%" /> --- # Create a new R-script .left-column[R-scripts are a great interface for writing code #โ๏ธ] <img src="images/rsetup7.png" width="75%" /> --- # Locate your new script .left-column[The new script will open in the top left panel, usually named 'Untitled-1'. Save it to change the name. #๐พ] <img src="images/rsetup8.png" width="75%" /> --- # Write a first line of code .left-column[Writing getwd() in your script and running it (either with the 'Run' button or using Cmd+Enter [Mac] / CTRL+Enter [Windows]) will give you your current working directory. This is the path your project is saved under.) #โก๏ธ] <img src="images/rsetup9.png" width="75%" /> --- # Check your hard drive .left-column[You should have a folder with your project and the new script under the specified path. Opening the R-project will automatically set this folder as your working directory. #๐] <img src="images/rsetup10.png" width="75%" /> --- # Create folders to keep organized .left-column[You can now organize your project workspace on your hard drive. For example, you can create a folder called 'data' to store all datasets or a folder called 'plots' to store all plots. #๐ค] <img src="images/rsetup11.png" width="75%" /> --- background-image: url("images/achievement_meme.jpeg") background-position: middle, 80% class: center, bottom, inverse --- class: center, middle # Next: 01-Introduction to R Slides created by SJB via the R package [**xaringan**](https://github.com/yihui/xaringan).