Commit c2ab1029 authored by Arndt Leininger's avatar Arndt Leininger

Exercise 1

parent 584d590e
......@@ -19,19 +19,27 @@ output:
```{r showInstructor, echo=FALSE}
###########################################
showInstruct = FALSE # Set to TRUE to produce instructor output.
showInstruct = TRUE # Set to TRUE to produce instructor output.
# Set FALSE for student version
############################################
```
In this practical exercise you will apply your newly acquired R skills for data collection and cleaning.
```{r setup, echo=TRUE, eval=showInstruct, message=FALSE}
```{r setup_hidden, echo=FALSE, eval=showInstruct, message=FALSE}
# Here we load the packages that we need for the exercise
library(dplyr) # for using filter()
library(stringr) # for editing strings
# setwd('')
# setwd('path to your working directory')
```
```{r setup, echo=TRUE, eval=FALSE, message=FALSE}
# Here we load the packages that we need for the exercise
library(dplyr) # for using filter()
library(stringr) # for editing strings
setwd('path to your working directory')
```
```{r include=FALSE, eval=FALSE}
......@@ -60,7 +68,7 @@ e <- read.csv('elec_data.csv', skip = 5, header = T, sep = ';',
stringsAsFactors = F)
```
**3. Variable names were split across 3 rows in the original dataset, so have not been understood by stata. Use the index of old names and the vector of new names to rename your variables**
**3. Variable names were split across 3 rows in the original dataset, so have not been understood by `R`. Use the index of old names and the vector of new names to rename your variables**
- Old names: `c(1:4, 8, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40, 42, 44, 46, 104, 106)`
- New names: `c('no', 'district', 'landid', 'eligible', 'voters', 'cdu1', 'cdu2',
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment