-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmyths.Rmd
113 lines (96 loc) · 3 KB
/
myths.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
---
title: "Myths"
author: "Ron Blum"
date: "3/27/2018"
output:
html_document: default
pdf_document:
latex_engine: lualatex
word_document: default
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```
## Generating Deities
First, some info about a list of deities.
```{r deities}
name <- c("Loki", "Thor", "Odin", "Athena", "Zeus", "Hades", "Hel", "Isis", "Minerva", "Jupiter", "Osiris", "Pluto", "Baldur", "Pan", "Echo", "Valkyrie", "Aphrodite", "Heracles", "Hercules")
pantheon <- c("Norse", "Norse", "Norse", "Greek", "Greek", "Greek", "Norse", "Egyptian", "Roman", "Roman", "Egyptian", "Roman", "Norse", "Greek", "Greek", "Norse", "Greek", "Greek", "Roman")
type <- c("god", "god", "god", "god", "god", "god", "god", "god", "god", "god", "god", "god", "god", "god", "other", "warrior", "god", "warrior", "warrior")
domain <- c("Mischief", "Thunder", "Ruler", "Wisdom", "Ruler", "Underworld", "Underworld", "Nature", "Wisdom", "Ruler", "Underworld", "Underworld", "Beauty", "Nature", "Echo", "Fallen Heroes", "Beauty", "Strength", "Strength")
gender <- c("M", "M", "M", "F", "M", "M", "F", "F", "F", "M", "M", "M", "M", "M", "F", "F", "F", "M", "M")
gender_factor <- factor(gender)
levels(gender_factor) <- c("Female", "Male")
home <- c("Asgard", "Asgard", "Asgard", "Mt. Olympus", "Mt. Olympus", "Hell", "Hell", "Earth", "Mt. Olympus", "Mt. Olympus", "Hell", "Hell", "Asgard", "Earth", "Earth", "Earth", "Mt. Olympus", "Earth", "Earth")
deities <- data.frame(name, pantheon, type, domain, gender_factor, home)
deities
str(deities)
summary(deities)
```
## Locating Places
Next, some info about places.
```{r places, echo=FALSE}
location <- c("Asgard", "Earth", "Hell", "Mt. Olympus")
placement <- c("H", "M", "L", "H")
placement_factor <- factor(placement, ordered = TRUE, levels = c("L", "M", "H"))
levels(placement_factor) <- c("Down Below", "In the Middle", "High Above")
places <- data.frame(location, placement_factor)
summary(placement_factor)
str(placement_factor)
str(places)
summary(places)
places
```
## Including Excel
And here's some info from Excel.
```{r excel}
# library(tidyverse)
library(readxl)
library(dplyr)
in_deities <- read_excel("Deities.xlsx")
in_deities
in_deities[3:4,1:2]
in_deities["Pantheon"]
```
## Looking in
Let's take a look inside.
```{r look}
deities
in_deities
list()
head(deities)
head(in_deities)
```
## Plyring a bit
Let's explore with dplyr.
```{r dplyr}
in_deities %>%
filter(Name == "Loki")
in_deities %>%
count(Pantheon)
in_deities %>%
count(Home)
in_deities %>%
filter(Pantheon == "Norse")
in_deities %>%
filter(Pantheon == "Norse", Home == "Asgard")
in_deities %>%
filter(Pantheon == "Norse", Home == "Asgard")
in_deities %>%
filter(Pantheon == "Greek", Home != "Mt. Olympus")
in_deities %>%
count(Pantheon)
in_deities %>%
count(Pantheon)
in_deities %>%
filter(Pantheon != "Greek") %>%
count(Pantheon)
in_deities %>%
count(Pantheon != "Greek")
in_deities %>%
filter(Domain == "Underworld")
in_deities %>%
filter(Domain == "Underworld") %>%
count()
```
All done.