-
Notifications
You must be signed in to change notification settings - Fork 0
/
getting_help_with_R.qmd
41 lines (30 loc) · 1.99 KB
/
getting_help_with_R.qmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
---
title: "Getting Help with R"
author: "Novica Nakov"
format:
html:
toc: true
toc-location: left
toc-depth: 2
number-sections: true
number-depth: 3
editor: visual
---
There are many good resources online that describe a good way to aska question that relates to coding problems. For example, Stack Overflow has a page dedicated to that: [How do I ask a good question?](https://stackoverflow.com/help/how-to-ask). The Rstudio subreddit also has one: [How to ask good questions](https://www.reddit.com/r/RStudio/comments/1aq2te5/how_to_ask_good_questions/). Additionally, there is the [Getting Help](https://r4ds.hadley.nz/workflow-help) section of the R for Data Science book.
We encourage you to read those, and the related links on hose pages.
In general, a question has to give the people who could answer it enough context so that they can reproduce your eviroment, your code, and your mental model. That would enable them to reproduce the issue as well. Often writing a question like this will help you solve the problem yourself. But in the event that you still need help, consider making a reproducible example.
A reproducible example (reprex) is a minimal code example that captures the enviroment (i.e. libraries), the data, and the problematic code. Writing this type of a reprex will help you think about the problem more clearly and even may present a solution for you.
To share this reprex with other people, you can use the dedicated package that is called `reprex` and you can install it using `install.packages('reprex')`. Caling `reprex::reprex()` in your envrioment then will produce the reproducible example in a sharable format that other people can run in their R console.
For example if the code you are running is:
``` r
y <- 1:4
mean(y)
```
The sharable snippet would be ater running `reprex::reprex()`:
``` r
y <- 1:4
mean(y)
#> [1] 2.5
```
^CreateCreated on 2024-10-07 with [reprex v2.1.1](https://reprex.tidyverse.org)^
This can then be copy/pasted to a console to test it.