This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name":"Feathers Analytics Theme", | |
"background":"#E7E7E7", | |
"foreground":"#44546A", | |
"tableAccent":"#2EB2FF", | |
"dataColors":["#44546A","#2EB2FF","#FF2EA4"] | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name":"Feathers Analytics Theme", | |
"background":"#E7E7E7", | |
"foreground":"#44546A", | |
"tableAccent":"#2EB2FF", | |
"dataColors":["#44546A","#2EB2FF","#FF2EA4"], | |
"visualStyles":{ | |
"*":{ | |
"*":{ | |
"*":[{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Feathers <- 7 | |
Analytics <- 4 | |
Feathers + Analytics | |
feathers_analytics <- 'new object' | |
feathers_analytics |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(readxl) | |
library(dplyr) | |
library(broom) | |
data <- read_excel("C:/Users/jfthr/Google Drive/Feathers Analytics/R Visuals Presentation/R Visuals Power BI Fantasy.xlsx") | |
model_data <- data %>% | |
select(Player, TeamGroup, Price, Selected, Points, MP) | |
top_teams <- model_data %>% |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
##Load Packages needed to run the R code | |
library(readxl) | |
library(tidyverse) | |
##Import Data | |
file_path <- ##"file path of the source Excel file/Predictive Analytics with R in Power BI.xlsx" | |
data_set <- read_excel(file_path) %>% | |
select(id, total_points, now_cost, selected_by_percent, minutes, goals_scored, assists, clean_sheets, pos) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
model_data <- dataset | |
fantasy_lm <- lm(points_per_90 ~ now_cost + goals_scored + assists + clean_sheets, data = model_data) | |
model_data$score_lm <- predict(fantasy_lm, model_data) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
##Load Packages | |
library(tidyverse) | |
library(rpart) | |
library(rpart.plot) | |
##Manipulate | |
model_data <- dataset | |
##Create Categorical | |
pp90_bin <- cut(model_data$points_per_90, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let | |
Source = Excel.CurrentWorkbook(){[Name=Table]}[Content], | |
#"Changed Type" = Table.TransformColumnTypes(Source,{{"Person", type text}, {"City", type text}, {"Index", type text}, {"Percentage", Int64.Type}, {"Application Date", type date}}), | |
#"Pivoted Column" = Table.Pivot(#"Changed Type", List.Distinct(#"Changed Type"[Index]), "Index", "Percentage", List.Sum), | |
#"Changed Type1" = Table.TransformColumnTypes(#"Pivoted Column",{{"1", type text}, {"2", type text}, {"3", type text}}), | |
#"Merged Columns" = Table.CombineColumns(#"Changed Type1", {"1", "2", "3", "4"},Combiner.CombineTextByDelimiter(",", QuoteStyle.None),"Merged"), | |
#"Trim Text" = Table.AddColumn(#"Merged Columns", "Percentages", each Text.TrimEnd([Merged], ","), type text), | |
#"Removed Columns" = Table.RemoveColumns(#"Trim Text",{"Merged"}) | |
in | |
#"Removed Columns" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let | |
Source = Excel.CurrentWorkbook(){[Name=Table]}[Content], | |
#"Changed Type" = Table.TransformColumnTypes(Source,{{"Person", type text}, {"City", type text}, {"Index", type text}, {"Percentage", Int64.Type}, {"Application Date", type date}}), | |
#"Pivoted Column" = Table.Pivot(#"Changed Type", List.Distinct(#"Changed Type"[Index]), "Index", "Percentage", List.Sum), | |
#"Demoted Headers" = Table.DemoteHeaders(#"Pivoted Column"), | |
#"Kept First Rows" = Table.FirstN(#"Demoted Headers",1), | |
#"Transposed Table" = Table.Transpose(#"Kept First Rows"), | |
#"Changed Type1" = Table.TransformColumnTypes(#"Transposed Table",{{"Column1", Int64.Type}}), | |
#"Removed Errors" = Table.RemoveRowsWithErrors(#"Changed Type1", {"Column1"}), | |
#"Transposed Table1" = Table.Transpose(#"Removed Errors"), |