From 15b27613849f252262d664492701201675ffd7ef Mon Sep 17 00:00:00 2001 From: Timothy Middelkoop Date: Wed, 22 May 2024 19:13:49 +0000 Subject: [PATCH] Add Show notes and cleanup structure --- Notes.Rmd | 29 ++ prep/Setup.html => Notes.html | 89 ++--- ReadMe.md | 13 + env.sh | 4 + prep/{Setup.Rmd => Instructor_Notes.Rmd} | 7 +- Overview.ipynb => prep/Notebook.ipynb | 32 +- prep/Preparation.html | 463 ----------------------- prep/{Preparation.Rmd => RStudio.Rmd} | 2 +- 8 files changed, 106 insertions(+), 533 deletions(-) create mode 100644 Notes.Rmd rename prep/Setup.html => Notes.html (99%) rename prep/{Setup.Rmd => Instructor_Notes.Rmd} (92%) rename Overview.ipynb => prep/Notebook.ipynb (56%) delete mode 100644 prep/Preparation.html rename prep/{Preparation.Rmd => RStudio.Rmd} (96%) diff --git a/Notes.Rmd b/Notes.Rmd new file mode 100644 index 0000000..42de22c --- /dev/null +++ b/Notes.Rmd @@ -0,0 +1,29 @@ +--- +title: "Show Notes" +output: html_document +editor_options: + chunk_output_type: console +--- + +# Navigate R Studio and Setup Project + + * Open RStudio + * Create a new "New Project" in `~/work` + * If you use Git (you should) use "New Project" -> "Version Control" -> "Git". + * "File" -> "New Project" -> "New Directory" -> "New Project" -> "work/skc-workshop". Projects and data must be saved in `~/work` otherwise they will be lost. Use a good name such as "skc-workshop" + * Turn off saving `.RData` in workspace + * "Tools" -> "Global Options" -> "General" (already selected) -> "Basic" (already selected) -> Under "Workspace" turn off "Restore `.RData` …" and set "Save workspace to `.RData` …" to "Never" + * Create a new "R Markdown" File + * "File" -> "New File" -> "R Markdown" -> "Create Empty Document" (bottom left button). + * Save file (cmd-s for Mac, ctrl-s for Windows/Linux) and use a good name such as "R-Ecology-Workshop" (it will add the `.Rmd` extension) + * Write, Setup, and View RMarkdown + * Write title `# RStudio` + * "Settings (gear)" -> "Preview in Viewer Pane" + * "Settings (gear)" -> "Chunk Output in Console" + * Save file + * Knit (Knit to HTML) + * Optionally set "Knit on Save" - (runs entire notebook) + +Resources: + + * https://datacarpentry.org/R-ecology-lesson-alternative/introduction-r-rstudio.html diff --git a/prep/Setup.html b/Notes.html similarity index 99% rename from prep/Setup.html rename to Notes.html index fe5986b..0de4f56 100644 --- a/prep/Setup.html +++ b/Notes.html @@ -11,7 +11,7 @@ -Setup +Show Notes - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - -

See Setup.Rmd for setting up RStudio -environment..

-
-

R Ecology

-
-

Install Packages

-
options(repos = list(CRAN="http://cran.rstudio.com/"))
-install.packages(c("tidyverse", "lubridate", "ratdat"))
-
-
-

Load

-
library(tidyverse)
-
## ── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
-## ✔ dplyr     1.1.3     ✔ readr     2.1.4
-## ✔ forcats   1.0.0     ✔ stringr   1.5.0
-## ✔ ggplot2   3.5.1     ✔ tibble    3.2.1
-## ✔ lubridate 1.9.3     ✔ tidyr     1.3.0
-## ✔ purrr     1.0.2     
-## ── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
-## ✖ dplyr::filter() masks stats::filter()
-## ✖ dplyr::lag()    masks stats::lag()
-## ℹ Use the conflicted package (<http://conflicted.r-lib.org/>) to force all conflicts to become errors
-
library(lubridate)
-library(ratdat)
-
-
-

Lessons Snippits

-
install.packages("ggplot2")
-
## Updating HTML index of packages in '.Library'
-
## Making 'packages.html' ... done
-
library(ggplot2)
-library(ratdat)
-?complete_old
-
# View(complete_old)
-
str(complete_old)
-
## tibble [16,878 × 13] (S3: tbl_df/tbl/data.frame)
-##  $ record_id      : int [1:16878] 1 2 3 4 5 6 7 8 9 10 ...
-##  $ month          : int [1:16878] 7 7 7 7 7 7 7 7 7 7 ...
-##  $ day            : int [1:16878] 16 16 16 16 16 16 16 16 16 16 ...
-##  $ year           : int [1:16878] 1977 1977 1977 1977 1977 1977 1977 1977 1977 1977 ...
-##  $ plot_id        : int [1:16878] 2 3 2 7 3 1 2 1 1 6 ...
-##  $ species_id     : chr [1:16878] "NL" "NL" "DM" "DM" ...
-##  $ sex            : chr [1:16878] "M" "M" "F" "M" ...
-##  $ hindfoot_length: int [1:16878] 32 33 37 36 35 14 NA 37 34 20 ...
-##  $ weight         : int [1:16878] NA NA NA NA NA NA NA NA NA NA ...
-##  $ genus          : chr [1:16878] "Neotoma" "Neotoma" "Dipodomys" "Dipodomys" ...
-##  $ species        : chr [1:16878] "albigula" "albigula" "merriami" "merriami" ...
-##  $ taxa           : chr [1:16878] "Rodent" "Rodent" "Rodent" "Rodent" ...
-##  $ plot_type      : chr [1:16878] "Control" "Long-term Krat Exclosure" "Control" "Rodent Exclosure" ...
-
ggplot(data = complete_old)
-

-
ggplot(data = complete_old, mapping = aes(x = weight, y = hindfoot_length))
-

-
ggplot(data = complete_old, mapping = aes(x = weight, y = hindfoot_length)) +
-  geom_point()
-
## Warning: Removed 3081 rows containing missing values or values outside the scale range
-## (`geom_point()`).
-

-
-
- - - - -
- - - - - - - - - - - - - - - diff --git a/prep/Preparation.Rmd b/prep/RStudio.Rmd similarity index 96% rename from prep/Preparation.Rmd rename to prep/RStudio.Rmd index 61a5316..8581894 100644 --- a/prep/Preparation.Rmd +++ b/prep/RStudio.Rmd @@ -1,5 +1,5 @@ --- -title: "Preparation" +title: "Lesson Preparation" output: html_document editor_options: chunk_output_type: console