Skip to content

Commit

Permalink
Merge branch 'main' of https://github.com/fhdsl/S1_Intro_to_R into main
Browse files Browse the repository at this point in the history
  • Loading branch information
jhudsl-robot committed Oct 6, 2023
2 parents 74212cc + 7e9e16a commit e3d0da1
Show file tree
Hide file tree
Showing 21 changed files with 691 additions and 196 deletions.
6 changes: 3 additions & 3 deletions docs/01-lesson1.md
Original file line number Diff line number Diff line change
Expand Up @@ -261,11 +261,11 @@ Common errors:

- Syntax error.

- Changing a variable without realizing you did so.
- It did something else than I expected!

- The function or operation does not accept the input data type.
- The function or operation does not accept the input data type.

- It did something else than I expected!
- Changing a variable without realizing you did so.

Solutions:

Expand Down
12 changes: 4 additions & 8 deletions docs/02-lesson2.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# W2: Working with data structures
# Working with data structures

## Vectors

Expand Down Expand Up @@ -76,11 +76,7 @@ When we work with operations and functions, we must be mindful what inputs the o

In the exercise this past week, you looked at a new operation to subset elements of a vector using brackets.

**Execution rule for vector brackets**:

*Evaluate the expression in the bracket first. The return value of the expression in the bracket, which must be a numeric or a numeric vector, dictates which elements of the vector to return.*

Inside the bracket is either a single numeric value or an a **numerical indexing vector** containing numerical values.
Inside the bracket is either a single numeric value or an a **numerical indexing vector** containing numerical values. They dictate which elements of the vector to return.


