-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfaq.qmd
More file actions
272 lines (181 loc) · 13.3 KB
/
faq.qmd
File metadata and controls
272 lines (181 loc) · 13.3 KB
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
# Frequently Asked Questions
## What other computers on campus have R?
* All campus computers should have R & R Studio installed on them.
* Butte 207 & 211 are open computer labs.
* [Wildcat Lab](https://support.csuchico.edu/TDClient/1984/Portal/KB/ArticleDet?ID=112333)
## Getting started / Installing Programs
* Installing R & R Studio [[Windows]](https://www.youtube.com/watch?v=gx7A7C_wdyE) [[Mac]](https://www.youtube.com/watch?v=Y20P3u3c_1c)
* How to navigate R Studio: https://www.rstudio.com/products/RStudio/?wvideo=520zbd3tij
* Setting sanity preferences in R Studio: https://youtu.be/49u5xAYfrgk
* Setting up your class folder (Windows): https://youtu.be/ayar0LFRg0U
* Downloading Homework: https://youtu.be/p9BujthQETs
* Getting started with Homework 1: https://media.csuchico.edu/media/MATH130%20-%20Extra%20Video%20(Jan%2029)/1_9nsoxdy9
## Advice on asking for help
The key to receiving help from someone is for them to rapidly grasp your problem. You should make it as easy as possible to pinpoint where the issue might be.
Try to use the correct words to describe your problem. For instance, a package is not the same thing as a library. Most people will understand what you meant, but it can make things confusing for people trying to help you. Be as precise as possible when describing your problem.
:warning: Don't let not knowing exactly how to describe your problem prevent you from asking. Screenshots help tremendously!
**When asking someone for help try to**
1. Explain what thing you are trying to do
2. Explain/show the code you wrote to try to do that thing
3. Explain/show your result, and if it's not obvious explain why you feel it's not the correct result. (E.g. you expected the answer to be 5, but instead it's 10. )
:warning: Don't spend more than 20 minutes banging your head on the wall before you ask for help!
## Help from inside R Studio
### Use the built-in RStudio help interface to search for more information on R functions
One of the fastest ways to get help is to use the RStudio help interface. This panel by default can be found at the lower right hand panel of RStudio. As seen in the screenshot, by typing the word `mean`, RStudio tries to also give a number of suggestions that you might be interested in. The description is then shown in the display window.
### I know the name of the function I want to use, but I'm not sure how to use it
If you need help with a specific function, let's say `barplot()`, you can type:
```{r, eval=FALSE, purl=FALSE}
?barplot
```
If you just need to remind yourself of the names of the arguments, you can use:
```{r, eval=FALSE, purl=FALSE}
args(lm)
```
### I want to use a function that does X, there must be a function for it but I don't know which one...
If you are looking for a function to do a particular task, you can use the
`help.search()` function, which is called by the double question mark `??`.
However, this only looks through the installed packages for help pages with a
match to your search request
```{r, eval=FALSE, purl=FALSE}
??kruskal
```
If you can't find what you are looking for, you can use
the [rdocumentation.org](http://www.rdocumentation.org) website that searches
through the help files across all packages available.
Finally, a generic Google or internet search "R \<task\>" will often either send
you to the appropriate package documentation or a helpful forum where someone
else has already asked your question.
### I get an error message that I don't understand
Start by googling the error message. However, this doesn't always work very well because often, package developers rely on the error catching provided by R. You end up with general error messages that might not be very helpful to diagnose a problem (e.g. "subscript out of bounds"). If the message is very generic, you might also include the name of the function or package you're using in your query.
If you check Stack Overflow, search using the `[r]` tag. Most questions have already been answered, but the challenge is to use the right words in the search to find the answers: [http://stackoverflow.com/questions/tagged/r](http://stackoverflow.com/questions/tagged/r)
:warning: Development of R moves pretty fast. When at all possible, use results from the past 1-2 years. Anything over 5 years old for packages such as `ggplot`, `dplyr`, and `forcats` are likely obsolete.
### From a real live person
* Start by ask the person sitting next to you! Don't hesitate to talk to your neighbor, compare your answers, and ask for help.
* Ask in the Math & Statistics [Discord server](https://discord.gg/ck497bJty5) - we have a dedicated channel just for this class but a lot of students in the server know how to use R.
* Attend [Community Coding](https://www.csuchico.edu/datascience/community-coding.shtml).
- Drop in work session & dedicated space to work on coding projects.
- Collaborate with your peers and learn from experts.
- Some hours are held over Zoom
<!-- updateme -->
For Spring 2025 help is available both in person and online.
<!-- * The person sitting next to you. Don't hesitate to talk to your neighbor, -->
<!-- compare your answers, and ask for help. (as applicable) -->
<!-- * Your friendly classmates: if you know someone with more experience than you, -->
<!-- they might be able and willing to help you. -->
* Attend [Community Coding](https://www.csuchico.edu/datascience/community-coding.shtml).
- Drop in work session & dedicated space to work on coding projects.
- Collaborate with your peers and learn from experts.
- Some hours are held over Zoom
* The [Discord Server](https://discord.gg/ck497bJty5)
- Go to the `#class-selection` text channel in the left sidebar, and click the RStudio icon emoji under the second post to self-assign you to the Math-130 role, or click on the Snake icon emoji to self-assign you to the Math-131 role. This will let you see and access the class channels.
- See [Syllabus: Student Support](syllabus.html) for details
## Other Online
* In RStudio go to `Help` --> `Cheatsheets` or to this URL https://posit.co/resources/cheatsheets/
* [Stack Overflow](http://stackoverflow.com/questions/tagged/r): if your question
hasn't been answered before and is well crafted, chances are you will get an
answer in less than 5 min. Remember to follow their guidelines on [how to ask
a good question](http://stackoverflow.com/help/how-to-ask).
* [Chico R Users Google Group](https://groups.google.com/forum/#!forum/chico-rug).
* The [Posit Community](https://forum.posit.co/): it is
read by a lot of people and is welcoming to new users.
* If your question is about a specific package, see if there is a mailing list
for it. Usually it's included in the DESCRIPTION file of the package that can
be accessed using `packageDescription("name-of-package:. You may also want
to try to email the author of the package directly, or open an issue on the
code repository (e.g., GitHub).
## Online from people
* In RStudio go to `Help` --> `Cheatsheets`
* R Studio Cloud interactive lessons: https://rstudio.cloud/learn/primers
* [Stack Overflow](http://stackoverflow.com/questions/tagged/r): if your question
hasn't been answered before and is well crafted, chances are you will get an
answer in less than 5 min. Remember to follow their guidelines on [how to ask
a good question](http://stackoverflow.com/help/how-to-ask).
* [Join the discord server]( https://discord.gg/ck497bJty5).
* The [R-Studio Community](https://community.rstudio.com/): it is
read by a lot of people and is more welcoming to new users than the R list-serv.
* If your question is about a specific package, see if there is a mailing list
for it. Usually it's included in the DESCRIPTION file of the package that can
be accessed using `packageDescription("name-of-package")`. You may also want
to try to email the author of the package directly, or open an issue on the
code repository (e.g., GitHub).
* Twitter: #rstats
## Using AI tools
> write guidance here
## Written / blogs
If you're a book kinda person, there is plenty of help available as well. Many have online versions or free PDF's.
* R Markdown, the Definitive Guide: https://bookdown.org/yihui/rmarkdown/
* R for Data Science https://r4ds.had.co.nz/
* Cookbook for R http://www.cookbook-r.com/
* R Graphics Cookbook (I use this all the time) -- Chapter 8 in the above link
* The Art of R Programming https://nostarch.com/artofr.htm
* R for... http://r4stats.com/
- Excel Users https://www.rforexcelusers.com/
- SAS and SPSS Users http://r4stats.com/books/r4sas-spss/
- STATA Users http://r4stats.com/books/r4stata/
## Written references
If you're a book kinda person, there is plenty of help available as well. Many have online versions or free PDF's.
* R Markdown, the Definitive Guide: https://bookdown.org/yihui/rmarkdown/
* R for Data Science https://r4ds.had.co.nz/
* Cookbook for R http://www.cookbook-r.com/
* The Art of R Programming https://nostarch.com/artofr.htm
* R for... http://r4stats.com/
- Excel Users https://www.rforexcelusers.com/
- SAS and SPSS Users http://r4stats.com/books/r4sas-spss/
- STATA Users http://r4stats.com/books/r4stata/
* [R graphics cookbook](https://r-graphics.org/)
* [R charts](https://r-charts.com/) and [R graph gallery](https://r-graph-gallery.com/)-- for inspiration on what plots to create
* [STDHA](http://sthda.com/english/) for a analysis and graphing options
### Want to get fancy?
* [Hello Quarto](https://quarto.org/)
* [ggpubr](https://rpkgs.datanovia.com/ggpubr/) for near publication ready plots
* [sjPlot](https://strengejacke.github.io/sjPlot/index.html) to visualize model results
* [tidymodels](https://www.tidymodels.org/) a new(ish) way of modeling data
----
## Random blogs
* The [Posting Guide](http://www.r-project.org/posting-guide.html) for the R
mailing lists.
* [How to ask for R help](http://blog.revolutionanalytics.com/2014/01/how-to-ask-for-r-help.html)
useful guidelines
* [This blog post by Jon Skeet](http://codeblog.jonskeet.uk/2010/08/29/writing-the-perfect-question/)
has quite comprehensive advice on how to ask programming questions.
----
# Common Error Messages
Taken from: http://blog.revolutionanalytics.com/2015/03/the-most-common-r-error-messages.html
* `could not find function` errors, usually caused by typos or not loading a required package
* `Error in if` errors, caused by non-logical data or missing values passed to R's `if` conditional statement
* `Error in eval` errors, caused by references to objects that don't exist
* `cannot open` errors, caused by attempts to read a file that doesn't exist or can't be accessed
* `no applicable method` errors, caused by using an object-oriented function on a data type it doesn't support
* `subscript out of bounds` errors, caused by trying to access an element or dimension that doesn't exist
* package errors caused by being unable to install, compile or load a package.
### I get an error message that I don't understand
Start by googling the error message. However, this doesn't always work very well because often, package developers rely on the error catching provided by R. You end up with general error messages that might not be very helpful to diagnose a problem (e.g. "subscript out of bounds"). If the message is very generic, you might also include the name of the function or package you're using in your query.
If you check Stack Overflow, search using the `[r]` tag. Most questions have already been answered, but the challenge is to use the right words in the search to find the answers: [http://stackoverflow.com/questions/tagged/r](http://stackoverflow.com/questions/tagged/r)
:warning: Development of R moves pretty fast. When at all possible, use results from the past 1-2 years. Anything over 5 years old for packages such as `ggplot`, `dplyr`, and `forcats` are likely obsolete.
## Where can I get help using R outside of class time?
### Use the built-in RStudio help interface to search for more information on R functions
One of the fastest ways to get help is to use the RStudio help interface. This panel by default can be found at the lower right hand panel of RStudio. As seen in the screenshot, by typing the word `mean`, RStudio tries to also give a number of suggestions that you might be interested in. The description is then shown in the display window.
### I know the name of the function I want to use, but I'm not sure how to use it
If you need help with a specific function, let's say `barplot()`, you can type:
```{r, eval=FALSE, purl=FALSE}
?barplot
```
If you just need to remind yourself of the names of the arguments, you can use:
```{r, eval=FALSE, purl=FALSE}
args(lm)
```
### I want to use a function that does X, there must be a function for it but I don't know which one...
If you are looking for a function to do a particular task, you can use the
`help.search()` function, which is called by the double question mark `??`.
However, this only looks through the installed packages for help pages with a
match to your search request
```{r, eval=FALSE, purl=FALSE}
??kruskal
```
If you can't find what you are looking for, you can use
the [rdocumentation.org](http://www.rdocumentation.org) website that searches
through the help files across all packages available.
Finally, a generic Google or internet search "R \<task\>" will often either send
you to the appropriate package documentation or a helpful forum where someone
else has already asked your question.
----