Skip to content

Instantly share code, notes, and snippets.

@darh78
Last active November 25, 2017 19:09
Show Gist options
  • Save darh78/0597eb6064f94552a352a17d276dad92 to your computer and use it in GitHub Desktop.
Save darh78/0597eb6064f94552a352a17d276dad92 to your computer and use it in GitHub Desktop.
---
title: "R Notebook"
output: html_notebook
---
```{r}
library(dplyr)
library(Lahman)
library(knitr)
library(kableExtra)
library(formattable)
Batting %>% filter(G >= 160, HR > 50) %>%
mutate(player = cell_spec(playerID, color = ifelse(HR > 30, "darkgreen", "darkgray")), # This is shown in the table as hmtl code
HR = color_bar("lightgreen")(HR)) %>% # This is shown in the table as hmtl code
select(player, G, HR) %>%
arrange(desc(G), G) %>%
#as.data.frame() %>%
kable("html", caption = "Games") %>%
kable_styling(bootstrap_options = "striped",
full_width = F,
position = "left") %>%
column_spec(2, bold = T)
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment