This is an R Markdown document. Markdown is a simple formatting syntax for authoring HTML, PDF, and MS Word documents. For more details on using R Markdown see http://rmarkdown.rstudio.com.
When you click the Knit button a document will be generated.
# Read CSV files <- Everything after a # is a comment and not evaluated
library(tidyverse) # Load a library that provides more functions
charts <- read_csv("data/charts_global_at.csv") # Read the data; '<-' is the assignment operator, notice that 'charts' appears on the right
## Rows: 292600 Columns: 34
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: ","
## chr (13): trackID, trackName, artistName, artistIds, region, isrc, primary_...
## dbl (19): rank, streams, dayNumber, explicit, trackPopularity, n_available_...
## date (2): day, releaseDate
##
## ℹ Use `spec()` to retrieve the full column specification for this data.
## ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
charts # View some of the data
R-code is contained in so called “chunks”. These chunks always start with three backticks `
and r
in curly braces ({r}
) and end with three backticks. Optionally, parameters can be added after the r
to influence how a chunk behaves. Additionally, you can also give each chunk a name. Note that these have to be unique, otherwise R will refuse to knit your document. A new code chunk can also be added by using the shortcut Ctrl+Alt+i
(Strg+Alt+i
on a German keyboard).
You can suppress messages and warnings by adding message=FALSE, warning=FALSE
to the chunk header like so
```{r charts_no_messages, message=FALSE, warning=FALSE}
# Read CSV files
library(tidyverse)
charts <- read_csv("charts_global_at.csv")
charts
```
# Read CSV files
library(tidyverse)
charts <- read_csv("charts_global_at.csv")
charts
In addition you can even hide the code using echo=FALSE
(similar to slides)
```{r charts_no_code, message=FALSE, warning=FALSE, echo=FALSE}
# Read CSV files
library(tidyverse)
charts <- read_csv("charts_global_at.csv")
charts
```