<!-- layout: true --> <!-- <div class="my-footer"><span>bit.ly/LINK • @ellamkaye</span></div> --> <!-- layout: true --> <!-- <div class="my-footer"><span>bit.ly/LINK • @nj_tierney</span></div> --> --- class: inverse, left, middle # GETTING HELP IN R .larger[Ella Kaye | bseeR | January 28th, 2021] --- # Me and R - Studying for a PhD in Statistics at the University of Warwick - Getting into R: - 2014: first R course as part of Statistics MSc - 2015: first taste of `ggplot2` - 2016: first R package - 2017: first community involvement (useR!2017, [Oxford R User Group](https://r-oxford.github.io), [rainbowR](https://rainbowr.slack.com), [@R_LGBTQ](https://twitter.com/R_LGBTQ)) - 2020: first [TidyTuesday](https://github.com/rfordatascience/tidytuesday) contribution - 2021: first ... --- # Overview ### Looking for answers - in R - online ### Asking questions - Typology of questions - Reproducible examples and `reprex` package - Where to ask ### Resources --- class: center, middle, inverse # LOOKING FOR ANSWERS --- class: center, middle, inverse # In R --- # Within R - Help with functions ```r # help with a specific function help(function_name) ?function_name # quick reminder of the function arguments arg(function_name) # see an example example(function_name) # see the source code function_name ``` --- # Within R - `help.search` ```r # when ?function_name fails (e.g. don't have library loaded) help.search("function_name") # note quotation marks ??function_name # for when you can't quite remember the function name ??something_like_function_name ``` --- # Within R - Help with package ```r # `help` help(package = "package_name") # Help panel in RStudio will give links to all documentation # and help pages for that package # find/browse vignettes for installed (or specific) packages browseVignettes() browseVignettes("package_name") # use auto-completion in RStudio to see what functions # are in a package ?package:: ``` `dplyr` demo RStudio Help home demo --- class: center, middle, inverse # Online --- background-image: url(images/google-help-tweet.png) background-size: 75% 75% --- class: center, bottom background-image: url(images/google-broom.png) background-size: contain --- class: center, bottom background-image: url(images/google-broom-r.png) background-size: contain --- class: center, bottom background-image: url(images/rseek-broom.png) background-size: contain --- background-image: url(https://upload.wikimedia.org/wikipedia/commons/f/f7/Stack_Overflow_logo.png) background-size: 90% --- background-image: url(images/SO-example.png) background-size: contain --- # Searching online - In Google, include "r" and package name in your search and avoid extra words - Check how recent the result is - Use [rseek.org](https://rseek.org) to search R documentation, discussion forums, blogs - Can also try [symbolhound.com](http://symbolhound.com/) if search term contains symbols - [Ecosia](https://www.ecosia.org) for ethical search - If trying to get help with an error, include the entire error message - Use tags in [StackOverflow](https://stackoverflow.com) - Check a few answers, read comments - Reputation (e.g. number of up-votes) can be a good guide --- # Issues on GitHub page - Check if it's a known problem awaiting a fix - commenting means you'll be notified of a fix --- background-image: url(https://imgs.xkcd.com/comics/wisdom_of_the_ancients.png) background-size: 75% 75% --- class: inverse, center, middle ## Always have a really good stab at finding an answer before asking a question --- class: inverse, center, middle # ASKING QUESTIONS --- class: inverse, center, middle # Typology of questions --- ## Typology of questions From [this](https://masalmon.eu/2018/07/22/wheretogethelp/) excellent blog, 'Where to get with your R questions' by Maëlle Salmon. - **Problem** - Is this a bug? Why is this code not working? How can I successfully install the `rJava` package? - **Question** - Is there a tool in R for doing foo? How do I learn about `bar`? - **Debate** - What is the best plotting library in R? Should I learn base R or tidyverse first? --- class: inverse, center, middle # Reproducible examples and `reprex` --- background-image: url(https://tenor.com/view/late-night-seth-lnsm-lnsm-gifs-seth-meyers-gif-9705583.gif) background-size: 65% --- class: middle, center # Reproducible # Minimal # Verifiable --- # reproducible - You need to capture everything - `library()` calls at the top - all necessary objects. --- # minimal - Strip away everything that is not directly related to your problem. - Small, simple data objects (usually much smaller than what you're actually working with). - Preferably built-in, familiar data sets, e.g. `mtcars` or [others](https://stat.ethz.ch/R-manual/R-devel/library/datasets/html/00Index.html) - use [datapasta]([https://github.com/milesmcbain/datapasta) when working with your own data, or data outside of R - `datapasta` demo --- # verifiable - Actually reproduces the problem! - Explain steps (using comments or rmarkdown) - Include error messages, and possibly output of `sessionInfo()` - Include what you've tried to fix it --- class: inverse, center, middle, special-bold # Can be a lot of effort, but often the process of coming up with a good **repr**oducible **ex**ample (**reprex**) allows you to identify (and possibly solve) the problem --- # The `reprex` package ```r install.packages("reprex") # Included as part of the tidyverse install.packages("tidyverse") ``` The goal of a reprex is to package your problematic code in such a way that other people can run it and feel your pain. Then, hopefully, they can provide a solution and put you out of your misery. --- # Basic `reprex` steps - write some R code - copy it - run `reprex()` (or use RStudio addin) - check locally - paste into target --- # `reprex()` demo --- # All things `reprex` Jenny Bryan's `reprex` RStudio workshop: - [Video](https://rstudio.com/resources/webinars/help-me-help-you-creating-reproducible-examples/) - [Slides](https://speakerdeck.com/jennybc/reprex-reproducible-examples-with-r) --- class: inverse, middle, center # Where to ask? --- ## Where to ask **problem** questions - For bugs/issues related to a particular package, file an issue (usually GitHub) - CRAN package page, `BugReports` url (e.g. [dplyr](https://cran.r-project.org/web/packages/dplyr/index.html)) - Bioconductor page, `BugReports` url (e.g. [treeio](https://bioconductor.org/packages/release/bioc/html/treeio.html)) - [StackOverflow](https://stackoverflow.com) (using tags, e.g. [r], [tidyverse], [ropensci]) - Community forums: - [RStudio community](https://community.rstudio.com) for questions relating to RStudio IDE, tidyverse, package development and plenty more - For questions related to open science, reproducibility, documenting data, extracting data out of something (a PDF! a PNG!), package development, rOpenSci’s [discussion forum](https://discuss.ropensci.org) might be the right venue. --- ## Where to ask **question** or **debate** questions - [RStudio community](https://community.rstudio.com) or [rOpenSci’s discussion forum](https://discuss.ropensci.org) (see above), - [R epidemics consortium](https://www.repidemicsconsortium.org/forum/) - [R for Data Science](https://www.rfordatasci.com) online community, [Slack](https://rforsatascience.slack.com) and [twitter](https://twitter.com/R4DScommunity). - Learners/mentors/community/office hours. - R [mailing lists](https://www.r-project.org/mail.html): 5 main and 22 special interest - Google groups: e.g. [ggplot2](https://groups.google.com/forum/#!forum/ggplot2) and [manipulatr](https://groups.google.com/forum/#!forum/manipulatr) for tidyverse data manipulation queries - Twitter [\#rstats](https://twitter.com/hashtag/rstats) --- # Twitter, R and #rstats - [\#rstats](https://twitter.com/hashtag/rstats) twitter is a friendly place - Twitter for rstats book: [https://www.t4rstats.com](https://www.t4rstats.com) Good for: - Easily/quickly answered questions (e.g. is there a package to do foo?) - Debate questions Not good for: - Tagging package maintainers - Too much code - Problem questions (unless sharing a link to the question elsewhere) --- background-image: url(https://media.giphy.com/media/l3q2Lz5yuEFUXX3IQ/giphy.gif) background-size: 65% --- class: inverse, center, middle # Don't be shy or embarrassed to ask questions! # It's OK not to know something! # It's OK to get something wrong! --- class: center, middle # [recipes example](https://github.com/tidymodels/recipes/issues/542) --- class: center, middle # [vignettes example](https://github.com/rstudio/rmarkdown/issues/1119) --- class: center, middle # [fonts example](https://stackoverflow.com/questions/63357522/purchased-font-in-hugo-academic-not-showing-on-all-modern-browsers-computers) --- # Helping others .pull-left[ - **Answer questions** - e.g. StackOverflow [[r]](https://stackoverflow.com/questions/tagged/r) and twitter ([#rstats](https://twitter.com/hashtag/rstats)) - **Generate content** - blog posts ([distill](https://themockup.blog/posts/2020-08-01-building-a-blog-with-distill/), [blogdown](https://bookdown.org/yihui/blogdown/), [hugodown](https://hugodown.r-lib.org)) - Share code (e.g. [#TidyTuesday](https://twitter.com/hashtag/tidytuesday), [#FunctionFriday](https://twitter.com/hashtag/functionfriday), [gists](https://gist.github.com)) ] .pull-right[ - **File issues** on GitHub - **Engage** in community forums - Become a mentor in the R for Data Science [community](https://www.rfordatasci.com) - **Contribute** to open source packages ([however small!](https://github.com/tidyverse/modelr/pull/55)) - **Document** code - package help pages, vignettes ] --- class: inverse, center, middle # RESOURCES --- # Resources: Asking questions - StackOverflow guides and question on what makes a good question [https://stackoverflow.com/help/mcve](https://stackoverflow.com/help/mcve) [https://stackoverflow.com/help/how-to-ask](https://stackoverflow.com/help/how-to-ask) [https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example](https://stackoverflow.com/help/mcve) --- # Resources: `reprex` - reprex package on tidyverse site [http://reprex.tidyverse.org](http://reprex.tidyverse.org) - reprex package on GitHub [https://github.com/tidyverse/reprex](https://github.com/tidyverse/reprex) - Jenny Bryan webinar [https://rstudio.com/resources/webinars/help-me-help-you-creating-reproducible-examples/](https://rstudio.com/resources/webinars/help-me-help-you-creating-reproducible-examples/) - Excellent blogpost (with gifs!) [http://www.njtierney.com/post/2017/01/11/magic-reprex](http://www.njtierney.com/post/2017/01/11/magic-reprex/) --- # Resources: `tidyverse` help - tidyverse guide to getting help [http://www.tidyverse.org/help](http://www.tidyverse.org/help/) - tidyverse guide to contributing [http://www.tidyverse.org/contribute](http://www.tidyverse.org/contribute) --- # Resources: Blogposts - Common errors in R [https://github.com/noamross/zero-dependency-problems/blob/master/misc/stack-overflow-common-r-errors.md](https://github.com/noamross/zero-dependency-problems/blob/master/misc/stack-overflow-common-r-errors.md) tl; dr: Most errors in R are due to looking for something that isn't there. - Where to get help [https://masalmon.eu/2018/07/22/wheretogethelp/](https://masalmon.eu/2018/07/22/wheretogethelp/) --- # Resources: Slides - Slides made with [xaringan](https://github.com/yihui/xaringan) - Slides styled with [xaringanthemer](https://github.com/gadenbuie/xaringanthemer) - Fonts from [Google Fonts](https://fonts.google.com): - Header font in **Cabin** - Body text font is **Montserrat** - Code font is **Fira Code** - Template available: [ellakaye/emk-talks](https://github.com/EllaKaye/emk-talks) --- class: inverse, middle .large[ - When faced with a question/problem, have a good look for an answer in R itself and/or online - Don't be shy to ask questions! - Write reproducible examples - Give thought to where you ask/post your question - Give back by helping others ] --- class: left, end .right[# Thank you! ## Any questions? ### <span style="color:#FDFCFA">Blank line</span>] .large[
[bit.ly/emk-getting-help-in-R](http://bit.ly/emk-getting-help-in-R)
[E.Kaye.1@warwick.ac.uk](mailto:E.Kaye.1@warwick.ac.uk)
[@ellamkaye](https://twitter.com/ellamkaye)
[ellakaye.rbind.io](https://ellakaye.rbind.io)
[github.com/EllaKaye](https://github.com/ellakaye) ]