This is an R Markdown document. Markdown is a simple formatting syntax for authoring HTML, PDF, and MS Word documents. For more details on using R Markdown see http://rmarkdown.rstudio.com.
When you click the Knit button a document will be generated that includes both content as well as the output of any embedded R code chunks within the document. You can embed an R code chunk like this:
library(shiny)
## Warning: le package 'shiny' a été compilé avec la version R 4.2.3
library(rsconnect)
## Warning: le package 'rsconnect' a été compilé avec la version R 4.2.3
##
## Attachement du package : 'rsconnect'
## L'objet suivant est masqué depuis 'package:shiny':
##
## serverInfo
library(reactablefmtr)
## Warning: le package 'reactablefmtr' a été compilé avec la version R 4.2.3
## Le chargement a nécessité le package : reactable
## Warning: le package 'reactable' a été compilé avec la version R 4.2.3
library(reactable)
library(htmltools)
library(crosstalk)
## Warning: le package 'crosstalk' a été compilé avec la version R 4.2.3
##
## Attachement du package : 'crosstalk'
## L'objet suivant est masqué depuis 'package:shiny':
##
## getDefaultReactiveDomain
### load data from 538
data <- read.csv(file = "C:/Users/Quentinvdc/Desktop/RAPTOR_by_team_19-20.csv")
embed_img(
data,
height = 24,
width = 24,
horizontal_align = "center",
label = NULL,
label_position = "right"
)
reactable(data,
theme = fivethirtyeight(),
### add column group header
columnGroups = list(
colGroup(name = "OVERALL RAPTOR", columns = c("OFF","DEF","TOT"))
),
showSortIcon = FALSE,
searchable = TRUE,
language = reactableLang(
searchPlaceholder = "SEARCH FOR A PLAYER..."),
columns = list(
TEAM_NAME = colDef(show = FALSE),
CONFERENCE = colDef(show = FALSE),
RANK = colDef(maxWidth = 55, name = ""),
PLAYER = colDef(maxWidth = 225),
### add logos using embed_img()
TEAM_LOGO = colDef(
name = "TEAM",
maxWidth = 70,
align = "center",
cell = embed_img(
data,
height = 25,
width = 40,
horizontal_align = "center",
label = NULL,
label_position = "right"
)
),
### add icons using icon_assign()
MIN = colDef(
maxWidth = 85,
align = "center",
cell = icon_assign(
data,
icon = "stopwatch",
fill_color = "#555555",
buckets = 5
),
style = list(borderRight = "1px dashed rgba(0, 0, 0, 0.3)")
),
### add color scales using color_scales()
OFF = colDef(
maxWidth = 60,
cell = function(x)
sprintf("%+0.1f", x),
style = color_scales(data, colors = c("#fd84a9", "white", "#42c2ca"))
),
### add color scales using color_scales()
DEF = colDef(
maxWidth = 60,
cell = function(x)
sprintf("%+0.1f", x),
style = color_scales(data, colors = c("#fd84a9", "white", "#42c2ca"))
),
### add color scales using color_scales()
TOT = colDef(
maxWidth = 60,
cell = function(x)
sprintf("%+0.1f", x),
style = color_scales(data, colors = c("#fd84a9", "white", "#42c2ca"))
),
### add bars using data_bars_pos_neg()
WAR = colDef(
maxWidth = 280,
align = "center",
cell = data_bars(
data,
fill_color = c("#fd84a9", "#fee6ed", "#d9f2f4", "#42c2ca"),
number_fmt = scales::number_format(accuracy = 0.1)
),
style = list(borderLeft = "1px dashed rgba(0, 0, 0, 0.3)")
)
)
)
You can also embed plots, for example:
Note that the echo = FALSE parameter was added to the
code chunk to prevent printing of the R code that generated the
plot.