Skip to content

Commit

Permalink
[custom] fix lesson contents
Browse files Browse the repository at this point in the history
  • Loading branch information
zkamvar authored and Carpentries Apprentice committed May 1, 2023
1 parent 2797e65 commit 465adc8
Show file tree
Hide file tree
Showing 7 changed files with 1,229 additions and 106 deletions.
2 changes: 2 additions & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
^renv$
^renv\.lock$
^tic\.R$
^\.travis\.yml$
2 changes: 1 addition & 1 deletion episodes/03-basics-factors-dataframes.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -734,7 +734,7 @@ We can save data to a file. We will save our `SRR2584863_variants` object
to a .csv file using the `write.csv()` function:

```{r, purl=FALSE}
write.csv(SRR2584863_variants, file = "../data/SRR2584863_variants.csv")
write.csv(SRR2584863_variants, file = "data/SRR2584863_variants.csv")
```

The `write.csv()` function has some additional arguments listed in the help, but
Expand Down
2 changes: 1 addition & 1 deletion episodes/05-dplyr.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ The Tidyverse's `readr` package provides its own unique way of loading .csv file
Now let's load our vcf .csv file using `read_csv()`:

```{r, include=FALSE, echo=FALSE, eval=TRUE, purl=FALSE}
variants <- read_csv("../data/combined_tidy_vcf.csv")
variants <- read_csv("data/combined_tidy_vcf.csv")
```

### Taking a quick look at data frames
Expand Down
2 changes: 1 addition & 1 deletion episodes/07-knitr-markdown.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,7 @@ code.

You can make *every* number in your report reproducible. Use
<code>\`r</code> and <code>\`</code> for an in-line code chunk,
like so: <code>\`r round(some\_value, 2)\`</code>. The code will be
like so: ``` ``r "r round(some_value, 2)"`` ```. The code will be
executed and replaced with the *value* of the result.

Don't let these in-line chunks get split across lines.
Expand Down
71 changes: 34 additions & 37 deletions episodes/08-r-help.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,6 @@ source: Rmd

::::::::::::::::::::::::::::::::::::::::::::::::::

```{r, include=FALSE, info=output}
```

## Getting help with R

<img src="fig/oreilly_book_covers.png" alt="rstudio default session" style="width: 600px;"/>
Expand Down Expand Up @@ -72,27 +69,27 @@ on any analysis you are doing. When you run the same script that has worked fine
a dozen times before, looking back at these notes will remind you that you
upgraded R and forget to check your script.

> ```
> sessionInfo()
> ```
> ```
> R version 3.2.3 (2015-12-10)
> Platform: x86_64-pc-linux-gnu (64-bit)
> Running under: Ubuntu 14.04.3 LTS
>
> locale:
> [1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C LC_TIME=en_US.UTF-8
> [4] LC_COLLATE=en_US.UTF-8 LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8
> [7] LC_PAPER=en_US.UTF-8 LC_NAME=C LC_ADDRESS=C
> [10] LC_TELEPHONE=C LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C
>
> attached base packages:
> [1] stats graphics grDevices utils datasets methods base
>
> loaded via a namespace (and not attached):
> [1] tools_3.2.3 packrat_0.4.9-1
> ```
```
sessionInfo()
```

```
R version 3.2.3 (2015-12-10)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 14.04.3 LTS
locale:
[1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C LC_TIME=en_US.UTF-8
[4] LC_COLLATE=en_US.UTF-8 LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8
[7] LC_PAPER=en_US.UTF-8 LC_NAME=C LC_ADDRESS=C
[10] LC_TELEPHONE=C LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C
attached base packages:
[1] stats graphics grDevices utils datasets methods base
loaded via a namespace (and not attached):
[1] tools_3.2.3 packrat_0.4.9-1
```

Many times, there may be some issues with your data and the way it is formatted.
In that case, you may want to share that data with someone else. However, you
Expand All @@ -103,24 +100,24 @@ yet, we will get to it!) and save it to a file. In our example we will use the
`dput()` function on the `iris` dataframe which is an example dataset that is
installed in R:

> ```
> dput(head(iris)) # iris is an example data.frame that comes with R
> # the `head()` function just takes the first 6 lines of the iris dataset
> ```
```
dput(head(iris)) # iris is an example data.frame that comes with R
# the `head()` function just takes the first 6 lines of the iris dataset
```

This generates some output (below) which you will be better able to interpret
after covering the other R lessons. This info would be helpful in understanding
how the data is formatted and possibly revealing problematic issues.

> ```
> structure(list(Sepal.Length = c(5.1, 4.9, 4.7, 4.6, 5, 5.4),
> Sepal.Width = c(3.5, 3, 3.2, 3.1, 3.6, 3.9), Petal.Length = c(1.4,
> 1.4, 1.3, 1.5, 1.4, 1.7), Petal.Width = c(0.2, 0.2, 0.2,
> 0.2, 0.2, 0.4), Species = structure(c(1L, 1L, 1L, 1L, 1L,
> 1L), .Label = c("setosa", "versicolor", "virginica"), class = "factor")), .Names = c("Sepal.Length",
> "Sepal.Width", "Petal.Length", "Petal.Width", "Species"), row.names = c(NA,
> 6L), class = "data.frame")
> ```
```
structure(list(Sepal.Length = c(5.1, 4.9, 4.7, 4.6, 5, 5.4),
Sepal.Width = c(3.5, 3, 3.2, 3.1, 3.6, 3.9), Petal.Length = c(1.4,
1.4, 1.3, 1.5, 1.4, 1.7), Petal.Width = c(0.2, 0.2, 0.2,
0.2, 0.2, 0.4), Species = structure(c(1L, 1L, 1L, 1L, 1L,
1L), .Label = c("setosa", "versicolor", "virginica"), class = "factor")), .Names = c("Sepal.Length",
"Sepal.Width", "Petal.Length", "Petal.Width", "Species"), row.names = c(NA,
6L), class = "data.frame")
```

Alternatively, you can also save objects in R memory to a file by specifying
the name of the object, in this case the `iris` data frame, and passing a
Expand Down
Loading

0 comments on commit 465adc8

Please sign in to comment.