You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For novice or inexperienced coders that want to use **R**. We will use RStudio to:
19
+
For novice or inexperienced coders that want to use **R**. We will use RStudio to learn:
20
20
21
-
+Use and write basic functions.
22
-
+Learn how R stores and handles different types of data.
21
+
+How to use and write basic functions.
22
+
+How R stores and handles different types of data.
23
23
+ Basic ways to create, manipulate, import, clean, and summarize data.
24
-
+*NO* statistical modeling.
24
+
+But *NOT* statistical modeling.
25
25
26
26
## Workshop format
27
27
28
-
+ From 1 to 5 pm.
28
+
+ From 1 to 4:45 pm.
29
29
+ Breaks every 90 minutes.
30
30
+ A few slides for context and extra information.
31
31
+ A lot of hands-on coding and live demonstrations.
32
32
+ All materials will be available after the workshop ends.
33
33
34
34
::: {.notes}
35
-
This workshop runs from 1 to 5 pm, with breaks at least every 90 minutes. Right now I will use a few slides for context and extra information. But it is a WORKshop, so there will be plenty of hands-on coding and live demonstrations. All materials will be available after the workshop ends, so don't worry about copying these slides.
35
+
This workshop runs from 1 to 4:45 pm, with breaks every 90 minutes. Right now I will use a few slides for context and extra information. But this is a WORKshop, so there will be plenty of hands-on coding and live demonstrations. All materials will be available after the workshop ends, so don't worry about copying these slides.
36
36
:::
37
37
38
38
## Tips for this workshop
@@ -83,7 +83,7 @@ There are several ways to contact CSCAR. You can request a consultation by email
83
83
+ ...which means learning it well from the beginning.
84
84
85
85
::: {.notes}
86
-
My name is Abner Heredia Bustos. I am a data science consultant at CSCAR. Apart from this, all you need to know is that, for me, coding is just a mean to an end. This means that I will try hard to make coding as simple and effortless as possible for you; but to achieve this you will need to put some effort in learning the basics.
86
+
My name is Abner Heredia Bustos. I am a data science consultant at CSCAR. Apart from this, all you need to know is that, for me, coding is just a mean to an end. So, I will try hard to make coding as simple and effortless as possible for you; but to achieve this you will need to put some effort in learning the basics.
87
87
:::
88
88
89
89
# Why do you want to learn R?
@@ -136,7 +136,7 @@ R is very powerful because it is an environment, not a package. A package is a f
136
136
+ Generalized linear models (including linear regression).
137
137
+ Survival analysis.
138
138
+ Time series analysis.
139
-
+Random and Mixed effects models.
139
+
+Multilevel models.
140
140
+ Classification and clustering.
141
141
+ Sample size and power calculations.
142
142
+ Multivariable analysis (e.g., factor analysis, PCA, and SEM).
@@ -220,7 +220,7 @@ Think of an integer, double it, add six, divide it in half, subtract the number
220
220
## Object names have rules
221
221
222
222
+ Names are case-sensitive (`age`, `Age` and `AGE` are three different objects).
223
-
+ Reserved words can *not* be used as names (`TRUE`, `FALSE`, `NULL`, `if`, ...).
223
+
+ Reserved words (`TRUE`, `FALSE`, `NULL`, `if`, ...) can *not* be used as names
224
224
225
225
## Tips for naming objects
226
226
@@ -230,7 +230,16 @@ Think of an integer, double it, add six, divide it in half, subtract the number
230
230
231
231
## Exercise
232
232
233
-
Write a function that can simulate the roll of a pair of six-sided dice an arbitrary number of times. This function should return a vector with the values of the red die that were strictly larger than the corresponding values of the blue die. Hint: to simulate rolling a die, you can use the function `sample()`.
233
+
Write a function that can simulate the roll of two six-sided dice, one red and one blue, an arbitrary number of times. This function should return a vector with the values of the red die that were strictly larger than the corresponding values of the blue die.
234
+
235
+
## Exercise step by step
236
+
237
+
+ Step 1: define a function that takes one argument, `num_rolls`, representing the number of times to roll the dice.
238
+
+ Step 2: create two objects called `red` and `blue` to store the results from the dice rolls.
239
+
+ Step 3: simulate the dice rolls using function `sample()` (read its help page if you need to).
240
+
+ Step 4: create a vector of indices that identifies the values in the red die that were larger than the values in the blue die.
241
+
+ Step 5: use this vector of indices to extract the values from the red die.
242
+
+ Step 6: make sure that your function returns the values you extracted in step 5.
0 commit comments