Skip to content

Commit

Permalink
week2 solutions
Browse files Browse the repository at this point in the history
  • Loading branch information
mrtnj committed Jan 19, 2017
1 parent 73f694e commit 915f585
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 3 deletions.
13 changes: 12 additions & 1 deletion week2_solutions.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ library(ggplot2)
library(plyr)
library(reshape2)
library(readr)
library(stringr)
```


Expand Down Expand Up @@ -81,11 +82,12 @@ We make a scatterplot:
qplot(x = women, y = men, data = year_best_fixed)
```

And calculate correlation:
And calculate correlation and regression:

```{r}
cor(year_best_fixed$women, year_best_fixed$men, use = "pairwise")
cor.test(year_best_fixed$women, year_best_fixed$men)
lm(women ~ men, year_best_fixed)
```


Expand Down Expand Up @@ -124,3 +126,12 @@ x <- seq(from = 0, to = 2 * pi, by = 0.1)
trigonometric_table(x)
```


# 5

```{r}
filenames <- paste("data_", 1:14, ".txt", sep = "")
str_replace(filenames, pattern = ".txt", replacement = "")
```


Loading

0 comments on commit 915f585

Please sign in to comment.