We can use R as a calculator by typing the following in “Console”:
3 * 5 + 10
x <- 3
x + x^2
For more complex analyses, we need to know definitions of common terms:
<- and = are known as “assignment operators” and they save a value (or collection of values) as a variable.y <- 2
x = 1:10
When you type the name of an object into the console, it prints to the screen. The variables can also be found in “Environment”.
x
## [1] 1 2 3 4 5 6 7 8 9 10
mean(x)
## [1] 5.5
mean() is a function that takes a numeric input and returns the mean of that input. All functions in R have () and inside those parentheses is where inputs (aka “arguments”) go.
library(fivethirtyeight)
bechdel is a data frame in fivethirtyeight package.bechdel
bechdel.?bechdel
Until recently, you could use a user name and password to log into GitHub. GitHub has deprecated using a password in that way. Instead, we will be authenticating GitHub using public/private based keys. This is a short overview for how to authenticate in this way.
credentials::ssh_setup_github() into your console.We need to configure git so that RStudio can communicate with GitHub. This requires two pieces of information: your name and the email address associated with your GitHub account.
To do so, you will use the terminal, which you can find right next to the console.
git config --global user.name 'username'
git config --global user.email 'useremail'
For example, mine would be
git config --global user.name 'jinbora0720'
git config --global user.email 'bora.jin@duke.edu'
Note: you should not have to do this every time.
ae02_Bechdel.Rmd to open the template R Markdown file.ae02_Bechdel.Rmd.