-
Notifications
You must be signed in to change notification settings - Fork 0
/
L5R_Rulings.Rmd
60 lines (41 loc) · 1.27 KB
/
L5R_Rulings.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
---
title: "L5R Rulings"
date: "`r format(Sys.time(), '%d %B, %Y')`"
output:
pdf_document: default
html_document:
df_print: paged
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
library("httr")
library("jsonlite")
library("lubridate")
options(stringsAsFactors = FALSE)
## This gets the cards for the names
url <- "http://api.fiveringsdb.com/"
path <- "/cards"
raw.result <- GET(url = url, path = path)
this.raw.content <- rawToChar(raw.result$content)
nchar(this.raw.content)
substr(this.raw.content, 1, 100)
this.content <- fromJSON(this.raw.content)
cards <- this.content[[2]]
## This gets the rulings
url <- "http://api.fiveringsdb.com/"
path <- "/rulings"
raw.result <- GET(url = url, path = path)
this.raw.content <- rawToChar(raw.result$content)
nchar(this.raw.content)
substr(this.raw.content, 1, 100)
this.content <- fromJSON(this.raw.content)
rulings <- this.content[[2]]
rulings <- rulings[order(rulings$card),]
```
This is a list of all the current rulings from the FiveRingsDB.com website.
```{r, results='asis', comment=NA, echo=FALSE}
count <- length(rulings$card[,1])
for (i in 1:count){
cat('\n', "**Card: ", cards[cards$id == rulings$card[i,],]$name, "**\n\n", rulings$text[i],"\n","*Source:",rulings$source[i],"*\n","\n","\n")
}
```