Where is your favorite NFL teams cap space going…Part1(NFC)

Where is your favorite NFL teams cap space going…Part1(NFC)

Was interested in getting a look at how each team is spending their cap by position group. In order to get the data I went to spotrac, which is a great site for interactively managing your teams salary cap. The position groups I split that data into are:

QB: Quarterback

RB: Running back which includes Full backs as well

TE: Tight End

WR: Wide Receiver

OL: Offensive line which includes center, gaurd and tackles

ST: Special Teams which includes punter, long snapper, kicker

DL: Defensive line which includes nose tackles, defensive tacklets and defensive end

LB: Linebacker which includes ILB, OLB

DB Defensive backs which includes CB, S, FS, SS

Below are graphs and tables of each teams cap space by division.

NFC East

NFC North

NFC South

NFC West

Technical Details

NFC East

NFCE-PerPosition

Dallas Cowboys New York Giants Philadelphia Eagles Washington Redskins NFL
DB 32,517,674 24,210,851 22,215,313 20,417,799 26,240,056
DL 10,995,953 33,863,231 14,542,212 21,341,639 21,559,330
LB 19,166,315 16,750,859 25,526,573 21,093,256 21,687,341
OL 21,659,580 19,946,109 36,196,468 28,012,731 25,224,340
QB 21,697,516 24,988,400 24,084,500 21,787,333 17,635,072
RB 9,168,992 10,994,037 13,267,311 1,392,909 7,603,650
ST 5,920,000 3,725,000 3,847,168 2,612,500 4,598,119
TE 11,742,142 1,710,047 5,326,897 8,952,278 7,136,520
WR 20,135,362 12,750,655 9,632,507 25,216,781 17,016,041
Total 153,003,534 148,939,189 154,638,949 150,827,226 148,700,468

 

NFCE-CapTotal

team_lg cap
Dallas Cowboys 153,003,534.00
New York Giants 148,939,189.00
Philadelphia Eagles 154,638,949.00
Washington Redskins 150,827,226.00
NFL 148,700,467.53

 

NFC North

NFCN-PerPosition

Chicago Bears Detroit Lions Green Bay Packers Minnesota Vikings NFL
DB 11,933,993 17,976,563 26,425,315 31,075,280 26,240,056
DL 10,802,270 17,658,801 14,155,762 28,816,518 21,559,330
LB 33,848,070 16,110,645 36,248,769 11,125,803 21,687,341
OL 18,892,048 16,635,996 24,802,901 38,342,094 25,224,340
QB 19,606,667 23,385,434 19,830,908 5,121,379 17,635,072
RB 2,113,756 3,389,020 3,888,337 15,089,750 7,603,650
ST 5,330,327 4,600,164 3,940,000 3,196,048 4,598,119
TE 5,299,257 9,369,926 4,639,959 9,842,136 7,136,520
WR 26,532,299 31,995,217 20,514,889 7,375,500 17,016,041
Total 134,358,687 141,121,766 154,446,840 149,984,508 148,700,468

NFCN-CapTotal

team_lg cap
Chicago Bears 134358687
Detroit Lions 141121766
Green Bay Packers 154446840
Minnesota Vikings 149984508
NFL 148700467.5

NFC South

NFCS-PerPosition

Atlanta Falcons Carolina Panthers New Orleans Saints Tampa Bay Buccaneers NFL
DB 12,996,775 9,366,346 30,666,335 29,760,125 26,240,056
DL 21,786,004 20,013,543 14,311,219 32,639,717 21,559,330
LB 13,193,402 16,946,538 25,871,529 14,394,757 21,687,341
OL 32,510,564 23,545,400 24,026,456 24,820,006 25,224,340
QB 26,786,474 22,310,000 32,022,864 8,792,029 17,635,072
RB 2,372,750 14,064,730 10,031,191 9,625,988 7,603,650
ST 6,743,333 5,475,667 5,220,000 3,086,830 4,598,119
TE 4,975,878 7,689,497 5,671,266 5,549,829 7,136,520
WR 26,015,153 10,490,331 5,920,718 19,669,753 17,016,041
Total 147,380,333 129,902,052 153,741,578 148,339,034 148,700,468

NFCS-CapTotal

team_lg cap
Atlanta Falcons 147,380,333.00
Carolina Panthers 129,902,052.00
New Orleans Saints 153,741,578.00
Tampa Bay Buccaneers 148,339,034.00
NFL 148,700,467.53

NFC West

NFCW-PerPosition

Arizona Cardinals Los Angeles Rams San Francisco 49ers Seattle Seahawks NFL
DB 27,549,850 25,316,530 19,046,652 40,990,742 26,240,056
DL 24,358,032 34,440,531 16,521,411 22,919,173 21,559,330
LB 18,545,398 16,014,777 24,957,641 14,674,279 21,687,341
OL 25,449,085 22,096,357 27,191,734 10,257,720 25,224,340
QB 21,297,712 18,203,311 18,825,554 18,547,000 17,635,072
RB 5,233,268 8,486,987 5,216,786 7,151,703 7,603,650
ST 1,450,500 4,720,995 4,652,550 5,326,667 4,598,119
TE 5,184,876 8,339,327 3,991,964 12,604,853 7,136,520
WR 26,263,175 12,138,843 12,967,161 14,146,617 17,016,041
Total 155,331,896 149,757,658 133,371,453 146,618,754 148,700,468

NFCW-CapTotal

 

team_lg cap
Arizona Cardinals 155,331,896.00
Los Angeles Rams 149,757,658.00
San Francisco 49ers 133,371,453.00
Seattle Seahawks 146,618,754.00
NFL 148,700,467.53

Technical Details

The functions I needed to write to get this done are here:

[code language=”r”]
library(ggplot2)
library(plyr)
library(reshape2)
library(scales)
library(xtable)
options(scipen=10)

getDivisionTable <- function(divisionDf){
teamNames <- as.character(unique(divisionDf["team_lg"])[,1])
positionGroups <- as.character(unique(divisionDf["positionGroup"])[,1])

tableData <- c()
for(position in positionGroups){
#print(position)
positionDf <- divisionDf[divisionDf["positionGroup"] == position,]
for(i in 1:length(teamNames)){
#print(teamNames[i])
teamPositionDf <- positionDf[positionDf["team_lg"] == teamNames[i],]
tableData <- c(tableData, prettyNum(as.numeric(teamPositionDf["capHit"]), big.mark = ","))
}
}

#Add Total To table
for(a in 1:length(teamNames)){
teamOnly <- divisionDf[divisionDf["team_lg"] == teamNames[a],]
tableData <- c(tableData, prettyNum(sum(teamOnly["capHit"]), big.mark = ","))
}

table <- matrix(tableData, ncol=length(teamNames), byrow=TRUE)
colnames(table) <- teamNames
rownames(table) <- c(positionGroups, "Total")

return(table)
}

#Class to return
setClass(Class="CapDfs",representation(
divisionCapPerPositionGroup="data.frame",
divisionCapTotalPerTeam="data.frame",
divisonTable="matrix",
division="character"
))

#Get graph’s and tables by division
generateCapOutputPerDivision <- function(allDf, division){
#Strip out each entry with a percentage and get rid of any entry left over
#that doesn’t have a cap hit
all_hitCap <- all_tm_caps[!is.na(allDf$percentage),]
all_hitCap <- all_hitCap[!is.na(all_hitCap$capHit),]

#Summarise data by teamName, division, positionGroup
all_tms_pos_group <- ddply(all_hitCap, .(teamName,division,positionGroup), summarise, capNum=sum(capHit))

#Add an NFL Constant to help summarise league averages
league <- rep("NFL", nrow(all_tms_pos_group))

#Bind the league constant
all_tms_pos_group <- cbind(all_tms_pos_group, league)

#Summarize all the data by league
league_summary <- ddply(all_tms_pos_group, .(league,positionGroup), summarise, cap=mean(capNum))

#Filter by division
divisionDf <- all_tms_pos_group[all_tms_pos_group$division == division,]

#Add League summary back in here:
divisionDf <- subset(divisionDf, select = -c(division, league))
colnames(divisionDf) <- c("team_lg", "positionGroup", "capHit")
colnames(league_summary) <- c("team_lg", "positionGroup", "capHit")

#Combine date
divisionDf <- rbind(divisionDf, league_summary)

#Total by division
totalDf <- ddply(divisionDf, .(team_lg), summarise, cap=sum(capHit))

divisionTable <- getDivisionTable(divisionDf)
#divisionTable <- xtable(divisionTable)

#Put data in class
return(new("CapDfs",divisionCapPerPositionGroup=divisionDf,
divisionCapTotalPerTeam=totalDf,
divisonTable=divisionTable,
division=division))
}
[/code]

With those functions in place I was able to create the necessary graphs and tables with the following code:

[code language=”r”]
#Read in data
all_tm_caps <- getDfFromDir("data/")

#Create filter
dataFilter <- c("NFCE", "NFCN", "NFCS", "NFCW", "AFCE", "AFCN", "AFCS", "AFCW")

for(division in dataFilter){
print(paste("Division", division))
divisionData <- generateCapOutputPerDivision(all_tm_caps, division)

#Graph Division Data
ggplot(data=divisionData@divisionCapPerPositionGroup, aes(x=team_lg, capHit, fill=positionGroup )) + geom_bar(stat="identity", position="dodge") + ggtitle(paste(divisionData@division, "Cap Per Team")) + theme(axis.text.x = element_text(angle = 45, hjust = 1))

#Write PNG
ggsave(filename=paste(division, "PerPosition.png", sep="-"))

#Position Group
write.csv(divisionData@divisonTable, paste(division, "TablePerPositionGroup.csv"))

#Write CSV
ggplot(data=divisionData@divisionCapTotalPerTeam, aes(x=team_lg, cap)) + geom_bar(stat="identity") + ggtitle(paste(divisionData@division, " Total Cap Per Team"))

#Write PNG
ggsave(filename=paste(division, "CapTotal.png", sep="-"))

#Total
write.csv(divisionData@divisionCapTotalPerTeam, paste(division, "TableTotal.csv"))
}
[/code]

Leave a Reply

Your email address will not be published. Required fields are marked *