```r
Expand All @@ -105,7 +101,7 @@ small_staff = staff[c(1, 2)]

In the last line, we created a new vector `small_staff` that is a subset of the staff given the indexing vector `c(1, 2)`. We have three vectors referenced in one line of code. This is tricky and we need to always refer to our rules step-by-step: evaluate the expression right of the `=`, which contains a vector bracket. Follow the rule of the vector bracket. Then store the returning value to the variable left of `=`.

Alternatively, instead of using numerical indexing vectors, we can use a **logical indexing vector**. The logical indexing vector must be the *same length* as the vector to be subsetted, with TRUE indicating an element to keep, and FALSE indicating an element to drop. The following block of code gives the same value as before:
Alternatively, instead of using numerical indexing vectors, we can use a **logical indexing vector**. The logical indexing vector must be the *same length* as the vector to be subsetted, with `TRUE` indicating an element to keep, and `FALSE` indicating an element to drop. The following block of code gives the same value as before:


```r
Expand Down Expand Up @@ -255,7 +251,7 @@ For the most part, we load in dataframes from a file path (although they are som


```r
metadata = read.csv("classroom_data/CCLE_metadata.csv")
load(url("https://github.com/fhdsl/S1_Intro_to_R/raw/main/classroom_data/CCLE.RData"))
```

### Using functions and operations on dataframes
Expand Down
20 changes: 10 additions & 10 deletions docs/404.html
Original file line number Diff line number Diff line change
Expand Up @@ -162,20 +162,20 @@
</ul></li>
<li class="chapter" data-level="2.11" data-path="intro-to-computing.html"><a href="intro-to-computing.html#tips-on-exercises-debugging"><i class="fa fa-check"></i><b>2.11</b> Tips on Exercises / Debugging</a></li>
</ul></li>
<li class="chapter" data-level="3" data-path="w2-working-with-data-structures.html"><a href="w2-working-with-data-structures.html"><i class="fa fa-check"></i><b>3</b> W2: Working with data structures</a>
<li class="chapter" data-level="3" data-path="working-with-data-structures.html"><a href="working-with-data-structures.html"><i class="fa fa-check"></i><b>3</b> Working with data structures</a>
<ul>
<li class="chapter" data-level="3.1" data-path="w2-working-with-data-structures.html"><a href="w2-working-with-data-structures.html#vectors"><i class="fa fa-check"></i><b>3.1</b> Vectors</a>
<li class="chapter" data-level="3.1" data-path="working-with-data-structures.html"><a href="working-with-data-structures.html#vectors"><i class="fa fa-check"></i><b>3.1</b> Vectors</a>
<ul>
<li class="chapter" data-level="3.1.1" data-path="w2-working-with-data-structures.html"><a href="w2-working-with-data-structures.html#using-operations-on-vectors"><i class="fa fa-check"></i><b>3.1.1</b> Using operations on vectors</a></li>
<li class="chapter" data-level="3.1.2" data-path="w2-working-with-data-structures.html"><a href="w2-working-with-data-structures.html#subsetting-vectors-explicitly"><i class="fa fa-check"></i><b>3.1.2</b> Subsetting vectors explicitly</a></li>
<li class="chapter" data-level="3.1.3" data-path="w2-working-with-data-structures.html"><a href="w2-working-with-data-structures.html#subsetting-vectors-implicitly"><i class="fa fa-check"></i><b>3.1.3</b> Subsetting vectors implicitly</a></li>
<li class="chapter" data-level="3.1.1" data-path="working-with-data-structures.html"><a href="working-with-data-structures.html#using-operations-on-vectors"><i class="fa fa-check"></i><b>3.1.1</b> Using operations on vectors</a></li>
<li class="chapter" data-level="3.1.2" data-path="working-with-data-structures.html"><a href="working-with-data-structures.html#subsetting-vectors-explicitly"><i class="fa fa-check"></i><b>3.1.2</b> Subsetting vectors explicitly</a></li>
<li class="chapter" data-level="3.1.3" data-path="working-with-data-structures.html"><a href="working-with-data-structures.html#subsetting-vectors-implicitly"><i class="fa fa-check"></i><b>3.1.3</b> Subsetting vectors implicitly</a></li>
</ul></li>
<li class="chapter" data-level="3.2" data-path="w2-working-with-data-structures.html"><a href="w2-working-with-data-structures.html#dataframes"><i class="fa fa-check"></i><b>3.2</b> Dataframes</a>
<li class="chapter" data-level="3.2" data-path="working-with-data-structures.html"><a href="working-with-data-structures.html#dataframes"><i class="fa fa-check"></i><b>3.2</b> Dataframes</a>
<ul>
<li class="chapter" data-level="3.2.1" data-path="w2-working-with-data-structures.html"><a href="w2-working-with-data-structures.html#using-functions-and-operations-on-dataframes"><i class="fa fa-check"></i><b>3.2.1</b> Using functions and operations on dataframes</a></li>
<li class="chapter" data-level="3.2.2" data-path="w2-working-with-data-structures.html"><a href="w2-working-with-data-structures.html#what-do-you-want-to-do-with-this-dataframe"><i class="fa fa-check"></i><b>3.2.2</b> “What do you want to do with this dataframe”?</a></li>
<li class="chapter" data-level="3.2.3" data-path="w2-working-with-data-structures.html"><a href="w2-working-with-data-structures.html#filter-rows"><i class="fa fa-check"></i><b>3.2.3</b> Filter rows</a></li>
<li class="chapter" data-level="3.2.4" data-path="w2-working-with-data-structures.html"><a href="w2-working-with-data-structures.html#select-columns"><i class="fa fa-check"></i><b>3.2.4</b> Select columns</a></li>
<li class="chapter" data-level="3.2.1" data-path="working-with-data-structures.html"><a href="working-with-data-structures.html#using-functions-and-operations-on-dataframes"><i class="fa fa-check"></i><b>3.2.1</b> Using functions and operations on dataframes</a></li>
<li class="chapter" data-level="3.2.2" data-path="working-with-data-structures.html"><a href="working-with-data-structures.html#what-do-you-want-to-do-with-this-dataframe"><i class="fa fa-check"></i><b>3.2.2</b> “What do you want to do with this dataframe”?</a></li>
<li class="chapter" data-level="3.2.3" data-path="working-with-data-structures.html"><a href="working-with-data-structures.html#filter-rows"><i class="fa fa-check"></i><b>3.2.3</b> Filter rows</a></li>
<li class="chapter" data-level="3.2.4" data-path="working-with-data-structures.html"><a href="working-with-data-structures.html#select-columns"><i class="fa fa-check"></i><b>3.2.4</b> Select columns</a></li>
</ul></li>
</ul></li>
<li class="chapter" data-level="" data-path="about-the-authors.html"><a href="about-the-authors.html"><i class="fa fa-check"></i>About the Authors</a></li>
Expand Down
Binary file modified docs/Introduction-to-R,-Season-1.docx
Binary file not shown.
24 changes: 12 additions & 12 deletions docs/about-the-authors.html
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
<meta name="apple-mobile-web-app-status-bar-style" content="black" />

<link rel="shortcut icon" href="assets/dasl_favicon.ico" type="image/x-icon" />
<link rel="prev" href="w2-working-with-data-structures.html"/>
<link rel="prev" href="working-with-data-structures.html"/>
<link rel="next" href="references.html"/>
<script src="libs/header-attrs-2.10/header-attrs.js"></script>
<script src="libs/jquery-3.6.0/jquery-3.6.0.min.js"></script>
Expand Down Expand Up @@ -162,20 +162,20 @@
</ul></li>
<li class="chapter" data-level="2.11" data-path="intro-to-computing.html"><a href="intro-to-computing.html#tips-on-exercises-debugging"><i class="fa fa-check"></i><b>2.11</b> Tips on Exercises / Debugging</a></li>
</ul></li>
<li class="chapter" data-level="3" data-path="w2-working-with-data-structures.html"><a href="w2-working-with-data-structures.html"><i class="fa fa-check"></i><b>3</b> W2: Working with data structures</a>
<li class="chapter" data-level="3" data-path="working-with-data-structures.html"><a href="working-with-data-structures.html"><i class="fa fa-check"></i><b>3</b> Working with data structures</a>
<ul>
<li class="chapter" data-level="3.1" data-path="w2-working-with-data-structures.html"><a href="w2-working-with-data-structures.html#vectors"><i class="fa fa-check"></i><b>3.1</b> Vectors</a>
<li class="chapter" data-level="3.1" data-path="working-with-data-structures.html"><a href="working-with-data-structures.html#vectors"><i class="fa fa-check"></i><b>3.1</b> Vectors</a>
<ul>
<li class="chapter" data-level="3.1.1" data-path="w2-working-with-data-structures.html"><a href="w2-working-with-data-structures.html#using-operations-on-vectors"><i class="fa fa-check"></i><b>3.1.1</b> Using operations on vectors</a></li>
<li class="chapter" data-level="3.1.2" data-path="w2-working-with-data-structures.html"><a href="w2-working-with-data-structures.html#subsetting-vectors-explicitly"><i class="fa fa-check"></i><b>3.1.2</b> Subsetting vectors explicitly</a></li>
<li class="chapter" data-level="3.1.3" data-path="w2-working-with-data-structures.html"><a href="w2-working-with-data-structures.html#subsetting-vectors-implicitly"><i class="fa fa-check"></i><b>3.1.3</b> Subsetting vectors implicitly</a></li>
<li class="chapter" data-level="3.1.1" data-path="working-with-data-structures.html"><a href="working-with-data-structures.html#using-operations-on-vectors"><i class="fa fa-check"></i><b>3.1.1</b> Using operations on vectors</a></li>
<li class="chapter" data-level="3.1.2" data-path="working-with-data-structures.html"><a href="working-with-data-structures.html#subsetting-vectors-explicitly"><i class="fa fa-check"></i><b>3.1.2</b> Subsetting vectors explicitly</a></li>
<li class="chapter" data-level="3.1.3" data-path="working-with-data-structures.html"><a href="working-with-data-structures.html#subsetting-vectors-implicitly"><i class="fa fa-check"></i><b>3.1.3</b> Subsetting vectors implicitly</a></li>
</ul></li>
<li class="chapter" data-level="3.2" data-path="w2-working-with-data-structures.html"><a href="w2-working-with-data-structures.html#dataframes"><i class="fa fa-check"></i><b>3.2</b> Dataframes</a>
<li class="chapter" data-level="3.2" data-path="working-with-data-structures.html"><a href="working-with-data-structures.html#dataframes"><i class="fa fa-check"></i><b>3.2</b> Dataframes</a>
<ul>
<li class="chapter" data-level="3.2.1" data-path="w2-working-with-data-structures.html"><a href="w2-working-with-data-structures.html#using-functions-and-operations-on-dataframes"><i class="fa fa-check"></i><b>3.2.1</b> Using functions and operations on dataframes</a></li>
<li class="chapter" data-level="3.2.2" data-path="w2-working-with-data-structures.html"><a href="w2-working-with-data-structures.html#what-do-you-want-to-do-with-this-dataframe"><i class="fa fa-check"></i><b>3.2.2</b> “What do you want to do with this dataframe”?</a></li>
<li class="chapter" data-level="3.2.3" data-path="w2-working-with-data-structures.html"><a href="w2-working-with-data-structures.html#filter-rows"><i class="fa fa-check"></i><b>3.2.3</b> Filter rows</a></li>
<li class="chapter" data-level="3.2.4" data-path="w2-working-with-data-structures.html"><a href="w2-working-with-data-structures.html#select-columns"><i class="fa fa-check"></i><b>3.2.4</b> Select columns</a></li>
<li class="chapter" data-level="3.2.1" data-path="working-with-data-structures.html"><a href="working-with-data-structures.html#using-functions-and-operations-on-dataframes"><i class="fa fa-check"></i><b>3.2.1</b> Using functions and operations on dataframes</a></li>
<li class="chapter" data-level="3.2.2" data-path="working-with-data-structures.html"><a href="working-with-data-structures.html#what-do-you-want-to-do-with-this-dataframe"><i class="fa fa-check"></i><b>3.2.2</b> “What do you want to do with this dataframe”?</a></li>
<li class="chapter" data-level="3.2.3" data-path="working-with-data-structures.html"><a href="working-with-data-structures.html#filter-rows"><i class="fa fa-check"></i><b>3.2.3</b> Filter rows</a></li>
<li class="chapter" data-level="3.2.4" data-path="working-with-data-structures.html"><a href="working-with-data-structures.html#select-columns"><i class="fa fa-check"></i><b>3.2.4</b> Select columns</a></li>
</ul></li>
</ul></li>
<li class="chapter" data-level="" data-path="about-the-authors.html"><a href="about-the-authors.html"><i class="fa fa-check"></i>About the Authors</a></li>
Expand Down Expand Up @@ -428,7 +428,7 @@ <h1>About the Authors</h1>
</div>
</div>
</div>
<a href="w2-working-with-data-structures.html" class="navigation navigation-prev " aria-label="Previous page"><i class="fa fa-angle-left"></i></a>
<a href="working-with-data-structures.html" class="navigation navigation-prev " aria-label="Previous page"><i class="fa fa-angle-left"></i></a>
<a href="references.html" class="navigation navigation-next " aria-label="Next page"><i class="fa fa-angle-right"></i></a>
</div>
</div>
Expand Down
20 changes: 10 additions & 10 deletions docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -162,20 +162,20 @@
</ul></li>
<li class="chapter" data-level="2.11" data-path="intro-to-computing.html"><a href="intro-to-computing.html#tips-on-exercises-debugging"><i class="fa fa-check"></i><b>2.11</b> Tips on Exercises / Debugging</a></li>
</ul></li>
<li class="chapter" data-level="3" data-path="w2-working-with-data-structures.html"><a href="w2-working-with-data-structures.html"><i class="fa fa-check"></i><b>3</b> W2: Working with data structures</a>
<li class="chapter" data-level="3" data-path="working-with-data-structures.html"><a href="working-with-data-structures.html"><i class="fa fa-check"></i><b>3</b> Working with data structures</a>
<ul>
<li class="chapter" data-level="3.1" data-path="w2-working-with-data-structures.html"><a href="w2-working-with-data-structures.html#vectors"><i class="fa fa-check"></i><b>3.1</b> Vectors</a>
<li class="chapter" data-level="3.1" data-path="working-with-data-structures.html"><a href="working-with-data-structures.html#vectors"><i class="fa fa-check"></i><b>3.1</b> Vectors</a>
<ul>
<li class="chapter" data-level="3.1.1" data-path="w2-working-with-data-structures.html"><a href="w2-working-with-data-structures.html#using-operations-on-vectors"><i class="fa fa-check"></i><b>3.1.1</b> Using operations on vectors</a></li>
<li class="chapter" data-level="3.1.2" data-path="w2-working-with-data-structures.html"><a href="w2-working-with-data-structures.html#subsetting-vectors-explicitly"><i class="fa fa-check"></i><b>3.1.2</b> Subsetting vectors explicitly</a></li>
<li class="chapter" data-level="3.1.3" data-path="w2-working-with-data-structures.html"><a href="w2-working-with-data-structures.html#subsetting-vectors-implicitly"><i class="fa fa-check"></i><b>3.1.3</b> Subsetting vectors implicitly</a></li>
<li class="chapter" data-level="3.1.1" data-path="working-with-data-structures.html"><a href="working-with-data-structures.html#using-operations-on-vectors"><i class="fa fa-check"></i><b>3.1.1</b> Using operations on vectors</a></li>
<li class="chapter" data-level="3.1.2" data-path="working-with-data-structures.html"><a href="working-with-data-structures.html#subsetting-vectors-explicitly"><i class="fa fa-check"></i><b>3.1.2</b> Subsetting vectors explicitly</a></li>
<li class="chapter" data-level="3.1.3" data-path="working-with-data-structures.html"><a href="working-with-data-structures.html#subsetting-vectors-implicitly"><i class="fa fa-check"></i><b>3.1.3</b> Subsetting vectors implicitly</a></li>
</ul></li>
<li class="chapter" data-level="3.2" data-path="w2-working-with-data-structures.html"><a href="w2-working-with-data-structures.html#dataframes"><i class="fa fa-check"></i><b>3.2</b> Dataframes</a>
<li class="chapter" data-level="3.2" data-path="working-with-data-structures.html"><a href="working-with-data-structures.html#dataframes"><i class="fa fa-check"></i><b>3.2</b> Dataframes</a>
<ul>
<li class="chapter" data-level="3.2.1" data-path="w2-working-with-data-structures.html"><a href="w2-working-with-data-structures.html#using-functions-and-operations-on-dataframes"><i class="fa fa-check"></i><b>3.2.1</b> Using functions and operations on dataframes</a></li>
<li class="chapter" data-level="3.2.2" data-path="w2-working-with-data-structures.html"><a href="w2-working-with-data-structures.html#what-do-you-want-to-do-with-this-dataframe"><i class="fa fa-check"></i><b>3.2.2</b> “What do you want to do with this dataframe”?</a></li>
<li class="chapter" data-level="3.2.3" data-path="w2-working-with-data-structures.html"><a href="w2-working-with-data-structures.html#filter-rows"><i class="fa fa-check"></i><b>3.2.3</b> Filter rows</a></li>
<li class="chapter" data-level="3.2.4" data-path="w2-working-with-data-structures.html"><a href="w2-working-with-data-structures.html#select-columns"><i class="fa fa-check"></i><b>3.2.4</b> Select columns</a></li>
<li class="chapter" data-level="3.2.1" data-path="working-with-data-structures.html"><a href="working-with-data-structures.html#using-functions-and-operations-on-dataframes"><i class="fa fa-check"></i><b>3.2.1</b> Using functions and operations on dataframes</a></li>
<li class="chapter" data-level="3.2.2" data-path="working-with-data-structures.html"><a href="working-with-data-structures.html#what-do-you-want-to-do-with-this-dataframe"><i class="fa fa-check"></i><b>3.2.2</b> “What do you want to do with this dataframe”?</a></li>
<li class="chapter" data-level="3.2.3" data-path="working-with-data-structures.html"><a href="working-with-data-structures.html#filter-rows"><i class="fa fa-check"></i><b>3.2.3</b> Filter rows</a></li>
<li class="chapter" data-level="3.2.4" data-path="working-with-data-structures.html"><a href="working-with-data-structures.html#select-columns"><i class="fa fa-check"></i><b>3.2.4</b> Select columns</a></li>
</ul></li>
</ul></li>
<li class="chapter" data-level="" data-path="about-the-authors.html"><a href="about-the-authors.html"><i class="fa fa-check"></i>About the Authors</a></li>
Expand Down
Loading

0 comments on commit e3d0da1

Please sign in to comment.