<- "2"
a + 1 a
DAL tutorial - Week 9
Troubleshooting
1 Troubleshooting
Go to https://bookdown.org/yih_huynh/Guide-to-R-Book/trouble.html and read about common errors and how to fix them.
2 Fix me!
The following code chunks have code that throws errors or generate mistakes (without throwing errors). Try to run them in R, study the error and fix the code!
Example 1:
Example 2:
Note: The goal of the following code chunk is to produce a tibble/data frame.
|>
iris group_by(species) |>
summary(
mean = mean(Petal.Lengths)
)
Example 3:
library(dplyr)
library(MASS)
|>
iris select(Species, Petal.Length, Petal.Width)
Example 4:
lirbary(tidyvrese)
starwarsmutate(
sex = fatcor(sex, level = c("female", "hermaphrodite", "male", "none"))
|>
) count(Sex)
Do all of the levels of the variable sex
show up in your tibble/data frame of counts?
Example 4:
|>
iris ggplot(x = Species, y = Petal.Length) |>
geom_jiter()
Example 5:
<- tibble(
bat id = c(A, B, C),
response = rbinom(10, 1, 0.5)
)
cat(bat.response)
Example 6:
%>%
starwars filter(sex != is.na(sex)) %>%
ggplot(aes(x = mass, y = height, colour = sex, shape = sex) +
geom_point() +
scale_x_log10()
labs(
x = "Mass"
y = "Height"
colour = "Sex"
shape = "Sex
)
Example 7:
<- read_csv("data/tucker2019/mald_1_1.rds")
tucker2019
%>%
tucker2019 ggplot(aes(x = isword, y = RT, colour = ACC, fill = ACC)) +
geom_jitter(
alpha = 0.3,
position_jitterdodge(),
+
) scale_colour_manual(values = c("#dc050c", "#196b50", ))
3 Where to ask for help online
There are a few places you can ask for help online:
StackOverflow is always a good place to start. You should first check if your question or a similar one has been answered already (in most cases, it has!) and if not you can post your question. Make sure you include a Minimal Working Example.
Another place is the Posit Community. It’s similar to StackOverflow, but it is specific to R and RStudio related things.
You can also ask ChatGPT for help. It is usually good for programming/coding stuff, but not so much for statistics.
If you have issues with specific R packages, you could open an issue on GitHub on the respective package repository to let the developer know about the issue.
In most cases, even just searching for your question using any web search engine will take you to the right places.