We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 15acf22 commit 5b2ceaaCopy full SHA for 5b2ceaa
1 file changed
lunchbites/debugging/bugs.R
@@ -0,0 +1,37 @@
1
+# Much of the content presented today is based on the debugging section of the
2
+# Advanced R book (https://adv-r.hadley.nz/debugging.html)
3
+library(tidyverse)
4
+library(cicalc)
5
+
6
+# Reading error messages
7
+mtcars |>
8
+ filter(Cyl == 4)
9
10
+new_obj <- "cyl"
11
12
13
14
15
16
17
+# Reading error with many steps
18
19
+ filter(cyl == 4) |>
20
+ mutate(vroom_index = hp*drat/wt) |>
21
+ summarise(mean(vroom_index))
22
23
24
+# Debugging my own code
25
+my_function <- function(x){
26
+ while(x < 10){
27
+ x <- x + 1
28
+ }
29
+ x
30
+}
31
32
+# Debugging others code
33
+test <- rbinom(50, 1, 0.6)
34
+ci_prop_wald(test)
35
+debugonce(ci_prop_wald)
36
+debug(mutate)
37
+undebug(mutate)
0 commit comments