diff --git a/intro-to-R-tidyverse/00b-debugging_resources.Rmd b/intro-to-R-tidyverse/00b-debugging_resources.Rmd index bd5dbe5f..76c05aaa 100644 --- a/intro-to-R-tidyverse/00b-debugging_resources.Rmd +++ b/intro-to-R-tidyverse/00b-debugging_resources.Rmd @@ -21,8 +21,8 @@ gloss over an error message without actually reading it. Often, R may be telling you exactly what is wrong, but if you don't take the time to understand what the error message means, you will have trouble fixing the error. Error messages often refer to R terms (e.g.. "argument", "directory") so if you need a refresher -on what some terms mean, we recommend running through the [`intro-to-R` notebook](https://alexslemonade.github.io/training-modules/intro-to-R-tidyverse/01-intro_to_r.nb.html) -or going through Hadley Wickham's [R for Data Science](https://r4ds.had.co.nz/) +on what some terms mean, we recommend running through the [`01-intro_to_base_R.Rmd` notebook](https://github.com/AlexsLemonade/training-modules/blob/master/intro-to-R-tidyverse/01-intro_to_base_R.Rmd) +or going through Hadley Wickham's [R for Data Science](https://r4ds.hadley.nz/). Secondly, realize that just because you don't receive an error message, doesn't mean that your code did what you intended it to. You also will need to carefully @@ -88,7 +88,7 @@ documentation will give you a lot of the information you need. However, you will also likely find that not all documentation is thorough or clear. As we discussed in -[`intro_to_R` notebook](https://alexslemonade.github.io/training-modules/intro-to-R-tidyverse/01-intro_to_r.nb.html), +[`01-intro_to_base_R.Rmd` notebook](https://github.com/AlexsLemonade/training-modules/blob/master/intro-to-R-tidyverse/01-intro_to_base_R.Rmd), objects have *structures* and *types*. Having input that doesn't match the requirements that a function has can be a common source of errors. Pay special attention to what the documentation says about what kind of input and output @@ -154,7 +154,7 @@ you use R. Many of these can be relatively simple to fix if you know what they mean, so we have explained what are the most likely origins of these errors and we've also included helpful StackOverflow posts or other articles that go over the same or similar problems, where applicable. Also remember that when we use -this notation: '', these are placeholders for whatever +this notation: ``, these are placeholders for whatever specific object, filename, function name or what have you, might be reported. #### _Example Error 1:_ "No such file or directory" @@ -169,7 +169,7 @@ to where R is looking for the file that you are referencing, and double check that the file you are looking at is where you think it is. This [StackOverflow post](https://stackoverflow.com/questions/16798605/cannot-open-file-reason-no-such-file-or-directory) shows why using `file.path` function can help avoid this error in some situations. -RStudio also has a [blog post](https://support.rstudio.com/hc/en-us/articles/200711843-Working-Directories-and-Workspaces) +RStudio also has a [blog post](https://support.posit.co/hc/en-us/articles/200711843-Working-Directories-and-Workspaces-in-the-RStudio-IDE) that touches on this subject. #### _Example Error 2:_ "could not find function" @@ -202,7 +202,7 @@ you can try to re-install the package using `install.packages` function or if it's from Bioconductor `BiocManager::install` and then try again. If the package fails to install, there can be a number of reasons it failed, so you will need to troubleshoot that on your own, following the approaches we laid out in the -first part of this document. This [RStudio blog](https://support.rstudio.com/hc/en-us/articles/200554786-Problem-Installing-Packages) +first part of this document. This [RStudio blog](https://support.posit.co/hc/en-us/articles/200554786-Problem-Installing-Packages-in-the-RStudio-IDE) covers some reasons installation may have failed. This [StackOverflow post](https://stackoverflow.com/questions/25721884/how-should-i-deal-with-package-xxx-is-not-available-for-r-version-x-y-z-wa) also discusses how to attack problems with installing packages. @@ -217,7 +217,7 @@ looking for what types of objects the function is built to use. After you determine what type of object the function is looking for, you can attempt to convert it by using `as.numeric` or the respective `as.` function. If you are trouble with this error often, we recommend you take another look -through the [`intro_to_R` notebook](https://alexslemonade.github.io/training-modules/intro-to-R-tidyverse/01-intro_to_r.nb.html) +through the [`01-intro_to_base_R.Rmd` notebook](https://github.com/AlexsLemonade/training-modules/blob/master/intro-to-R-tidyverse/01-intro_to_base_R.Rmd) or if you'd like a more advanced explanation, we recommend [Hadley Wickham's Advanced R chapter](http://adv-r.had.co.nz/S3.html) on the handling of object types. @@ -245,7 +245,7 @@ capitalization and punctuation so even the smallest typo can break your code. So for this error, it's particularly important to check the `Arguments` section of the function's documentation. -## Some other resources about debugging: +## Some other resources about debugging - [R's introduction to getting help](https://www.r-project.org/help.html) - [Tips for debugging code](https://blog.hartleybrody.com/debugging-code-beginner/) diff --git a/intro-to-R-tidyverse/00c-good_scientific_coding_practices.Rmd b/intro-to-R-tidyverse/00c-good_scientific_coding_practices.Rmd index 8ff13ada..24c8d022 100644 --- a/intro-to-R-tidyverse/00c-good_scientific_coding_practices.Rmd +++ b/intro-to-R-tidyverse/00c-good_scientific_coding_practices.Rmd @@ -14,8 +14,8 @@ Just how incorrect punctuation and grammar can distract a reader from the messag Your code is not as useful if it isn't easily readable, which is why naming conventions, code style, and consistency are important. We suggest following a style guide like one of these: -- [Hadley Wickham's R Style Guide](http://adv-r.had.co.nz/Style.html) -- [Google's R Style Guide](https://google.github.io/styleguide/Rguide.xml). +- [The Tidyverse Style Guide](https://style.tidyverse.org/) +- [Google's R Style Guide](https://google.github.io/styleguide/Rguide.xml) ## `set.seed()` helps people reproduce your results @@ -92,4 +92,4 @@ This way, when others try to reproduce your research, they know what packages yo - ['Ten simple rules' for reproducible computational research (PLOS)](https://journals.plos.org/ploscompbiol/article?id=10.1371/journal.pcbi.1003285) - ['Ten simple rules' for documenting scientific software (PLOS)](https://journals.plos.org/ploscompbiol/article?id=10.1371/journal.pcbi.1006561) -- [Guide to reproducible code](https://github.com/crazyhottommy/getting-started-with-genomics-tools-and-resources/blob/master/guide-to-reproducible-code.pdf) +- [Guide to reproducible code](https://github.com/crazyhottommy/getting-started-with-genomics-tools-and-resources/blob/f01008791135887d973469869ceb074082666210/guide-to-reproducible-code.pdf) diff --git a/intro-to-R-tidyverse/01-intro_to_base_R.Rmd b/intro-to-R-tidyverse/01-intro_to_base_R.Rmd index 7f552f96..ffd13665 100644 --- a/intro-to-R-tidyverse/01-intro_to_base_R.Rmd +++ b/intro-to-R-tidyverse/01-intro_to_base_R.Rmd @@ -24,7 +24,7 @@ This notebook will demonstrate how to: #### *More resources for learning R* - [Swirl, an interactive tutorial](https://swirlstats.com/) -- [_R for Data Science_ book](https://r4ds.had.co.nz/) +- [_R for Data Science_ book]((https://r4ds.hadley.nz/) - [Tutorial on R, RStudio and R Markdown](https://ismayc.github.io/rbasics-book/) - [Handy R cheatsheets](https://www.posit.co/resources/cheatsheets/) - [R Markdown website](https://rmarkdown.rstudio.com) diff --git a/intro-to-R-tidyverse/02-intro_to_ggplot2.Rmd b/intro-to-R-tidyverse/02-intro_to_ggplot2.Rmd index c0d67142..fbbd2ae0 100644 --- a/intro-to-R-tidyverse/02-intro_to_ggplot2.Rmd +++ b/intro-to-R-tidyverse/02-intro_to_ggplot2.Rmd @@ -34,7 +34,7 @@ We performed three sets of contrasts: - [ggplot2 website](https://ggplot2.tidyverse.org/) - [Handy cheatsheet for ggplot2 (pdf)](https://github.com/rstudio/cheatsheets/raw/main/data-visualization.pdf) - [_Data Visualization, A practical introduction_](https://socviz.co/) -- [Data visualization chapter of _R for Data Science_](https://r4ds.had.co.nz/data-visualisation.html) +- [Data visualization chapter of _R for Data Science_](https://r4ds.hadley.nz/data-visualize.html) - [ggplot2 online tutorial](http://r-statistics.co/Complete-Ggplot2-Tutorial-Part1-With-R-Code.html) ## Set Up diff --git a/intro-to-R-tidyverse/03-intro_to_tidyverse.Rmd b/intro-to-R-tidyverse/03-intro_to_tidyverse.Rmd index 098bb88e..b3d3d915 100644 --- a/intro-to-R-tidyverse/03-intro_to_tidyverse.Rmd +++ b/intro-to-R-tidyverse/03-intro_to_tidyverse.Rmd @@ -27,7 +27,7 @@ It is a pre-processed [astrocytoma microarray dataset](https://www.refine.bio/ex **More tidyverse resources:** -- [R for Data Science](https://r4ds.had.co.nz/) +- [R for Data Science](https://r4ds.hadley.nz/) - [tidyverse documentation](https://tidyverse.org/) - [`dplyr` documentation](https://dplyr.tidyverse.org/) - [`readr` documentation](https://readr.tidyverse.org/) @@ -178,7 +178,7 @@ What information is contained in `gene_df`? One nifty feature that was added to `R` in version 4.1 is the pipe: `|>`. Pipes are very handy things that allow you to funnel the result of one expression to the next, making your code more streamlined and fluently expressing the flow of data through a series of operations. -_Note:_ If you are using a version of `R` prior to 4.1 (or looking at older code), pipe functionality was available through the `magrittr` package , which used a pipe that looked like this: `%>%`. +_Note:_ If you are using a version of `R` prior to 4.1 (or looking at older code), pipe functionality was available through the `magrittr` package, which used a pipe that looked like this: `%>%`. That pipe was the inspiration for the native R pipe we are using here. While there are some minor differences, you can mostly treat them interchangeably as long as you load the `magrittr` package or `dplyr`, which also loads that version of the pipe. diff --git a/scRNA-seq-advanced/02-dataset_integration.Rmd b/scRNA-seq-advanced/02-dataset_integration.Rmd index 7385152e..3449abc3 100644 --- a/scRNA-seq-advanced/02-dataset_integration.Rmd +++ b/scRNA-seq-advanced/02-dataset_integration.Rmd @@ -95,7 +95,7 @@ We want to read in just four of these files, as listed previously. To read in these files, we could use the `readr::read_rds()` function (or the base R `readRDS()`) four times, once for each of the files. We could also use a `for` loop, which is the approach that many programming languages would lean toward. A different and more modular coding approach to reading in these files (and more!) is to leverage the [`purrr`](https://purrr.tidyverse.org/) `tidyverse` package, which provides a convenient set of functions for operating on lists. -You can read more about these functions and their power and utility in R in [Chapter 21 of _R for Data Science_](https://r4ds.had.co.nz/iteration.html#for-loops-vs.-functionals). +You can read more about the `purrr` functions and their power and utility in R in [the "Functionals" chapter of the _Advanced R_ e-book](https://adv-r.hadley.nz/functionals.html). Of particular interest is the [`purrr::map()`](https://purrr.tidyverse.org/reference/map.html) family of functions, which can be used to run a given function on each element of a list (or vector) in one call. The general syntax for `purrr::map()` and friends is: diff --git a/scRNA-seq/05-clustering_markers_scRNA.Rmd b/scRNA-seq/05-clustering_markers_scRNA.Rmd index d952536c..6c9fc36a 100644 --- a/scRNA-seq/05-clustering_markers_scRNA.Rmd +++ b/scRNA-seq/05-clustering_markers_scRNA.Rmd @@ -232,7 +232,7 @@ markers[[1]] |> You can see that this table includes values for all genes, so we would like to make a shorter list. -Because we tend to like [tidy data](https://r4ds.had.co.nz/tidy-data.html), here we use a `tidyverse` function from the [`purrr` package](https://purrr.tidyverse.org) to apply the same operations as above to every element of the `markers` list. +Because we tend to like [tidy data](https://r4ds.hadley.nz/data-tidy.html), here we use a `tidyverse` function from the [`purrr` package](https://purrr.tidyverse.org) to apply the same operations as above to every element of the `markers` list. We will introduce `purrr` briefly here, but if you want more information and background, we recommend the [`purrr` cheatsheet (PDF)](https://github.com/rstudio/cheatsheets/raw/main/purrr.pdf) and Jenny Bryan's great [`purrr` tutorial](https://jennybc.github.io/purrr-tutorial/index.html).