This workshop will cover:
ggplot2
): April 21, 2022
🕘: 09:00 - 17:30
Time | Activity |
---|---|
09:00 - 10:15 | Module 1 |
10:15 - 10:30 | Break |
10:30 - 12:00 | Module 2 |
12:00 - 13:00 | LUNCH |
13:00 - 14:15 | Module 3 |
14:15 - 14:25 | Break |
14:25 - 15:30 | Module 4 |
15:30 - 15:40 | Break |
15:40 - 17:00 | Module 5 |
17:00 - 17:30 | Post workshop Q&A; one-on-one help |
[1] Do you have any experience with R? [pick 1 response]
[2] What do you want to learn during this R Workshop? [free text, can enter multiple responses]
[3] What intimidates you about learning R? [free text, can enter multiple responses]
Old Fashioned "command line"
Integrated Development Environment
NOTE: This is NOT a GUI
Go to File/New Project
Choose New Directory
Click New Project
Type in folder name and choose parent directory
Rworkshop
projectGo to https://melindahiggins2000.github.io/CDC_Rworkshop_April2022/
Download module01_Rscript.R
and put it into the new folder on your computer, e.g. C:\Rworkshop
.
Rworkshop
folder on your computerRworkshop
folder/RStudio projectClick on module01_Rscript.R
to open it.
Type code at command line or run one line at a time from script window.
Code lines run in the console or from script window
4 + 4
[1] 8
Code lines run in the console or from script window
4 + 4sqrt(25)
[1] 8
[1] 5
Code lines run in the console or from script window
4 + 4sqrt(25)pi
[1] 8
[1] 5
[1] 3.141593
Code lines run in the console or from script window
4 + 4sqrt(25)piseq(from=1, to=10, by=0.5)
[1] 8
[1] 5
[1] 3.141593
[1] 1.0 1.5 2.0 2.5 3.0 3.5 4.0 4.5 5.0 5.5 6.0 6.5 7.0 7.5 8.0[16] 8.5 9.0 9.5 10.0
We really don't want to keep typing one line at a time in the Console, so we need to save/store value(s) in an object. An object is a text string we use to retrieve the value (or elements) we saved. Let's save the results of 2+2
in an object result
.
For this we will use the ASSIGN operator <-
.
result <- 2+2
We really don't want to keep typing one line at a time in the Console, so we need to save/store value(s) in an object. An object is a text string we use to retrieve the value (or elements) we saved. Let's save the results of 2+2
in an object result
.
For this we will use the ASSIGN operator <-
.
result <- 2+2
This is saved now in your "Global Environment". To retrieve this value, simply type the text string result
to see the value 4
.
result
[1] 4
We really don't want to keep typing one line at a time in the Console, so we need to save/store value(s) in an object. An object is a text string we use to retrieve the value (or elements) we saved. Let's save the results of 2+2
in an object result
.
For this we will use the ASSIGN operator <-
.
result <- 2+2
This is saved now in your "Global Environment". To retrieve this value, simply type the text string result
to see the value 4
.
result
[1] 4
Create Objects and Use Them
# save sequence of numbers in object xx <- seq(from=1, to=10, by=0.5)
Create Objects and Use Them
# save sequence of numbers in object xx <- seq(from=1, to=10, by=0.5)# view the contents of xx
[1] 1.0 1.5 2.0 2.5 3.0 3.5 4.0 4.5 5.0 5.5 6.0 6.5 7.0 7.5 8.0[16] 8.5 9.0 9.5 10.0
Create Objects and Use Them
# save sequence of numbers in object xx <- seq(from=1, to=10, by=0.5)# view the contents of xx# use x to create new object yy <- x*x
[1] 1.0 1.5 2.0 2.5 3.0 3.5 4.0 4.5 5.0 5.5 6.0 6.5 7.0 7.5 8.0[16] 8.5 9.0 9.5 10.0
Create Objects and Use Them
# save sequence of numbers in object xx <- seq(from=1, to=10, by=0.5)# view the contents of xx# use x to create new object yy <- x*x# plot x and yplot(x,y)
[1] 1.0 1.5 2.0 2.5 3.0 3.5 4.0 4.5 5.0 5.5 6.0 6.5 7.0 7.5 8.0[16] 8.5 9.0 9.5 10.0
How many objects are in your "Environment" [top right window]
What kind of object is x
?
How many elements does y
have in it?
Where do you see the plot?
To find out what the seq()
function does, in the Console window [bottom left] at the prompt >
type:
help(seq)
seq(from=1, to=10, by=0.5)
[1] 1.0 1.5 2.0 2.5 3.0 3.5 4.0 4.5 5.0 5.5 6.0 6.5 7.0 7.5 8.0[16] 8.5 9.0 9.5 10.0
Notice that we used equals =
inside the ()
to assign values to the arguments for the seq()
function.
ZOOM BREAKOUT, 5 MIN
Keyboard shortcuts
↑, ←, Pg Up, k | Go to previous slide |
↓, →, Pg Dn, Space, j | Go to next slide |
Home | Go to first slide |
End | Go to last slide |
Number + Return | Go to specific slide |
b / m / f | Toggle blackout / mirrored / fullscreen mode |
c | Clone slideshow |
p | Toggle presenter mode |
t | Restart the presentation timer |
?, h | Toggle this help |
o | Tile View: Overview of Slides |
Esc | Back to slideshow |
This workshop will cover:
ggplot2
): April 21, 2022
🕘: 09:00 - 17:30
Time | Activity |
---|---|
09:00 - 10:15 | Module 1 |
10:15 - 10:30 | Break |
10:30 - 12:00 | Module 2 |
12:00 - 13:00 | LUNCH |
13:00 - 14:15 | Module 3 |
14:15 - 14:25 | Break |
14:25 - 15:30 | Module 4 |
15:30 - 15:40 | Break |
15:40 - 17:00 | Module 5 |
17:00 - 17:30 | Post workshop Q&A; one-on-one help |
[1] Do you have any experience with R? [pick 1 response]
[2] What do you want to learn during this R Workshop? [free text, can enter multiple responses]
[3] What intimidates you about learning R? [free text, can enter multiple responses]
Old Fashioned "command line"
Integrated Development Environment
NOTE: This is NOT a GUI
Go to File/New Project
Choose New Directory
Click New Project
Type in folder name and choose parent directory
Rworkshop
projectGo to https://melindahiggins2000.github.io/CDC_Rworkshop_April2022/
Download module01_Rscript.R
and put it into the new folder on your computer, e.g. C:\Rworkshop
.
Rworkshop
folder on your computerRworkshop
folder/RStudio projectClick on module01_Rscript.R
to open it.
Type code at command line or run one line at a time from script window.
Code lines run in the console or from script window
4 + 4
[1] 8
Code lines run in the console or from script window
4 + 4sqrt(25)
[1] 8
[1] 5
Code lines run in the console or from script window
4 + 4sqrt(25)pi
[1] 8
[1] 5
[1] 3.141593
Code lines run in the console or from script window
4 + 4sqrt(25)piseq(from=1, to=10, by=0.5)
[1] 8
[1] 5
[1] 3.141593
[1] 1.0 1.5 2.0 2.5 3.0 3.5 4.0 4.5 5.0 5.5 6.0 6.5 7.0 7.5 8.0[16] 8.5 9.0 9.5 10.0
We really don't want to keep typing one line at a time in the Console, so we need to save/store value(s) in an object. An object is a text string we use to retrieve the value (or elements) we saved. Let's save the results of 2+2
in an object result
.
For this we will use the ASSIGN operator <-
.
result <- 2+2
We really don't want to keep typing one line at a time in the Console, so we need to save/store value(s) in an object. An object is a text string we use to retrieve the value (or elements) we saved. Let's save the results of 2+2
in an object result
.
For this we will use the ASSIGN operator <-
.
result <- 2+2
This is saved now in your "Global Environment". To retrieve this value, simply type the text string result
to see the value 4
.
result
[1] 4
We really don't want to keep typing one line at a time in the Console, so we need to save/store value(s) in an object. An object is a text string we use to retrieve the value (or elements) we saved. Let's save the results of 2+2
in an object result
.
For this we will use the ASSIGN operator <-
.
result <- 2+2
This is saved now in your "Global Environment". To retrieve this value, simply type the text string result
to see the value 4
.
result
[1] 4
Create Objects and Use Them
# save sequence of numbers in object xx <- seq(from=1, to=10, by=0.5)
Create Objects and Use Them
# save sequence of numbers in object xx <- seq(from=1, to=10, by=0.5)# view the contents of xx
[1] 1.0 1.5 2.0 2.5 3.0 3.5 4.0 4.5 5.0 5.5 6.0 6.5 7.0 7.5 8.0[16] 8.5 9.0 9.5 10.0
Create Objects and Use Them
# save sequence of numbers in object xx <- seq(from=1, to=10, by=0.5)# view the contents of xx# use x to create new object yy <- x*x
[1] 1.0 1.5 2.0 2.5 3.0 3.5 4.0 4.5 5.0 5.5 6.0 6.5 7.0 7.5 8.0[16] 8.5 9.0 9.5 10.0
Create Objects and Use Them
# save sequence of numbers in object xx <- seq(from=1, to=10, by=0.5)# view the contents of xx# use x to create new object yy <- x*x# plot x and yplot(x,y)
[1] 1.0 1.5 2.0 2.5 3.0 3.5 4.0 4.5 5.0 5.5 6.0 6.5 7.0 7.5 8.0[16] 8.5 9.0 9.5 10.0
How many objects are in your "Environment" [top right window]
What kind of object is x
?
How many elements does y
have in it?
Where do you see the plot?
To find out what the seq()
function does, in the Console window [bottom left] at the prompt >
type:
help(seq)
seq(from=1, to=10, by=0.5)
[1] 1.0 1.5 2.0 2.5 3.0 3.5 4.0 4.5 5.0 5.5 6.0 6.5 7.0 7.5 8.0[16] 8.5 9.0 9.5 10.0
Notice that we used equals =
inside the ()
to assign values to the arguments for the seq()
function.
ZOOM BREAKOUT, 5 MIN