Skip to content

Commit

Permalink
differences for PR #869
Browse files Browse the repository at this point in the history
  • Loading branch information
actions-user committed Nov 18, 2023
1 parent e5476c7 commit a2286df
Show file tree
Hide file tree
Showing 7 changed files with 55 additions and 57 deletions.
48 changes: 23 additions & 25 deletions 01-rstudio-intro.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ source: Rmd

::::::::::::::::::::::::::::::::::::::: objectives

- Describe the purpose and use of each pane in RStudio
- Locate buttons and options in RStudio
- Describe the purpose and use of each pane in the RStudio IDE
- Locate buttons and options in the RStudio IDE
- Define a variable
- Assign data to a variable
- Manage a workspace in an interactive R session
Expand All @@ -29,39 +29,38 @@ source: Rmd



## Motivation

Science is a multi-step process: once you've designed an experiment and collected
data, the real fun begins! This lesson will teach you how to start this process using
R and RStudio. We will begin with raw data, perform exploratory analyses, and learn
how to plot results graphically. This example starts with a dataset from
[gapminder.org](https://www.gapminder.org) containing population information for many
countries through time. Can you read the data into R? Can you plot the population for
Senegal? Can you calculate the average income for countries on the continent of Asia?
By the end of these lessons you will be able to do things like plot the populations
for all of these countries in under a minute!

## Before Starting The Workshop

Please ensure you have the latest version of R and RStudio installed on your machine. This is important, as some packages used in the workshop may not install correctly (or at all) if R is not up to date.

- [Download and install the latest version of R here](https://www.r-project.org/)
- [Download and install RStudio here](https://www.rstudio.com/products/rstudio/download/#download)

## Introduction to RStudio

## Why use R and R studio?

Welcome to the R portion of the Software Carpentry workshop!

Science is a multi-step process: once you've designed an experiment and collected
data, the real fun begins with analysis! Throughout this lesson, we're going to teach you some of the fundamentals of the R language as well as some best practices for organizing code for scientific projects that will make your life easier.

Although we could use a spreadsheet in Microsoft Excel or Google sheets to analyze our data, these tools are limited in their flexibility and accessibility. Critically, they also are difficult to share steps which explore and change the raw data, which is key to ["reproducible" research](https://journals.plos.org/ploscompbiol/article?id=10.1371/journal.pcbi.1003285).
Welcome to the R portion of the Software Carpentry workshop.

Therefore, this lesson will teach you how to begin exploring your data using R and RStudio. The R program is available for Windows, Mac, and Linux operating systems, and is a freely-available where you downloaded it above. To run R, all you need is the R program.
Throughout this lesson, we're going to teach you some of the fundamentals of
the R language as well as some best practices for organizing code for
scientific projects that will make your life easier.

However, to make using R easier, we will use the program RStudio, which we also downloaded above. RStudio is a free, open-source, Integrated Development
We'll be using RStudio: a free, open-source R Integrated Development
Environment (IDE). It provides a built-in editor, works on all platforms (including
on servers) and provides many advantages such as integration with version
control and project management.

## Overview

We will begin with raw data, perform exploratory analyses, and learn how to plot results graphically. This example starts with a dataset from [gapminder.org](https://www.gapminder.org) containing population information for many
countries through time. Can you read the data into R? Can you plot the population for
Senegal? Can you calculate the average income for countries on the continent of Asia?
By the end of these lessons you will be able to do things like plot the populations
for all of these countries in under a minute!


**Basic layout**

When you first open RStudio, you will be greeted by three panels:
Expand Down Expand Up @@ -159,8 +158,7 @@ the first element of the line being printed in the console. For more information
on indexing vectors, see [Episode 6: Subsetting Data](https://swcarpentry.github.io/r-novice-gapminder/06-data-subsetting/index.html).

If you type in an incomplete command, R will wait for you to
complete it. If you are familiar with Unix Shell's bash, you may recognize this
behavior from bash.
complete it. If you are familiar with Unix Shell's bash, you may recognize this behavior from bash.

```r
> 1 +
Expand Down Expand Up @@ -544,7 +542,7 @@ min-length
One final thing to be aware of is that R is *vectorized*, meaning that
variables and functions can have vectors as values. In contrast to physics and
mathematics, a vector in R describes a set of values in a certain order of the
same data type. For example
same data type. For example:


```r
Expand Down Expand Up @@ -644,7 +642,7 @@ function (name, pos = -1L, envir = as.environment(pos), all.names = FALSE,
}
else all.names
}
<bytecode: 0x55bec8f02a70>
<bytecode: 0x55a7ed239a00>
<environment: namespace:base>
```

Expand Down
2 changes: 1 addition & 1 deletion 02-project-intro.md
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ ls -lh data/gapminder_data.csv
```

```{.output}
-rw-r--r-- 1 runner docker 80K Nov 16 22:05 data/gapminder_data.csv
-rw-r--r-- 1 runner docker 80K Nov 18 14:04 data/gapminder_data.csv
```

The file size is 80K.
Expand Down
4 changes: 2 additions & 2 deletions 03-seeking-help.md
Original file line number Diff line number Diff line change
Expand Up @@ -181,8 +181,8 @@ attached base packages:
[1] stats graphics grDevices utils datasets methods base
loaded via a namespace (and not attached):
[1] compiler_4.3.1 tools_4.3.1 yaml_2.3.7 knitr_1.45 xfun_0.41
[6] renv_1.0.3 evaluate_0.23
[1] compiler_4.3.1 tools_4.3.1 rstudioapi_0.15.0 yaml_2.3.7
[5] knitr_1.43 xfun_0.40 renv_1.0.3 evaluate_0.21
```

Will print out your current version of R, as well as any packages you
Expand Down
6 changes: 3 additions & 3 deletions 13-dplyr.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,23 +28,23 @@ do these operations using the normal base R operations:


```r
mean(gapminder$gdpPercap[gapminder$continent == "Africa"])
mean(gapminder[gapminder$continent == "Africa", "gdpPercap"])
```

```{.output}
[1] 2193.755
```

```r
mean(gapminder$gdpPercap[gapminder$continent == "Americas"])
mean(gapminder[gapminder$continent == "Americas", "gdpPercap"])
```

```{.output}
[1] 7136.11
```

```r
mean(gapminder$gdpPercap[gapminder$continent == "Asia"])
mean(gapminder[gapminder$continent == "Asia", "gdpPercap"])
```

```{.output}
Expand Down
Empty file modified fig/06-rmd-generate-figures.sh
100755 → 100644
Empty file.
Empty file modified fig/12-plyr-generate-figures.sh
100755 → 100644
Empty file.
52 changes: 26 additions & 26 deletions md5sum.txt
Original file line number Diff line number Diff line change
@@ -1,27 +1,27 @@
"file" "checksum" "built" "date"
"CODE_OF_CONDUCT.md" "c93c83c630db2fe2462240bf72552548" "site/built/CODE_OF_CONDUCT.md" "2023-11-16"
"LICENSE.md" "b24ebbb41b14ca25cf6b8216dda83e5f" "site/built/LICENSE.md" "2023-11-16"
"config.yaml" "810028d39c377c82aef9239cb1ec0dd3" "site/built/config.yaml" "2023-11-16"
"index.md" "86c8fb559b13d1695d55b52dd6cbf574" "site/built/index.md" "2023-11-16"
"episodes/01-rstudio-intro.Rmd" "f52c105e2ad37a03d18353288f03e43f" "site/built/01-rstudio-intro.md" "2023-11-16"
"episodes/02-project-intro.Rmd" "94e7911ebdd59fbc30de86ed1d84d4df" "site/built/02-project-intro.md" "2023-11-16"
"episodes/03-seeking-help.Rmd" "d24c310b8f36930e70379458f3c93461" "site/built/03-seeking-help.md" "2023-11-16"
"episodes/04-data-structures-part1.Rmd" "5ec938f71a9cec633cef9329d214c3a0" "site/built/04-data-structures-part1.md" "2023-11-16"
"episodes/05-data-structures-part2.Rmd" "de6c6ee224fa7201674d87844c9ede02" "site/built/05-data-structures-part2.md" "2023-11-16"
"episodes/06-data-subsetting.Rmd" "5d4ce8731ab37ddea81874d63ae1ce86" "site/built/06-data-subsetting.md" "2023-11-16"
"episodes/07-control-flow.Rmd" "6a8691c8668737e4202f49b52aeb8ac6" "site/built/07-control-flow.md" "2023-11-16"
"episodes/08-plot-ggplot2.Rmd" "775bc2b258e11b4af447c7286bca2dd4" "site/built/08-plot-ggplot2.md" "2023-11-16"
"episodes/09-vectorization.Rmd" "e229eb061b3f072a132c4b31bbc2fdb0" "site/built/09-vectorization.md" "2023-11-16"
"episodes/10-functions.Rmd" "14edd4cf50edb8fefeb987a17d740e1a" "site/built/10-functions.md" "2023-11-16"
"episodes/11-writing-data.Rmd" "8b26e062dddd2394d00c6847ff0b7505" "site/built/11-writing-data.md" "2023-11-16"
"episodes/12-plyr.Rmd" "909597e71c188c682b5039036b4e95cf" "site/built/12-plyr.md" "2023-11-16"
"episodes/13-dplyr.Rmd" "182c5377ad81f0b25a19cd7a000e539e" "site/built/13-dplyr.md" "2023-11-16"
"episodes/14-tidyr.Rmd" "6ceb2a517a291c565cfbc0f76e2fb567" "site/built/14-tidyr.md" "2023-11-16"
"episodes/15-knitr-markdown.Rmd" "65188e4a8eaf3d04c6284db65c48c83e" "site/built/15-knitr-markdown.md" "2023-11-16"
"episodes/16-wrap-up.Rmd" "c5ce0d34a37b7a99624ad1d6ac482256" "site/built/16-wrap-up.md" "2023-11-16"
"instructors/instructor-notes.md" "5ce85301c3e8d78b4b8682ae8e6bb7ff" "site/built/instructor-notes.md" "2023-11-16"
"learners/discuss.md" "42ad66ab1907e030914dbb2a94376a47" "site/built/discuss.md" "2023-11-16"
"learners/reference.md" "b606f57847b81651e8102925ff3d19c1" "site/built/reference.md" "2023-11-16"
"learners/setup.md" "f888f8a54b071715c0cf56896e650c00" "site/built/setup.md" "2023-11-16"
"profiles/learner-profiles.md" "60b93493cf1da06dfd63255d73854461" "site/built/learner-profiles.md" "2023-11-16"
"renv/profiles/lesson-requirements/renv.lock" "14ffda8a8a972130d31f6d9df4ec63ca" "site/built/renv.lock" "2023-11-16"
"CODE_OF_CONDUCT.md" "c93c83c630db2fe2462240bf72552548" "site/built/CODE_OF_CONDUCT.md" "2023-11-18"
"LICENSE.md" "b24ebbb41b14ca25cf6b8216dda83e5f" "site/built/LICENSE.md" "2023-11-18"
"config.yaml" "810028d39c377c82aef9239cb1ec0dd3" "site/built/config.yaml" "2023-11-18"
"index.md" "86c8fb559b13d1695d55b52dd6cbf574" "site/built/index.md" "2023-11-18"
"episodes/01-rstudio-intro.Rmd" "020e219ee8148fee04c2e853fbac0d3e" "site/built/01-rstudio-intro.md" "2023-11-18"
"episodes/02-project-intro.Rmd" "94e7911ebdd59fbc30de86ed1d84d4df" "site/built/02-project-intro.md" "2023-11-18"
"episodes/03-seeking-help.Rmd" "d24c310b8f36930e70379458f3c93461" "site/built/03-seeking-help.md" "2023-11-18"
"episodes/04-data-structures-part1.Rmd" "5ec938f71a9cec633cef9329d214c3a0" "site/built/04-data-structures-part1.md" "2023-11-18"
"episodes/05-data-structures-part2.Rmd" "de6c6ee224fa7201674d87844c9ede02" "site/built/05-data-structures-part2.md" "2023-11-18"
"episodes/06-data-subsetting.Rmd" "5d4ce8731ab37ddea81874d63ae1ce86" "site/built/06-data-subsetting.md" "2023-11-18"
"episodes/07-control-flow.Rmd" "6a8691c8668737e4202f49b52aeb8ac6" "site/built/07-control-flow.md" "2023-11-18"
"episodes/08-plot-ggplot2.Rmd" "775bc2b258e11b4af447c7286bca2dd4" "site/built/08-plot-ggplot2.md" "2023-11-18"
"episodes/09-vectorization.Rmd" "e229eb061b3f072a132c4b31bbc2fdb0" "site/built/09-vectorization.md" "2023-11-18"
"episodes/10-functions.Rmd" "14edd4cf50edb8fefeb987a17d740e1a" "site/built/10-functions.md" "2023-11-18"
"episodes/11-writing-data.Rmd" "8b26e062dddd2394d00c6847ff0b7505" "site/built/11-writing-data.md" "2023-11-18"
"episodes/12-plyr.Rmd" "909597e71c188c682b5039036b4e95cf" "site/built/12-plyr.md" "2023-11-18"
"episodes/13-dplyr.Rmd" "3ad3687a1c860ddcf30ddcbb375153fb" "site/built/13-dplyr.md" "2023-11-18"
"episodes/14-tidyr.Rmd" "6ceb2a517a291c565cfbc0f76e2fb567" "site/built/14-tidyr.md" "2023-11-18"
"episodes/15-knitr-markdown.Rmd" "65188e4a8eaf3d04c6284db65c48c83e" "site/built/15-knitr-markdown.md" "2023-11-18"
"episodes/16-wrap-up.Rmd" "c5ce0d34a37b7a99624ad1d6ac482256" "site/built/16-wrap-up.md" "2023-11-18"
"instructors/instructor-notes.md" "5ce85301c3e8d78b4b8682ae8e6bb7ff" "site/built/instructor-notes.md" "2023-11-18"
"learners/discuss.md" "42ad66ab1907e030914dbb2a94376a47" "site/built/discuss.md" "2023-11-18"
"learners/reference.md" "b606f57847b81651e8102925ff3d19c1" "site/built/reference.md" "2023-11-18"
"learners/setup.md" "f888f8a54b071715c0cf56896e650c00" "site/built/setup.md" "2023-11-18"
"profiles/learner-profiles.md" "60b93493cf1da06dfd63255d73854461" "site/built/learner-profiles.md" "2023-11-18"
"renv/profiles/lesson-requirements/renv.lock" "d0863f3009013edce68caa0b832b8754" "site/built/renv.lock" "2023-11-18"

0 comments on commit a2286df

Please sign in to comment.