Skip to content
This repository was archived by the owner on Aug 4, 2020. It is now read-only.
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 19 additions & 1 deletion 01-intro-to-R.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,27 @@ _Start by showing an example of a script_
- the assignment operator `<-`
- the `=` for arguments
- the comments `#` and how they are used to document function and its content
- the `$` operator
* Point to indentation and consistency in spacing to improve clarity

Example script:

```{r, purl = FALSE}
# This is a comment, R will not read anything following a hashtag

x <- 6
y <- 19
z <- sum(x, y) # This is a function

# Syntax for an if statement
# If the expression inside the () is true, R will evaluate everything inside the {}
if (z > 10){
vector <- c(x, y, z)
}

# Print vector and the length of vector
vector
length(vector)
```

## Creating objects

Expand Down