The ffanalytics R Package for Fantasy Football Data Analysis
520Introduction
We are continuously looking to provide users ways to replicate our analyses and improve their performance in fantasy football. To that aim, we are introducing the ffanalytics
R package that includes a streamlined version of the scripts used to scrape projections from multiple sources and calculate projected points using the wisdom of the crowd.
First, Learn the Basics of R
We have released the ffanalytics
package for fantasy football data analysis. It is a package for R, a piece of software for statistical analysis that has a steep learning curve. Before trying to use the ffanalytics
package, we highly recommend first learning the basics of R, so you know about loading packages and the different object types such as lists, vectors, data frames, etc. For more info how to learn the basics of R, see here. We will not be troubleshooting R basics with users. For troubleshooting the basics of R, please post to the R mailing list or forums if you have questions.
Familiarize Yourself with tidyverse
The latest version of the package relies heavily on the vocabulary of tidyverse
, so it would be beneficial to familiarize yourself with the concepts and notation from that envrionment. For documentation on tidyverse, please visit https://www.tidyverse.org.
What Software You Need
We recommend the latest versions of the following software:
Installation
The package is available through our GitHub repository, and installation requires that you have already installed the devtools
and rstudioapi
packages. You can install the devtools
and rstudioapi
packages in R/RStudio via:
install.packages(c("devtools","rstudioapi"), dependencies=TRUE, repos=c("http://rstudio.org/_packages", "http://cran.rstudio.com"))
You can then install the ffanalytics
R package via:
devtools::install_github(repo = "FantasyFootballAnalytics/ffanalytics", build_vignettes = TRUE)
If you you receive errors that a package is missing or a non-zero exit status error, the ffanalytics
package may not have installed the packages it depends on (or the dependencies of these packages). Here is how to install the packages manually (along with their dependencies):
install.packages(c("tidyverse","rvest","httr","readxl","janitor","glue","Hmisc"), dependencies=TRUE, repos=c("http://rstudio.org/_packages", "http://cran.rstudio.com"))
Loading the Package
After the ffanalytics
package is installed, load the package via:
library("ffanalytics")
Scraping Data
The main function for scraping data is scrape_data()
. This function scrapes data from the sources specified, for the positions specified, in the season and week specified. Here is example code to scrape data for QBs, RBs, WRs, TEs and DSTs from CBS, ESPN and Yahoo for the 2018 season:
my_scrape <- scrape_data(src = c("CBS", "ESPN", "Yahoo"),
pos = c("QB", "RB", "WR", "TE", "DST"),
season = 2018, week = 0)
my_scrape
will be a list of tibbles, one for each positon scraped, which contains the data for each source for that position. In the tibble
the data_src
column speficies the source of the data.
Calculating Projections
Once data is scraped the projected points can be calculated. this is done with the projections_table()
function:
my_projections <- projections_table(my_scrape)
This will calculate projections using the default settings. You can provide additional parameters for the projections_table()
function to customize the calculations. See ?projections_table
for details.
Adding Additional Information
To add rankings information, risk value, and ADP/AAV data, use the add_ecr()
, add_risk()
, add_adp()
, and add_aav()
functions:
my_projections <- my_projections %>% add_ecr() %>% add_risk() %>%
add_adp() %>% add_aav()
Note that add_ecr()
will need to be called before add_risk()
to ensure that the ECR data is available for the risk calculation.
The add_adp()
and add_aav()
functions allow specifying sources for ADP and AAV. See ?add_adp
, and ?add_aav
for details.
Player Data
Player data is scraped from MyFantasyLeague.com when the package loads and is stored in the player_table
object. To add player data to the projections table use the add_player_info()
function, which adds the player names, teams, positions, age, and experience to the data set.
my_projections <- my_projections %>% add_player_info()
Viewing/Saving the Projections
If you have run the scrape and saved the scraped data into an object, i.e.:
my_scrape <- scrape_data(src = c("CBS", "ESPN", "Yahoo"),
pos = c("QB", "RB", "WR", "TE", "DST"),
season = 2018, week = 0)
And if you have calculated the projections using the scraped data, i.e.:
my_projections <- projections_table(my_scrape)
Then you can view the scraped data by typing, into the R console, the name of the object storing the scraped stats, along with position. For example:
my_scrape$RB
And you can view the projections by typing, into the R console, the name of the object storing the calculated projections. For example:
my_projections
Note that, by default, tibbles only print 10 rows and only as many of the first columns that fit on the screen. You can change the settings of tibbles to print more rows and columns (see here).
You can then save the projections by exporting them to .csv to be opened in Excel (you may have to change the path to a location where R has write privileges—R doesn’t have write privileges in the base c:/ directory):
write.csv(my_projections, file="c:/projections.csv", row.names=FALSE)
To save the projections to your current working directory, use:
write.csv(my_projections, file=file.path(getwd(), "projections.csv"), row.names=FALSE)
Package Manual
There is documentation included within the package that can be explored directly in R/RStudio, but we have also made that documentation available as a pkgdown
site here.
Troubleshooting
If you run into errors or issues, feel free to let us know in the comments or to open a GitHub issue on our GitHub repo. Please note the version of R, RStudio, and the ffanalytics package that you’re using, along with the specific error you received and the code that caused the error. If you are able to find and fix an issue, please share the fix with the community (for more info how to share your scripts with the community, see here).
Downloading Our R Scripts
In addition to the ffanalytics
R Package, we also have R scripts that accompany posts on the site. To download and run our R scripts, see here. If you’d rather calculate projections using our webapps without the R package, see here. We encourage people to use and improve our scripts, and to share them with the community so everyone benefits. For info on how to share your scripts with the community, see here.
Once I run the getprojections part, it downloads data from the various websites but spits out the following:
Adding ADP data
Error in bmerge(i, x, leftcols, rightcols, io, xo, roll, rollends, nomatch, :
typeof x.cbsId (double) != typeof i.cbsId (character)
In addition: There were 50 or more warnings (use warnings() to see the first 50)
> View(playerData)
> warnings()
Warning messages:
1: In ..FUN1(star) : NAs introduced by coercion
2: In ..FUN1(add) : NAs introduced by coercion
3: In ..FUN1(owner) : NAs introduced by coercion
Etc. Etc.
Am I doing something wrong or what?
No you are not doing anything wrong. I have fixed the issue in the package, so you will need to reinstall it and try again. Thanks for the feedback
Works great now! One question – how can I export the projections to excel? I figured out write.csv(playerData), but it doesn’t like write.csv(myScrapeData) or write.csv(myProjections) maybe because they’re “Values” and not “Data”? Thanks so much for this great tool!
You can access the raw scraped stats by position via the
myProjections
object. For QB usemyProjections$scrape$QB@resultData
. If you want average stats for QB usemyProjections$avgStats$QB
and for the actual projections for all positions usemyProjections$projections
. ThemyScrapData
object only holds raw projections and you can access the QB stats viamyScrapeData$QB@resultData
. So to write projections to csv you can usewrite.csv(myProjections$projections)
. Hope that helpsFantastic, thanks so much! R is way beyond me, I really appreciate the help.
Hey Issac, thank you so much for all of the resources that you have provided for football analytics through your site. In your recent email you provided information about a package to customize projections based on individual league settings. I and familiar with programming (not R) but am unable to follow the directions you have included at https://fantasyfootballanalytics.net/2016/06/ffanalytics-r-package-fantasy-football-data-analysis.html. The following is the actions I performed and I was hoping you could help me with a bit of troubleshooting. Again, I am sorry that I am COMPLETELY unfamiliar with R userface.
I currently have R and R Studio downloaded on my computer.
In R I executed
install.packages(“devtools”)
devtools::install_github(repo = “isaactpetersen/FantasyFootballAnalyticsR”, subdir = “R Package/ffanalytics”)
library(“ffanalytics”)
in that order, any only those commands. When executing the second command I received the follow error messages and the third command was unable to be performed.
* installing *source* package ‘ffanalytics’ …
** R
** data
*** moving datasets to lazyload DB
** inst
** preparing package for lazy loading
Warning: package ‘shiny’ was built under R version 3.2.4
Warning: package ‘miniUI’ was built under R version 3.2.3
Error : .onLoad failed in loadNamespace() for ‘tcltk’, details:
call: fun(libname, pkgname)
error: X11 library is missing: install XQuartz from xquartz.macosforge.org
ERROR: lazy loading failed for package ‘ffanalytics’
* removing ‘/Library/Frameworks/R.framework/Versions/3.2/Resources/library/ffanalytics’
Error: Command failed (1).
I know that my lack of expertise is completely the cause of my misunderstanding but I was hoping you would be able to help me out. If you could guide me through this error and the following steps to employ your program I would be incredibly grateful. Thank you so much for your time and patience in advance.
Hey Cody, are you using a Mac? Here’s the error message you’re receiving:
error: X11 library is missing: install XQuartz from xquartz.macosforge.org
I think this will be resolved by going to http://xquartz.macosforge.org and installing XQuartz. Let us know if that works (or doesn’t)!
Thank you very much, I was able to get the packages installed (I assume theffanalytics_0.1.3.tar.gz is the correct one). I was hoping you could walk me through your directions for executing the code itself. I was able to get the program to work when I did Get_Projections() and then entered the relevant information in RStudio. But when I tried using Run_Projections(), I entered my desired information in the web browser, clicked done, and then RStudio shot out this script,
Warning: Error in : ‘insertText’ is not an exported object from ‘namespace:rstudioapi’
Stack trace (innermost first):
67: getExportedValue
66: ::
65: observeEventHandler
3: shiny::runApp
2: runGadget
1: Run_Projection
and then nothing happened after that. It appears that the Run_Projections command is never completed.
Make sure you have version 0.5 of the rstudioapi package as well as R Studio version 0.99.796 or later
Thanks, everything now works great!!
You can update the rstudioapi package via:
install.packages(“rstudioapi”)
I am also getting an error message even after downloading XQuartz:
Error in .local(.Object, …) :
argument “siteId” is missing, with no default
Error : unable to load R code in package ‘ffanalytics’
Any suggestions? Thanks!
What line of code are you running when you get that error? Did you install the ffanalytics package?
It’s the line:
devtools::install_github(repo = “isaactpetersen/FantasyFootballAnalyticsR”, subdir = “R Package/ffanalytics”)
What happens when you run these lines?:
install.packages(“devtools”)
install.packages(“rstudioapi”)
Both install.packages(“devtools”) and
install.packages(“rstudioapi”) work just fine, it’s just the “devtools:” line I mentioned where problems occur.
You might try installing by tarball instead (see article) or by shortening the filenames (see below):
https://fantasyfootballanalytics.net/2016/06/ffanalytics-r-package-fantasy-football-data-analysis.html#comment-17459
It works! I did have to download and use the latest version of both R and RStudio.
Hey Isaac, I love this site and the apps that you have published. I am trying to view projections for Cincinnati WR Damion Willis, but I don’t see his name in any of the tables. He is reported to be starting for the Bengals tomorrow. Is there a fix in for this?
Hi
I tried the above steps but am failing to get the package installed correctly by both methods
When I use the devtools install, I run into some sort of permission issues
> devtools::install_github(repo = “isaactpetersen/FantasyFootballAnalyticsR”, subdir = “R Package/ffanalytics”)
Downloading GitHub repo isaactpetersen/FantasyFootballAnalyticsR@master
from URL https://api.github.com/repos/isaactpetersen/FantasyFootballAnalyticsR/zipball/master
Error in utils::unzip(src, exdir = target) :
When I install from the source file which is downloaded on my desktop, the package gets installed, but I get a corrupt database problem
Error in fetch(key) :
lazy-load database ‘C:/Users/kmorpari.ORADEV.000/Documents/R/win-library/3.3/ffanalytics/help/ffanalytics.rdb’ is corrupt
Any help?
We’re looking into resolutions. In the meantime, you had a good suggestion to shorten the filenames manually:
https://fantasyfootballanalytics.net/2016/06/ffanalytics-r-package-fantasy-football-data-analysis.html#comment-17459
Another possibility would be to install by tarball (see “Installation” section of the above article).
Hej Dennis, super fedt! Jeg fik ikke brugt pakken sidste aar, men satser paa at pakken hjaelper mig i aar!
Hej Christian, glad for at du kan bruge det. Lad mig vide hvis du har spørgsmål om pakken eller render ind i problemer.
I am not very computer literate but I am very interested in fantasy football analytics. I’ve read and re-read the how-to on this site for downloading and running R-scripts. I’ve followed the steps for this R Package exactly as they have been listed, and yet I can’t get anything to work. Most of the time I have problems understanding something, I go to YouTube. Are there any competent, dedicated fans out there who might like to make helpful YouTube videos specifically for all things Fantasy Football Analytics?
Hey Frank,
I like the idea of creating Youtube videos, and we can add that to our to-do list. Feel free to let us know what problems you’re having with the R scripts. If you’d rather use our webapps instead of R scripts (especially because you said you you’re not very computer literate), I’d recommend downloading projections from our Projections tool:
http://apps.fantasyfootballanalytics.net/
Hope that helps!
-Isaac
Hello Isaac,
Thank you very much for sharing your knowledge! Much appreciated! I followed your instructions and it worked just fine.
I have two questions for you:
1. How can I add a set of projections that cannot be scraped (Excel spreadsheet)?
2. If I wanted to use the VORP calculation as a Value-Over-Next-Available (VONA) calculation, could I just simply enter the estimated baselines for the various positions for just the picks in between my current pick and my next pick?
Hi Jered,
1) The R package doesn’t currently allow separate sources of projections (because we don’t know what format they’re in), but you can add your own projections manually via Excel or R. The R package has code that shows how to aggregate projections. This might be a good reason to learn R if you haven’t already! Or, feel free to use our webapps instead if you’re not interested in learning R 🙂
2) Not sure I understand the question. VONA would require a prediction model for which players would be drafted before and for which players would, therefore, be available for your next pick. You would compare projected points (not VORP) of the currently available players to the top player at the same position you expect to be available next round. For more info, see here:
http://draftwizard.fantasypros.com/faq/nfl.jsp
Hope that helps!
-Isaac
Hello! I’m currently working on a prediction model which will get coupled with a risk-based optimization framework later on. Your website is a goldmine and has provided me with more inspiration for FF predictions than any other website out there. I noticed in your comment on this R package that you mentioned “Note that historical data scrapes are nearly impossible to do as sites usually don’t store their historical projections.”
If I want historical expert predictions, where would I look? I have scoured the internet but haven’t been able to have much luck. Would really like to build more expert predictions into my predictions as, though you’ve shown it’s hard to remove too much random variation, there is certainly some information to fuse into our model! Cheers mate!
Hi Matt,
If you want to download historical projections, use our Projections tool:
http://apps.fantasyfootballanalytics.net/
Cheers!
-Isaac
Make sure you run these commands to install everything.
install.packages(“devtools”)
install.packages(“rstudioapi”)
devtools::install_github(repo = “isaactpetersen/FantasyFootballAnalyticsR”, subdir = “R Package/ffanalytics”)
Overall this is a great step from the last year or two I think. I created my own R script system for week to week last year.
I find this kind of buggy, but I think most of this is a data issue than code. I was able to scrape the data then manually execute the code to get projections, I am not able to do this with the protections addin.
What happens when you try to use the “Calculate Projections” addin?
I know alot of sites dont have data atm so I am just using ESPN, Standard scoring + PPR.
ESPN ran alone works fine. about the only one actually that does of the free ones.
Numberfire and EDS are returning null datasets. Numberfire has data so there is a scraping issue I think.
This is when I run NFL ,CBS and yahoo separately or together, aswell as anything including them i get these.
Separate
Error in unlist(dataCol) : object ‘dataCol’ not found
About 50 NAs introduced by coercion warnings
together or all
Error in if (dval > d.threshold) { :
missing value where TRUE/FALSE needed
In addition: There were 50 or more warnings (use warnings() to see the first 50)
Foxsports gives this error
Removing columns after column 12
Got more columns in data than number of columns specified by names from
http://www.foxsports.com/fantasy/football/commissioner/Research/Projections.aspx?page=17&position=1&split=3&playerSearchStatus=1
Removing columns after column 12
For numberFire you will need to actually manually save their projections in a csv file. For some reason it is not possible to scrape directly. The siteUrls table have the details on where to save. EDS Football doesn’t have data yet, so you are right they will return empty. For troubleshooting purposes, could you provide the details on the code you are executing for NFL, CBS and Yahoo.
FoxSports is not really an error. It is just a warning that there is a mismatch in the number of columns the code is expecting and the number it is getting. We can look at the table definitions in the code and get that updated so the columns will match.
I got some code that will pull number fire data I can share. I will verify it still works.
They all was using offense only. Standard settings. 12 and 16 teams. Adp was espn or non (same result).
Average or robust. Same result.
Every thing else was default.
Odd that their weekly table pulled successfully but the remaining didn’t. They use the same id but the season comes back null.
This will at least pull the data for ya. You’ll have clean it up.
##Numberfire Data Scrape
install.packages(“XML”)
library(“XML”)
###Weekly
url_numfireWeekly <- paste("http://www.numberfire.com/nfl/fantasy/fantasy-football-projections/qb"😉
numfire_html <- htmlParse(url_numfireWeekly)
numfire_html <- readHTMLTable(numfire_html)
numfire_qbproj <- do.call(rbind.data.frame, numfire_html)
###Season
url_numfireSeason <- paste("http://www.numberfire.com/nfl/fantasy/remaining-projections/qb"😉
numfire_html <- htmlParse(url_numfireSeason)
numfire_html <- readHTMLTable(numfire_html)
numfire_qbprojSeason <- do.call(rbind.data.frame, numfire_html)
Thanks, we are scraping weekly numberFire projections. Let us know if you can figure out how to scrape their seasonal projections. Thanks!
I get this error when running 3rd step:
cannot open file ‘C:/Users/jalley/AppData/Local/Temp/12/RtmpEnlr5U/devtools623865fd1e22/isaactpetersen-FantasyFootballAnalyticsR-6c6c4a9/R Markdown/SubcriptionAccuracy/subscriptionAccuracy_cache/markdown_phpextra+backtick_code_blocks/unnamed-chunk-1_af5e2a896358b9ccbc8241e876b9ce5c.RData’: No such file or directory
Any idea?
https://fantasyfootballanalytics.net/2016/06/ffanalytics-r-package-fantasy-football-data-analysis.html#comment-17459
My last comment didn’t post. I think you all should consider reaching out to or working with MrFantasyFreak.com it’s a small sports website. You all have a lot of the same ideas.
I’m getting this error: Downloading GitHub repo isaactpetersen/FantasyFootballAnalyticsR@master
from URL https://api.github.com/repos/isaactpetersen/FantasyFootballAnalyticsR/zipball/master
Error in utils::unzip(src, exdir = target) :
cannot open file ‘C:/Users/mikefili/AppData/Local/Temp/RtmpMZfFU0/devtools63c36d21285/isaactpetersen-FantasyFootballAnalyticsR-6c6c4a9/R Markdown/SubcriptionAccuracy/subscriptionAccuracy_cache/markdown_phpextra+backtick_code_blocks/unnamed-chunk-1_af5e2a896358b9ccbc8241e876b9ce5c.RData’: No such file or directory
I ran into this one as well. That problem occurs because the path is too long. Only way around it would be to shorten file names manually, then install it.
At the risk of sound stupid, I’m having trouble grasping what to do. Which file names specifically do you shorten for this to work?
Hey Matt,
We’ve reached out to the developer of the devtools package to let him know about the error so he can come up with a fix (https://github.com/hadley/devtools/issues/1235). Dennis might be able to help you shorten the filenames (I’m not sure how to do that). In the meantime, I’d suggest trying to install by tarball instead of devtools (see Installation section in the above article for more info):
install.packages(path_to_file, repos=NULL, type="source")
Hope that helps!
-Isaac
Hey there,
Thanks for making this–it’s a godsend and I plan on trying to crunch a lot of numbers myself. Anyway I was wondering if you’ve ever tried looking into “statistical arbitrage”-type strategies. My idea is that maybe somehow the analysts systematically over- or under-rank certain types of players, and if you adjust for whatever these biases are, you can beat them. I think what you would basically want to do to test for this is you’d have to get the old projections (which seems doable with this plugin), then add whatever variables you want to code in if they aren’t already available (maybe start simple with things like indicators for whether a player is a rookie, will be an RB in a timeshare, etc.) and see if the ‘error’ terms in the pros’ projections can be predicted by your new variables. Let me know what you think!
Good suggestions, thanks! It is possible, because we have found systematic over-estimation of players projections:
https://fantasyfootballanalytics.net/2016/03/best-fantasy-football-projections-2016-update.html
Getting this error when trying to install ffanalytics R package.
* installing *source* package ‘ffanalytics’ …
** R
** data
*** moving datasets to lazyload DB
** inst
** preparing package for lazy loading
Error in loadNamespace(i, c(lib.loc, .libPaths()), versionCheck = vI[[i]]) :
there is no package called ‘htmltools’
Error : package ‘shiny’ could not be loaded
ERROR: lazy loading failed for package ‘ffanalytics’
* removing ‘C:/Users/Name/Documents/R/win-library/3.3/ffanalytics’
Error: Command failed (1)
Any thoughts on what’s going wrong?
Hey Nick,
The error is saying that you don’t have the package ‘
htmltools
‘ installed. It should be installed withshiny
. Go ahead and try to install theshiny
package:install.packages("shiny")
Hope that helps!
-Isaac
Ah that makes perfect sense, should have thought of that and used some Google-Fu. Thank you for the quick reply and for all the information you provide on this site.
Anyone else having trouble downloading XQuartz from xquartz.macosforge.org? After clicking the link to download I’m taken to a page showing only the word “Forbidden!”
Hmm, you might try a different browser or network. Here’s the link:
https://www.xquartz.org/
https://dl.bintray.com/xquartz/downloads/XQuartz-2.7.9.dmg
Hope that helps!
-Isaac
Thank you for the quick response Isaac! Using that second link to download it worked perfectly. Just installed the package successfully and can’t wait to use it.
Hello. I am new to R and I am trying to get your package installed but I keep getting error messages. It is different than any of the ones I have seen posted above. It is:
* installing *source* package ‘ffanalytics’ …
** R
** data
*** moving datasets to lazyload DB
** inst
** preparing package for lazy loading
Error in loadNamespace(i, c(lib.loc, .libPaths()), versionCheck = vI[[i]]) :
there is no package called ‘ggplot2’
ERROR: lazy loading failed for package ‘ffanalytics’
* removing ‘C:/Users/JennS/Documents/R/win-library/3.3/ffanalytics’
Error: Command failed (1)
any help would be appreciated. This seems amazing. Thanks for putting this out there for all of us.
Hi Jonathon,
The error you’re getting says that you’re missing the
ggplot2
package. What happens when you install it first?install.packages("ggplot2")
Hope that helps!
-Isaac
For those of us that might have subs to premium sites, is it possible to scrape from those sites. Maybe some way to pass credentials?
Hi Nick,
You can pass credentials for FootballGuys. If you download the projections from Rotowire and 4for4 manually (in a .csv file) then the package should be able to read those too. The
siteUrls
object indicates the location that the script expects the files to be in. You can update thesiteUrls
table with a different location, if desired. Check?siteUrls
for documentation on the table.Hope that helps!
-Isaac
I’m currently getting the following error when running getProjections(…)
Error in structure(.External(.C_dotTclObjv, objv), class = “tclObj”) :
[tcl] invalid command name “toplevel”.
Has anyone seen this issue before?
FWIW, I’m on a Mac running El Capitan.
Hi Keenan,
Try this, and let us know if it doesn’t resolve your issue:
https://github.com/isaactpetersen/FantasyFootballAnalyticsR/issues/24
Hope that helps!
-Isaac
Hmmmm, not quite. I got 2 warnings when trying to install tcltk:
Warning in install.packages :
package ‘tcltk’ is not available (for R version 3.3.1)
Warning in install.packages :
package ‘tcltk’ is a base package, and should not be updated
I’m new to R, so forgive my ignorance. I’m sort of going at this like “Hello World”.
What is returned when you run this?
capabilities("tcltk")
If
false
, you need to compile R withtcltk
support, see this thread:http://r.789695.n4.nabble.com/Where-is-the-tcltk-package-td3434915.html
Nope, it’s TRUE. If it helps, I receive the following warning when I load the ffanalytics library:
> library(“ffanalytics”)
Loading required package: shiny
Loading required package: miniUI
Warning message:
In fun(libname, pkgname) : couldn’t connect to display “:0”
Followup:
From the looks of things, “playerData” is being grabbed properly, but nothing after that.
Hmm, not sure. You might follow the suggestion here:
https://stackoverflow.com/questions/21888336/tclk-error-when-i-run-validate-from-the-rms-package
See the Mac OS X Trouble-shooting section:
http://socserv.socsci.mcmaster.ca/jfox/Misc/Rcmdr/installation-notes.html
Hope that helps!
-Isaac
After installing the package, I’m unable to run either add-in.
> ffanalytics:::Run_Projection()
Error in ffanalytics:::Run_Projection() : object ‘analysts’ not found
> ffanalytics:::Run_Scrape()
Error in ffanalytics:::Run_Scrape() : object ‘analysts’ not found
> ffanalytics::runScrape(week = 0, season = 2016, analysts = c(-1, 5, 7, 18, 27), positions = c(“QB”, “RB”, “WR”, “TE”, “K”, “DST”))
Error in analystOptions(scrapePeriod) : object ‘analysts’ not found
You should load the package with
library(ffanalytics)
before running the add-in. That should resolve the errorWhen this was first posted everything worked just fine getting projections from all of the free sites plus all of the Footballguys projections. Now it errors out with even just the free sites. I started from scratch multiple times without success. Can anyone run it successfully as of this moment?
Hi Jered,
Sorry to hear that. What errors are you getting for the different sites? You might try grabbing the latest version of the package.
Thanks,
Isaac
I just got everything downloaded today, had to install from the tarball manually, v 1.4. When I try to use the run scrape function, it returns only 13 columns and gives a bunch of errors. Am I doing something wrong, or is there something else going on?
Listening on http://127.0.0.1:4061
> myScrapeData <- runScrape(week = 1, season = 2015, analysts = c(3), positions = c("WR"), fbgUser = NULL, fbgPwd = NULL)
Retrieving player data
=================
Scrape Summary:
WR :
Successfully: Yahoo Sports
Failed: NA
There were 50 or more warnings (use warnings() to see the first 50)
Hey Nate,
We don’t recommend trying to scrape historical data (change the season to 2016). If you want historical data, you can download them from our Projections tool:
http://apps.fantasyfootballanalytics.net/
Cheers!
-Isaac
Would love to use this.. But not smart enough to get it to worl
What issues are you having? You can always use our Projections Tool if you’d rather not use the package!
http://apps.fantasyfootballanalytics.net/
-Isaac
Do you have a feature that allows you to input all of the teams in your league to find the optimal swaps, adds, and drops from the free agency based on the players in your team and your opponent’s teams?
Not yet, but we can add that to our list for future ideas, thanks!
This is awesome work, and I’m looking forward to using it for my draft.
When I run the addins, I’m getting an error:
Error in structure(.External(.C_dotTclObjv, objv), class = “tclObj”) :
[tcl] invalid command name “toplevel”.
Any idea why?
Hi Kevin,
Try this, and let us know if it doesn’t resolve your issue:
https://github.com/isaactpetersen/FantasyFootballAnalyticsR/issues/24
Hope that helps!
-Isaac
Isaac,
It’s working now! I tried reinstalling tcltk and R with no success, but a simple restart of my computer did the trick. Thanks for your help!
When I try to run
> devtools::install_github(repo = “isaactpetersen/FantasyFootballAnalyticsR”, subdir = “R Package/ffanalytics”)
I get
Error in curl::curl_fetch_disk(url, x$path, handle = handle) :
Timeout was reached
Might be a firewall issue, but you should still be able to install the tarball instead of using the
install_github()
command (see article above for info how to install the tarball).Love what you are doing! One suggestion, it would be awesome to download past data in bulk, like downloading all Yahoo predictions for 2015 by week, with one click, rather than having to download 17 different files, one for each week, unless I am missing something. Thanks!!!!
Thanks, Nate. We can add this to our to-do list.
Thanks so much for posting this. I am having trouble installing the package (after installing devtools and rstudioapi). I get the following error, is anyone else having the same issue? I have tried downloading the zip, and trying to install only the .tar file :
Error in utils::unzip(src, exdir = target) :
cannot open file ‘C:/Users/KSMITH/AppData/Local/Temp/RtmpuOcwws/devtools26fc13632ece/isaactpetersen-FantasyFootballAnalyticsR-ec8c764/RMarkdown/SubcriptionAccuracy/subscriptionAccuracy_cache/markdown_phpextra+backtick_code_blocks/unnamed-chunk-1_af5e2a896358b9ccbc8241e876b9ce5c.RData’:
No such file or directory
Hi Kevin,
Sorry for the hassle. You might try running R as an administrator and installing to a directory where you have write permissions. If that doesn’t work, I’d suggest installing by tarball (see above article for more info).
Hope that helps,
Isaac
Isaac, Here is an error message I get when I run projections. It has occurred both when I just choose free sites and when I also add my subscription to FBG: Error in structure(.External(.C_dotTclObjv, objv), class = “tclObj”) :
[tcl] invalid command name “toplevel”.
I am limited in technical knowledge. Brian
Hi Brian,
Sorry for the hassle! You might try the suggestions in these threads:
https://fantasyfootballanalytics.net/2016/06/ffanalytics-r-package-fantasy-football-data-analysis.html#comment-17528
https://fantasyfootballanalytics.net/2016/06/ffanalytics-r-package-fantasy-football-data-analysis.html#comment-17572
Hope that helps!
-Isaac
Thanks Isaac! Your second thread did the trick! This is phenomenal stuff!!!!! Thanks
Hey, thank you for updating all these resources. I am struggling at the second code. Devtools ,he first code installs correctly, but install.packages(“rstudioapi”) does not read, instead Rstudio says Error: unexpected input in “install.packages“”. Appreciate any help
Try this (from Googling the error):
https://stackoverflow.com/questions/21597193/not-able-to-install-packages-in-r-with-install-packages
Thanks for the quick response, it works
Hey, I have been having trouble setting this program up. I am not super computer literate, and this is my first experience with R. Anyways, after some time spent googling possible solutions, I am coming to this forum for help. I will leave my whole code, and I believe my problem is with the third step. Anyways any help or thoughts would be greatly appreciated!
> install.packages(“devtools”)
Installing package into ‘C:/Users/User/Documents/R/win-library/3.3’
(as ‘lib’ is unspecified)
— Please select a CRAN mirror for use in this session —
trying URL ‘https://cloud.r-project.org/bin/windows/contrib/3.3/devtools_1.12.0.zip’
Content type ‘application/zip’ length 431047 bytes (420 KB)
downloaded 420 KB
package ‘devtools’ successfully unpacked and MD5 sums checked
The downloaded binary packages are in
C:\Users\User\AppData\Local\Temp\Rtmpq6VvDl\downloaded_packages
> install.packages(“rstudioapi”)
Installing package into ‘C:/Users/User/Documents/R/win-library/3.3’
(as ‘lib’ is unspecified)
trying URL ‘https://cloud.r-project.org/bin/windows/contrib/3.3/rstudioapi_0.6.zip’
Content type ‘application/zip’ length 50912 bytes (49 KB)
downloaded 49 KB
package ‘rstudioapi’ successfully unpacked and MD5 sums checked
The downloaded binary packages are in
C:\Users\User\AppData\Local\Temp\Rtmpq6VvDl\downloaded_packages
> devtools::install_github(repo = “isaactpetersen/FantasyFootballAnalyticsR”, subdir = “R Package/ffanalytics”)
Downloading GitHub repo isaactpetersen/FantasyFootballAnalyticsR@master
from URL https://api.github.com/repos/isaactpetersen/FantasyFootballAnalyticsR/zipball/master
Installing ffanalytics
“C:/PROGRA~1/R/R-33~1.1/bin/i386/R” –no-site-file –no-environ –no-save \
–no-restore –quiet CMD INSTALL \
“C:/Users/User/AppData/Local/Temp/Rtmpq6VvDl/devtools39605cf8892/isaactpetersen-FantasyFootballAnalyticsR-dd257c8/R \
Package/ffanalytics” –library=”C:/Users/User/Documents/R/win-library/3.3″ \
–install-tests
* installing *source* package ‘ffanalytics’ …
** R
** data
*** moving datasets to lazyload DB
** inst
** preparing package for lazy loading
Error in loadNamespace(i, c(lib.loc, .libPaths()), versionCheck = vI[[i]]) :
there is no package called ‘Formula’
ERROR: lazy loading failed for package ‘ffanalytics’
* removing ‘C:/Users/User/Documents/R/win-library/3.3/ffanalytics’
Error: Command failed (1)
Hi Jeff,
Here’s the error you’re receiving:
Error in loadNamespace(i, c(lib.loc, .libPaths()), versionCheck = vI[[i]]) :
there is no package called 'Formula'
You might try installing the
Formula
package first via:install.packages("Formula")
Hope that helps!
-Isaac
Thanks for the reply, I entered that command and the formula package installed,however I now have this problem when I tried the 3rd step command
> devtools::install_github(repo = “isaactpetersen/FantasyFootballAnalyticsR”, subdir = “R Package/ffanalytics”)
Downloading GitHub repo isaactpetersen/FantasyFootballAnalyticsR@master
from URL https://api.github.com/repos/isaactpetersen/FantasyFootballAnalyticsR/zipball/master
Installing ffanalytics
“C:/PROGRA~1/R/R-33~1.1/bin/i386/R” –no-site-file –no-environ –no-save –no-restore –quiet CMD INSTALL \
“C:/Users/User/AppData/Local/Temp/Rtmpq6VvDl/devtools39601559102a/isaactpetersen-FantasyFootballAnalyticsR-dd257c8/R Package/ffanalytics” \
–library=”C:/Users/User/Documents/R/win-library/3.3″ –install-tests
* installing *source* package ‘ffanalytics’ …
** R
** data
*** moving datasets to lazyload DB
** inst
** preparing package for lazy loading
Error in loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]]) :
there is no package called 'acepack'
ERROR: lazy loading failed for package 'ffanalytics'
* removing 'C:/Users/User/Documents/R/win-library/3.3/ffanalytics'
Error: Command failed (1)
Nvm, i troubleshot this one myself. Thanks for your help!
Last question. All of my packages are installed now, and I have advanced to the final step, and once again(unfortunately) I am stumped. Any thoughts on last time?
> library(“ffanalytics”)
Loading required package: shiny
Loading required package: miniUI
> install.packages(“shiny”)
Installing package into ‘C:/Users/User/Documents/R/win-library/3.3’
(as ‘lib’ is unspecified)
Warning: package ‘shiny’ is in use and will not be installed
> install.packages(“miniUI”)
Installing package into ‘C:/Users/User/Documents/R/win-library/3.3’
(as ‘lib’ is unspecified)
Warning: package ‘miniUI’ is in use and will not be installed
If you are going to install shiny and miniUI, do it before you load the ffanalytics package:
install.packages("shiny")
install.packages("miniUI")
library("ffanalytics")
Isaac,
I’m a total noob at R. Can you tell me how to render the Add-ins correctly? The drop down windows are overlapping onto the options of All, Free and None. Also, when I run scrape against ESPN I receive an error that the tables are empty.
Thanks!
Mike.
Here’s the specific error on ESPN: Empty data table retrieved from
http://games.espn.go.com/ffl/tools/projections?&slotCategoryId=0&startIndex=160
Here’s the full response when I select Free and Non-IDP:
Listening on http://127.0.0.1:7595
> myScrapeData <- runScrape(week = 0, season = 2016, analysts = c(-1, 3, 4, 5, 6, 7, 9, 17, 18, 19, 20, 28), positions = c("QB", "RB", "WR", "TE", "K", "DST"), fbgUser = NULL, fbgPwd = NULL)
Retrieving player data
Empty data table retrieved from
http://games.espn.go.com/ffl/tools/projections?&slotCategoryId=0&startIndex=120
Empty data table retrieved from
http://games.espn.go.com/ffl/tools/projections?&slotCategoryId=0&startIndex=160
Empty data table retrieved from
http://games.espn.go.com/ffl/tools/projections?&slotCategoryId=2&startIndex=240
Empty data table retrieved from
http://games.espn.go.com/ffl/tools/projections?&slotCategoryId=2&startIndex=280
Empty data table retrieved from
http://games.espn.go.com/ffl/tools/projections?&slotCategoryId=2&startIndex=320
Empty data table retrieved from
http://games.espn.go.com/ffl/tools/projections?&slotCategoryId=2&startIndex=360
Empty data table retrieved from
http://games.espn.go.com/ffl/tools/projections?&slotCategoryId=2&startIndex=400
Empty data table retrieved from
http://games.espn.go.com/ffl/tools/projections?&slotCategoryId=4&startIndex=320
Empty data table retrieved from
http://games.espn.go.com/ffl/tools/projections?&slotCategoryId=4&startIndex=360
Empty data table retrieved from
http://games.espn.go.com/ffl/tools/projections?&slotCategoryId=4&startIndex=400
Empty data table retrieved from
http://games.espn.go.com/ffl/tools/projections?&slotCategoryId=4&startIndex=440
Empty data table retrieved from
http://games.espn.go.com/ffl/tools/projections?&slotCategoryId=4&startIndex=480
Empty data table retrieved from
http://games.espn.go.com/ffl/tools/projections?&slotCategoryId=4&startIndex=520
Empty data table retrieved from
http://games.espn.go.com/ffl/tools/projections?&slotCategoryId=6&startIndex=200
Empty data table retrieved from
http://games.espn.go.com/ffl/tools/projections?&slotCategoryId=6&startIndex=240
Empty data table retrieved from
http://games.espn.go.com/ffl/tools/projections?&slotCategoryId=6&startIndex=280
Got more columns in data than number of columns specified by names from
http://fantasy.nfl.com/research/projections?position=8&sort=projectedPts&statCatery=projectedStats&statSeason=2016&statType=seasonProjectedStats&offset=1
Removing columns after column 11
Got more columns in data than number of columns specified by names from
http://fantasy.nfl.com/research/projections?position=8&sort=projectedPts&statCatery=projectedStats&statSeason=2016&statType=seasonProjectedStats&offset=26
Removing columns after column 11
Got more columns in data than number of columns specified by names from
http://www.foxsports.com/fantasy/football/commissioner/Research/Projections.aspx?page=1&position=32768&split=3&playerSearchStatus=1
Removing columns after column 15
Got more columns in data than number of columns specified by names from
http://www.foxsports.com/fantasy/football/commissioner/Research/Projections.aspx?page=2&position=32768&split=3&playerSearchStatus=1
Removing columns after column 15
Empty data table retrieved from
https://www.fantasypros.com/nfl/projections/qb.php?week=draft
Got fewer columns in data than number of columns specified by names from:
http://www.eatdrinkandsleepfootball.com/fantasy/projections/2016/qb/
NOTE: Returning empty datasetGot fewer columns in data than number of columns specified by names from:
http://www.eatdrinkandsleepfootball.com/fantasy/projections/2016/rb/
NOTE: Returning empty datasetGot fewer columns in data than number of columns specified by names from:
http://www.eatdrinkandsleepfootball.com/fantasy/projections/2016/wr/
NOTE: Returning empty datasetGot fewer columns in data than number of columns specified by names from:
http://www.eatdrinkandsleepfootball.com/fantasy/projections/2016/te/
NOTE: Returning empty datasetGot fewer columns in data than number of columns specified by names from:
http://www.fantasyfootballnerd.com/service/draft-projections/xml/test/QB
NOTE: Returning empty dataset=================
Scrape Summary:
QB :
Successfully: CBS Average, Yahoo Sports, ESPN, NFL, FOX Sports, FFToday, FantasySharks, WalterFootball, FantasyData
Failed: FantasyPros, EDS Football, FantasyFootballNerd
RB :
Successfully: CBS Average, Yahoo Sports, ESPN, NFL, FOX Sports, FFToday, FantasyPros, FantasySharks, FantasyFootballNerd, WalterFootball, FantasyData
Failed: EDS Football
WR :
Successfully: CBS Average, Yahoo Sports, ESPN, NFL, FOX Sports, FFToday, FantasyPros, FantasySharks, FantasyFootballNerd, WalterFootball, FantasyData
Failed: EDS Football
TE :
Successfully: CBS Average, Yahoo Sports, ESPN, NFL, FOX Sports, FFToday, FantasyPros, FantasySharks, FantasyFootballNerd, WalterFootball, FantasyData
Failed: EDS Football
K :
Successfully: CBS Average, Yahoo Sports, NFL, FOX Sports, FFToday, FantasyPros, FantasySharks, FantasyFootballNerd, WalterFootball, FantasyData
Failed: NA
DST :
Successfully: CBS Average, Yahoo Sports, NFL, FOX Sports, FFToday, FantasySharks, FantasyFootballNerd, FantasyData
Failed: NA
The ESPN warnings are just that there are some empty pages at the end of the scrape. Sometimes FantasyPros QB scrape fails. Haven’t been able to figure out why. When you rerun the it succeeds. EDS doesn’t have scrape able data. And FFN should only be used if you have an API key.
Hope that helps!
-Isaac
Isaac, thanks! Any idea how I can make the scrape and projections add-ins render correctly? I’m assuming there’s a setting in R that I’m just not seeing.
Works for me on a PC. Could you give me more info on your setup, so we can try to reproduce?
Isaac, I’m running a resolution of 1920 x 1080. Wish I could show you a screenshot. Thanks!
I downloaded the package on Mac today. I’ve downloaded XQuartz, the latest version of R (3.3.1) that I could find. Any ideas on what to do? Seems to be an issue with the positions.
Warning: Error in <-: 'names' attribute [4] must be the same length as the vector [0]
Stack trace (innermost first):
66: getVORbaseline
65: observeEventHandler
3: shiny::runApp
2: runGadget
1: ffanalytics::Run_Projection
What was the code that was run to generate the error?
OK, for everyone else having similar errors. The “Positions” section of the Calculate Projections addin is completely non-functional. If any positions are selected in Calculate Projections this error will pop up. But it’s OK, there’s a workaround.
Run Calculate Projections, set up everything except positions (leave them all blank) then hit go. The first thing it will do is ask you what positions to scrape, you can fill in your wanted positions there and it will proceed with the scrape.
We’re not having this issue. Could you give us enough info to reproduce? What do you get when you run
sessionInfo()
?I keep getting this error on installation — on both my PC and Mac:
Warning in install.packages :
installation of package ‘C:/Users/JDD/Desktop/ffanalytics_0.1.6.tar.gz’ had non-zero exit status
What am I doing wrong? I tried installing using the GitHub link and downloading it directly. This looks like a great package.
Note: All of my R packages and Rstudio is up-to-date.
We’re not able to replicate. Could you send more info? What other lines of code you ran, output, etc.?
Here is a screenshot:
http://imgur.com/a/98VSv
I literally just installed devtools and the api. I tried installing the 0.1.3 version, the 0.1.5 version and the 0.1.6 version. Same error on my PC and Mac. I must be missing something. All of my packages and Rstudio is updated.
I was finally able to get it to work. I had to manually install the packages that the ffanalyitics package relies on, then install the ffanalyitics package from my desktop [I didn’t use the github link] and it worked! I am thinking there is an error in the ffanalyitics setup as it looks and installs the packages it depends on because I had this issue on 2 Windows Laptops and 1 Mac.. same error on both. Working now on all three.
Every time I try to install the package devtools::install_github(repo = “isaactpetersen/FantasyFootballAnalyticsR”, subdir = “R Package/ffanalytics”) I receive an error “there is no package called ‘xyz'” (not actually xyz but an actual package name). I then install the missing package and try again and a new package is missing. Is there a package missing other than devtools and rstudioapi?
We’re not sure without knowing what packages it’s telling you to install. Which ones?
It seems to be an endless amount of packages. It lists them one at a time when i try to install the fantasyfootball package. Here are a few that I’ve installed on my own after being notified it is not installed: acepack, chron, Formula, ggplot2, gridextra, jsonlite, latticeExtra,…There doesn’t seem to be an end in sight lol.
Finished installing all of the required packages. FYI, the last one was “magrittr”
It’s weird. I have now tried a third Windows based laptop — same results.
We’re working on a fix. In the meantime, you might try installing the dependencies manually. For a list, see the Installation section of the above article.
Hope that helps!
-Isaac
Hi Eric or Isaac,
I’m having the same issues. What are all the required packages? I didn’t realize “magrittr” was one of them as it is not listed above in the installation section, how did you determine this?
Thanks,
Joel
Hey Joel,
magrittr isn’t a required package. It’s a dependency of a required package. If you install the required packages (see Installation section) and their dependencies, you should be set.
Hope that helps!
-Isaac
Isaac,
I was able to install. Like others, dependencies didn’t load. Had to troubleshoot 1 by 1. Here’s a nice piece of code to identify dependencies for others:
pack <- available.packages()
pack["RSelenium","Imports"]
If you install the packages manually, it should install their dependencies (from Installation section):
install.packages("shiny")
install.packages("miniUI")
install.packages("data.table")
install.packages("stringr")
install.packages("DT")
install.packages("XML")
install.packages("httr")
install.packages("tcltk")
install.packages("RCurl")
install.packages("Hmisc")
install.packages("readxl")
install.packages("RSelenium")
Hello,
Whenever i run:
runScrape()
2015
week 15
QB position
Or really any year and position I get this error:
Error in structure(.External(.C_dotTclObjv, objv), class = “tclObj”) :
[tcl] invalid command name “top-level”.
Here is full list — note, I have tried using ESPN and other sites and positions. Same error:
> runScrape()
Enter season year to scrape: 2015
Enter week to scrape (use 0 for season): 1
Select Analysts to Scrape
1: CBS Average 2: Yahoo Sports 3: ESPN
4: NFL 5: FOX Sports 6: FFToday
7: NumberFire 8: FantasyPros 9: Footballguys: Dodds-Norton
10: Footballguys: Maurile Tremblay 11: Footballguys: Mike Herman 12: Footballguys: Sigmund Bloom
13: EDS Football 14: FantasySharks 15: FantasyFootballNerd
16: 4for4 17: Rotowire 18: Pro Football Focus
Enter one or more numbers separated by spaces, or an empty line to cancel
1: 1
Select positions to scrape
1: QB
2: RB
3: WR
4: TE
5: K
6: DST
7: DL
8: LB
9: DB
Enter one or more numbers separated by spaces, or an empty line to cancel
1: 1
Retrieving player data
Error in structure(.External(.C_dotTclObjv, objv), class = “tclObj”) :
[tcl] invalid command name “toplevel”.
Have you tried this?
https://fantasyfootballanalytics.net/2016/06/ffanalytics-r-package-fantasy-football-data-analysis.html#comment-17634
yes. I think I am getting closer — LOL
Here is the output after I do a ‘run_projection()’, 2016 season, RB:::
Listening on http://127.0.0.1:3888
Warning: Error in <-: 'names' attribute [1] must be the same length as the vector [0]
Stack trace (innermost first):
66: getVORbaseline
65: observeEventHandler
3: shiny::runApp
2: runGadget
1: Run_Projection
What’s the whole line of code you run?
Hi again,
Once I have an API Key for Fantasy Football Nerd, where do I put that in my R coding?
The FFN API key can be set by updating the ffnAPI object. Its default is “test”.
Hope that helps!
-Isaac
Where do I do that? I’ve got into what I think is the ffanalytics code itself and updated, but it still keeps coming up as “test”.
Before you run a scrape set the ffnAPI object like this
ffnAPI <<- "your key"
Hello, how can I add RotoViz Projections to my calculations? I have them manually saved as a CSV and imported to R Studio just not sure how to marry them with the other projections. Can I find instructions on this somewhere?
Hi Isaac and Dennis,
After installing and loading the package, I am getting the following error when I try to run the “Calculate Projections” add in. I just downloaded the package today (7/29/16), so I am pretty sure that I have the most recent version…any ideas? Any help or suggestions would be much appreciated! Thanks for all of of the great work on this site and please keep it up!
Adding ADP data
Error in `[.data.table`(draftData, , `:=`(aav, NA)) :
Cannot use := to add columns to a null data.table (no columns), currently. You can use := to add (empty) columns to a 0-row data.table (1 or more empty columns), though.
In addition: There were 50 or more warnings (use warnings() to see the first 50)
I’m also getting an “Error: subscript out of bounds” message in the Calculation Settings window when I try to run the “Calculate Projections” add in. Any idea on that one? Thanks!
What line of code did you run? Do you have the most recent version of R and Rstudio?
Hi Isaac, thanks for the reply. The error is occurring in the Calculation Settings window when I try to run the “Calculate Projections” add in.
I start the add in, then select the analysts, positions, and scoring and everything seems fine. But when I go to the Calculation Settings window, it says “Error: subscript out of bounds” in bold red text in the window.
Then, when I hit “done”, this prints in the console:
Listening on http://127.0.0.1:4319
Warning: Error in [[: subscript out of bounds
Stack trace (innermost first):
96: tag
95: tags$input
94: tag
93: tags$div
92: div
91: textInput
90: tag
89: tags$div
88: tag
87: tags$div
86: tag
85: tags$div
84: div
83: column
82: FUN
81: lapply
80: tagList
79: tag
78: tags$div
77: div
76: fluidRow
75: FUN
74: lapply
73: vorUI
72: renderUI
71: func
70: output$vorData
3: shiny::runApp
2: runGadget
1: ffanalytics:::Run_Projection
Warning: Error in <-: 'names' attribute [1] must be the same length as the vector [0]
Stack trace (innermost first):
66: getVORbaseline
65: observeEventHandler
3: shiny::runApp
2: runGadget
1: ffanalytics:::Run_Projection
ERROR: [on_request_read] connection reset by peer
Any ideas? The Run Scrape add in seems to be working great for me by the way.
Thanks again for all of the help. Truly an awesome tool.
I am also getting this error. It only appears when using the calculate projections add in and also only when positions other than QB are selected. Has a fix to this problem been made?
I just got this error, too, but I got it when I selected QB.
Did you ever hear a response on this?
Hi
You guys have a wealth of information here. Thanks for all the effort. Its great.
I’m having a couple issues I hope you could help me with. I followed all the instructions above and was able to get everything installed.
1. I only have 2 Addins showing up. “Calculate Projections” and “Run Scrape”. I do not have the “Run Projections” Addin mentioned above. However, the screen shots above seem to match the “Calculate Projections” Addin. Am I missing an Addin?
2. I can run both “Calculate Projections” and “Run Scrape” successfully. Now what…? Is there any way I can view the results of “Calculate Projections” or export to a .csv? I’m still learning this R program.
Running everything in RStudio Version 0.99.903.
Thanks, Chris
Hi Chris,
1) Those are the two addins (“Run Scrape” and “Calculate Projections”). I revised the post to match the names of the addins. Sorry for the confusion.
2) You can a) save the projections to an object, b) view the object to view the projections, and c) save the projections using
write.csv()
. I just updated the post to demonstrate how to do that.Hope that helps!
-Isaac
Thanks, that worked. I was able to write to a csv using:
write.csv(myProjections,”Projections 7-31 PPR.csv”)
Hi Isaac,
I get the following error on my windows 8.1 machine.
> devtools::install_github(repo = “isaactpetersen/FantasyFootballAnalyticsR”, subdir = “R Package/ffanalytics”)
Downloading GitHub repo isaactpetersen/FantasyFootballAnalyticsR@master
from URL https://api.github.com/repos/isaactpetersen/FantasyFootballAnalyticsR/zipball/master
Error in utils::unzip(src, exdir = target) :
cannot open file ‘C:/Users/jgpolanc/AppData/Local/Temp/RtmpgnubYM/devtools1c9438445db2/isaactpetersen-FantasyFootballAnalyticsR-dd257c8/R Markdown/SubcriptionAccuracy/subscriptionAccuracy_cache/markdown_phpextra+backtick_code_blocks/unnamed-chunk-1_af5e2a896358b9ccbc8241e876b9ce5c.RData’: No such file or directory
Not sure what the error is coming from. You might try installing the required packages (see Installation section) or, if that doesn’t work, installing from tarball.
Hope that helps,
Isaac
I got 4for4 to work, but having issues with PFF and Rotowire.
PFF – I downloaded to a .csv, named PFF_2016_0_QB.csv to folder PFF (same set up as 4f4):
> myScrapeData myScrapeData <- runScrape(week = 0, season = 2016, analysts = c(26), positions = c("QB"), fbgUser = NULL, fbgPwd = NULL)
Retrieving player data
=================
Scrape Summary:
QB :
Successfully:
Failed: Rotowire
There were 50 or more warnings (use warnings() to see the first 50)
Can you help me figure it out?
Thanks, Chris
OK, that comment didnt go up right for some reason.
PFF Code-
> myScrapeData <- runScrape(week = 0, season = 2016, analysts = c(29), positions = c("QB"), fbgUser = NULL, fbgPwd = NULL)
Retrieving player data
Empty data table retrieved from
/Users/chrisferraro/PFF/PFF_2016_0_QB.csv
=================
Scrape Summary:
QB :
Successfully:
Failed: Pro Football Focus
There were 50 or more warnings (use warnings() to see the first 50)
Rotowire doesn’t let you download by position, its all the in one csv. I located the csv in the Rotowire folder. Named Rotowire file: Rotowire_2016_0_QB.csv.
Code is above.
If you could help me figure it out I’d very much appreciate it.
Thanks, Chris
Hey Chris,
Could you send the headers that you’re using? The .csv files need to be generated by manually copying and pasting the data tables from Rotowire and PFF (instead of downloading the file)—1 per position. The downloaded files have less data than manually copying and pasting the data.
Hope that helps,
Isaac
I got Rotowire to work (had to delete the first row when I copied it in). Still struggling with PFF. I tried coping the tables from 2 different places. Heres the columns (same from both places I copied from):
Rank,Name,Team,Opp,Gms,Targ,Rec,Rc.Yd,Rc.TD,Rush,R.Yd,R.TD,Ret.Yd,Ret.TD,Fum,FL,2pc,Pts,RV,$
For the PFF file maybe, could you double check the path and get us the output from the scrape addin?
Isaac
Here’s what the Calculate Projections add in said:
NOTE: Returning empty datasetEmpty data table retrieved from
/Users/chrisferraro/PFF/PFF_2016_0_WR.csv
Here’s what the Run Scrape add in said:
Empty data table retrieved from
/Users/chrisferraro/PFF/PFF_2016_0_WR.csv
I’ve opened the CVS, its not empty. It has the columns I mentioned above. Its also at the path shown above (/Users/chrisferraro/PFF/).
I tried to copy, paste values back into the table in case there was something messed up with the format. Still no luck.
Is the filename PFF_2016_0_WR.csv? Could you share the results when you run
sessionInfo()
?How do I provide location of csv to use 4for4 projections? Also, can I do csv for Footballguys as well or does that require username and password?
Ah, think I found it.
Next question, anything I can if parts of the app overlap each other? For instance picking ADP sources is very hard as drop boxes below are overlapping.
Not sure why they’re overlapping. Feel free to send your system info for us to try to reproduce. In the meantime, your best bet might be to use the code rather than UI. FYI, using the UI generates the code, so you can borrow that syntax when generating your own code to use.
Hope that helps!
-Isaac
Hello! I am having an issue with saving the projections once they are completed. When I run getProjections with my settings, it does so successfully, albeit with many warnings, and pops up a pane with the projections. The problem is that it is not retaining the myProjections object once I close this pane. Because of this, I can’t save my projections. Is there some work around or something I am doing wrong?
Did you try saving the projections into an objects? See the “Viewing/Saving the Projections” section:
myProjections <- getProjections(scrapeData, avgMethod = "average", leagueScoring = userScoring, teams = 12, format = "standard", mflMocks = -1, mflLeagues = -1, adpSources = c("CBS", "ESPN", "FFC", "MFL", "NFL"))
Got the following error message when trying to install the ffanalytics package.
Error in utils::unzip(src, exdir = target) :
cannot open file ‘C:/Users/Jonathan/AppData/Local/Temp/RtmpYbJMi2/devtools1eccae123b4/isaactpetersen-FantasyFootballAnalyticsR-dd257c8/R Markdown/SubcriptionAccuracy/subscriptionAccuracy_cache/markdown_phpextra+backtick_code_blocks/unnamed-chunk-1_af5e2a896358b9ccbc8241e876b9ce5c.RData’: No such file or directory
Any suggestions?
thanks, Jon
Did you try to install all of the necessary packages manually? See the Installation section. If that doesn’t work, you might try installing by tarball.
Hope that helps!
-Isaac
Hi Isaac,
I’m curious if you’ve done any website scraping for historical stats? Maybe back to 2013- Present to start? I’m interested in compiling stats by position, per player, week by week.
Ultimately my goal is to count how many times someone has been targeted 10+ times, or, count how many times there’s a 300 yard passer among others for example. While I can find a lot of these stats week by week, I haven’t found anything to get all of the weekly metrics I’m looking for as a whole… so, toying with R to see if I can extract all of the data myself and build my own models.
Have you done anything like this before or could offer me any advice to point me in the right direction?
Thanks,
Jamey
Yes, we have seasonal historical projections that go back to 2008 and weekly historical projections that go back to last year. You can download them using our Projections tool:
http://apps.fantasyfootballanalytics.net/
Hope that helps!
-Isaac
Awesome! Thanks Isaac. Do you have just the raw stats data? 2015 – Week 1 – Tom Brady – 32 Completions – 43 etc. Not so much the projection just the stats themselves.
Yes, you can download the underlying stats. For more info, see here:
https://fantasyfootballanalytics.net/2016/06/download-projections.html
Amazing. Thanks for your help!
Okay, I feel silly asking this, but it’s alluding me. Where would I copy the 4for4 csv? I see in the siteurl table the path it shows is /4for4/allprojections.csv, but where on my PC is that? How would I change the location? Can’t find how to edit the table.
The path has been updated, so please update the package to get the most recent siturl table. The file should be saved in a 4for4 folder in your “Home” directory. On windows that would be in the /Users//Documents folder. Once you install the new version of the package, look at the value of the projDir object for details. You can edit the data table via edit(siteurls)
Hi, First thank you for developing this code. This is my first year doing fantasy football after learning R so I am excited to combine the two. Just wanted to let you know that my Calculate Projections addin is overlapping like Nick’s is, I have the most recent R, R-Studio, and Package edditions.
Also I cannot figure out how to save the table I get from the addin as an object to be called later. Do I have to run the addin everytime i want to see this table or am I missing something here?
See the “Viewing/Saving the Projections” section above.
Hope that helps!
-Isaac
For projections from paid sites, like 4for4 or PFF, where is the folder supposed to go? For windows should it be, Documents\R\win-library\3.3\ffanalytics\4for4?
Or, how do I change the path in the table? Would probably prefer that.
The projDir variable shows the base directory and the siteurls table has the path within the directory. In order to modify the path to the table change the projDir variable and edit the path in the siteurls table with edit(siteurls)
Thank you sir, I think I understand, will give it a try.
Here’s my code trying to scrape 4for4 csv, each position successfully failed.
myScrapeData <- runScrape(week = 0, season = 2016, analysts = c(25), positions = c("QB", "RB", "WR", "TE", "K", "DST"), fbgUser = NULL, fbgPwd = NULL)
Here's an example of one of the 15 warnings, all very similar.
2: In `[<-.data.table`(x, j = name, value = value) :
Coerced 'character' RHS to 'logical' to match the column's type. Either change the target column to 'character' first (by creating a new 'character' vector length 0 (nrows of entire table) and assign that; i.e. 'replace' column), or coerce RHS to 'logical' (e.g. 1L, NA_[real|integer]_, as.*, etc) to make your intent clear and for speed. Or, set the column type correctly up front when you create the table and stick to it, please.
Seems it's having issue with how the csv is setup, but I downloaded it directly from their PPR projections. Does anything special need done to it first?
As far as I know there is no DST projections in the CSV file from 4for4. Could you try and rerun without DST? Also the filename for the CSV should be be 4for4_2016_0.csv
Took it out.
myScrapeData <- runScrape(week = 0, season = 2016, analysts = c(25), positions = c("QB", "RB", "WR", "TE", "K"), fbgUser = NULL, fbgPwd = NULL)
Same warnings it seems, failed for each position.
What file name did you save the csv as. Should be 4for4_2016_0.csv.
Thought I had, but saw a mistake in the filename. Figured that was it but still failing. Complete message below. I’m triple checking the path, but it looks correct.
Retrieving player data
File C:/Users/username/Documents/4for4/4for4_2016_0.csv cannot be found. Returning empty data
File C:/Users/username/Documents/4for4/4for4_2016_0.csv cannot be found. Returning empty data
File C:/Users/username/Documents/4for4/4for4_2016_0.csv cannot be found. Returning empty data
File C:/Users/username/Documents/4for4/4for4_2016_0.csv cannot be found. Returning empty data
=================
Scrape Summary:
QB :
Successfully:
Failed: 4for4
RB :
Successfully:
Failed: 4for4
WR :
Successfully:
Failed: 4for4
TE :
Successfully:
Failed: 4for4
Replacing Missing Data
Error in eval(expr, envir, enclos) : object ‘playerId’ not found
In addition: There were 12 warnings (use warnings() to see them)
Figured the filename out, had two underscores side by side. Now I recall my problems with Computer Science, a propensity for typos. Thank you for the help.
Hi FFA Team,
Everything is working great, except I am having trouble scraping data or getting projections for DST. Every time I try to scrape data or get the projections, I get the following error message.
Error in paste(firstName, lastName) : object ‘firstName’ not found
Any help or suggestions would be much appreciated!
Hey Randy,
What’s the line of code you run that generates that error?
-Isaac
Any solution to this? I get the same thing if I pull data for any analyst for defense.
> myScrapeData <- runScrape(week = 4, season = 2016, analysts = c(-1), positions = c("DST"), fbgUser = NULL, fbgPwd = NULL)
Retrieving player data
Error in paste(firstName, lastName) : object 'firstName' not found
Are you using the latest version of R, Rstudio, and the package? Did you install all of the package’s dependencies (see above article)? What do you get when you run sessionInfo()?
Below is the R session information. I can retrieve data for all other positions successfully. It’s only “DST” that gives me the error. I’m using R 3.3.1, ffanalytics_0.1.8, RStudio 0.99.902
R version 3.3.1 (2016-06-21)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows >= 8 x64 (build 9200)
locale:
[1] LC_COLLATE=English_United States.1252 LC_CTYPE=English_United States.1252
[3] LC_MONETARY=English_United States.1252 LC_NUMERIC=C
[5] LC_TIME=English_United States.1252
attached base packages:
[1] tcltk stats graphics grDevices utils datasets methods base
other attached packages:
[1] dplyr_0.5.0 data.table_1.9.6 lpSolve_5.6.13 sqldf_0.4-10 RSQLite_1.0.0 DBI_0.4-1
[7] gsubfn_0.6-6 proto_0.3-10 ffanalytics_0.1.8 miniUI_0.1.1 shiny_0.14
loaded via a namespace (and not attached):
[1] splines_3.3.1 lattice_0.20-33 colorspace_1.2-6 htmltools_0.3.5 chron_2.3-47
[6] survival_2.39-4 XML_3.98-1.4 foreign_0.8-66 RColorBrewer_1.1-2 readxl_0.1.1
[11] plyr_1.8.4 stringr_1.1.0 munsell_0.4.3 gtable_0.2.0 caTools_1.17.1
[16] latticeExtra_0.6-28 httpuv_1.3.3 curl_1.1 Rcpp_0.12.5 acepack_1.3-3.3
[21] xtable_1.8-2 scales_0.4.0 Hmisc_3.17-4 RSelenium_1.4.0 jsonlite_1.0
[26] mime_0.5 gridExtra_2.2.1 ggplot2_2.1.0 digest_0.6.9 stringi_1.1.1
[31] RJSONIO_1.3-0 grid_3.3.1 tools_3.3.1 bitops_1.0-6 magrittr_1.5
[36] RCurl_1.95-4.8 tibble_1.1 Formula_1.2-1 cluster_2.0.4 Matrix_1.2-6
[41] assertthat_0.1 httr_1.2.1 R6_2.1.2 rpart_4.1-10 nnet_7.3-12
Could you try upgrading to the latest version of the package (0.1.9)?
I tried installing ffanalytics (0.1.9) and still had the same problem. I ran some debugs and found the error was coming when the nflPlayerData function gets called during execution of runScrape.
nflPlayerData was building the following nfl.url as
http://api.fantasy.nfl.com/v1/players/researchinfo?season=2016&week=4&offset=0&count=1000&format=json&position=DST
This url returns
{“errors”:[{“id”:”position”,”message”:”You have entered an invalid position.”}]}
Changing the url to use the position “DEF” instead of “DST” returns data.
http://api.fantasy.nfl.com/v1/players/researchinfo?season=2016&week=4&offset=0&count=1000&format=json&position=DEF
I was able to create a local copy of the nflPlayerData function adding the following line just before the url is built.
if(pos == “DST”) pos <- "DEF"
and then use assignInNamespace to override the function in the installed package.
Hi Isaac
Great website! I am having a problem that I can’t seem to figure out. When I select Calculate Projections or Run Scrape from the add inns dropdown no interface appears. It looks like R just runs the package and I get an error
> ffanalytics:::Run_Projection()
Error in ffanalytics:::Run_Projection() : object ‘analysts’ not found
Am I doing something wrong? How can I get the tabs to appear so I can enter the correct settings for Calculate Projections.
Thanks
-Eric
https://fantasyfootballanalytics.net/2016/06/ffanalytics-r-package-fantasy-football-data-analysis.html#comment-17533
Hope that helps!
-Isaac
Hello, I keep getting this error when I try to save the file as a csv
> write.csv(myProjections, file = “c:/projections.csv”, row.names = FALSE)
Error in as.data.frame.default(x[[i]], optional = TRUE) :
cannot coerce class “structure(“dataResult”, package = “ffanalytics”)” to a data.frame
Can you let me know what I am doing wrong?
Thank you
Try this:
write.csv(myProjections$projectedPoints, file="c:/projections.csv", row.names=FALSE)
> myScrapeData write.csv(myScrapeData$TE, file=”c:/users/kevin/desktop/projections.csv”, row.names=FALSE)
Error in as.data.frame.default(x[[i]], optional = TRUE) :
cannot coerce class “structure(“dataResult”, package = “ffanalytics”)” to a data.frame
I just want scraped data and not score projections. Any idea what’s going wrong here?
To get to the data in the
dataResult
class you’ll need to reference the slot in the class object. In the casemyScrapeData$TE@resultData
Thank you for the response, tried that and got this
> write.csv(myProjections$projectedPoints, file=”c:/projections.csv”, row.names=FALSE)
Error in file(file, ifelse(append, “a”, “w”)) :
cannot open the connection
In addition: Warning message:
In file(file, ifelse(append, “a”, “w”)) :
cannot open file ‘c:/projections.csv’: Permission denied
Any ideas?
Can you try a different path for the file? I believe that R doesn’t have permissions to write to the root folder. You can try this:
file = file.path(Sys.getenv("HOME"), "projections.csv")
which should put the csv file in your “Documents” folder. You checkSys.getenv("HOME")
for the actual locationThat worked! thank you
Is there anyway to optimize this for a Dynasty League?
I am not aware of sources that provide projections for Dynasty leagues. If you look at the playerData object it should have a column that identifies rookies so if you are looking for rookie projections you can use that.
Hey I finally got everything working for me. I just have ONE problem.
After the projections are completely ran, I close the pop up window and try to save the object “myProjections” but it says the object is not found.
What am I missing?
Make sure you use the “Done” button to close the window. If you don’t then the code thinks you cancelled the calculations and won’t save the object.
Thank you! Of course after troubleshooting all these little things for a few hours it would be something that small. Appreciate the reply.
Are there any good resources for determining a VOR baseline?
See here (including external links in the Calculating Value section):
https://fantasyfootballanalytics.net/2013/04/win-your-snake-draft-calculating-value.html
Outside resources, I should say. I’ve read everything on the site.
Finally got the 4for4 csv to work, but I’m having issues writing to CSV. Below is what I used.
write.csv(myProjections$projectedPoints, file=”c:/Users/Profile/Documents/projections.csv”, row.names=FALSE)
It creates the csv but it’s blank. After I run Get Projections however and the windows pops up with my data, so it should be there, and if I type myProjections it spits it all out. What am I doing wrong?
Got it, changed it to:
write.csv(myProjections$projections, file=”c:/Users/Profile/Documents/projections.csv”, row.names=FALSE)
This worked. I don’t fully understand why though.
Something is messed up. The QB projections are way way up. It’s no longer asking for the ‘per yard’ prompt, just the points.
Okay I figured that one out, but now I’m having problems writing to csv as well. I am on a Macbook Pro, updated. It doesn’t tell me anything when I type the code…I just can’t find the file on my computer.
I’m not following. Are you using an app or the R package? Could you give us enough detail to help us reproduce?
Thanks Isaac this works beautifully. I have 2 questions
1. Is there a way to remove drafted players?
2. When drafting are is it best to look at VOR or Points?
1) Yes, either click the player’s name or type their name into the “Exclude Players” box
2) For draft strategy, see here.
Is this in the projections using rstudio? when i click a player on the projections screen nothing happens. Also Im not getting any fantasypros data will their data be added?
I was talking about removing players when using the webapps. You need to use R code if you want to remove players after downloading projections using the R package. You can also export the projections to .csv, open them Excel, and remove players manually.
Hey Isaac! I love this tool and can’t wait to use it in my drafts. I have a couple of questions.
1) When drafting do you suggest using VOR or Projections to determine which player to select?
2) Is there a way to remove a drafted player from the list? I remember seeing this in a previous post but now sure if the functionality still exists.
https://fantasyfootballanalytics.net/2016/06/ffanalytics-r-package-fantasy-football-data-analysis.html#comment-17922
I’m using up to date version of R and R Studio on a MacOS. After projections are finished, I have trouble saving as a csv. I am using the following code, as recommended by Dennis:
file = file.path(Sys.getenv(“HOME”), “projections.csv”)
It works once out of about every 20 or so times that I run projections. I have no idea what makes the difference. Just one time it randomly worked and the next time it didn’t. I’m trying to compare average and weighted across a couple different methods for picking a baseline.
Thanks.
Try this:
write.csv(myProjections$projectedPoints, file=file.path(getwd(), “projections.csv”), row.names=FALSE)
Can you give me some direction for determining d value? I understand what it is, i just want some direction for playing around with it.
Cohen’s d is a measure of the magnitude (effect size) of differences. We determine tiers based on Cohen’s d. Increase Cohen’s d to make fewer tiers and decrease Cohen’s d to make more tiers.
For more info on Cohen’s d, see:
https://en.wikiversity.org/wiki/Cohen%27s_d
https://en.wikipedia.org/wiki/Effect_size#Cohen.27s_d
So what you’re saying is that the default d-value is the best to use?
I’d like to combine my VBD with tiering to kind of find a middle ground for my draft strategy. I understand WHAT Cohen’s d is, I just don’t understand how to use it. But I guess if the simplest answer is to raise it for fewer tears and lower for more tiers…then I’ll work with it?
The default d values were designed to mirror the tiers of other sites. But you can modify the d values if you want more or fewer tiers. If a player has a larger standardized mean difference (d value) than the threshold you set (compared to the mean projections points of another player), then they will be set to a different tier. I’m not sure what other info you’re looking for in terms of how to use them. As a statistical aside, tiers actually aren’t that useful:
https://fantasyfootballanalytics.net/2015/08/2015-auction-draft-optimizer.html#comment-1665
Isn’t including FantasyPro’s redundant? Or if I used them, shouldn’t we leave out ones like Yahoo, ESPN, etc?
Yes, including FantasyPros would be redundant with the other sources we have. That’s why we don’t double count FantasyPros projections by default in our webapps.
Sorry for multiple replies, but I’m having issue with scraping some of the free sites. Below is what I’m getting for FantasyPros each time.
Retrieving player data
Empty data table retrieved from
https://www.fantasypros.com/nfl/projections/qb.php?week=draft
Empty data table retrieved from
https://www.fantasypros.com/nfl/projections/rb.php?week=draft
Empty data table retrieved from
https://www.fantasypros.com/nfl/projections/wr.php?week=draft
Empty data table retrieved from
https://www.fantasypros.com/nfl/projections/te.php?week=draft
No encoding supplied: defaulting to UTF-8.
No encoding supplied: defaulting to UTF-8.
No encoding supplied: defaulting to UTF-8.
No encoding supplied: defaulting to UTF-8.
No encoding supplied: defaulting to UTF-8.
No encoding supplied: defaulting to UTF-8.
No encoding supplied: defaulting to UTF-8.
No encoding supplied: defaulting to UTF-8.
No encoding supplied: defaulting to UTF-8.
No encoding supplied: defaulting to UTF-8.
No encoding supplied: defaulting to UTF-8.
No encoding supplied: defaulting to UTF-8.
No encoding supplied: defaulting to UTF-8.
No encoding supplied: defaulting to UTF-8.
No encoding supplied: defaulting to UTF-8.
No encoding supplied: defaulting to UTF-8.
I also can’t scrape anything from ESPN, same message as above for FantasyPros
When using R, are the “weighted” projections using the same weight as are being used on the app? Why isn’t there an option to adjust the weight using R? I would just use the app, but it won’t let me input my league scoring settings. Thanks.
You can modify the weights by modifying the “weight” column in the
analysts
object.I noticed that for QBs the “Points” value is higher than the “Upper” value. Should that be reversed?
Are you using a web app or the R package? Which players and which settings are you using?
R package.
myProjections <- getProjections(scrapeData=runScrape(week = 0, season = 2016, analysts = c(-1, 3, 4, 5, 6, 7, 11, 12, 13, 14, 15, 22, 23, 17, 18, 19, 20, 25, 28), positions = c("QB", "RB", "WR", "TE", "K", "DST"), avgMethod = "average", leagueScoring = userScoring, vorBaseline, vorType, teams = 12, format = "ppr", mflMocks = -1, mflLeagues = -1, adpSources = c("CBS", "ESPN", "FFC", "MFL", "NFL", "Yahoo"))
We think this has to do with unstable FOX scraping. We updated the R package in an attempt to deal with this. Let us know if you still are having the issue after updating the R package.
Thanks,
Isaac
Haven’t had a chance to update to the newest R package yet, but any thoughts on the empty data table message, mainly with FantasyPros?
Should be fixed with the latest package update!
Unfortunately I still got empty tables for FantasyPros.
ESPN as well, and I didn’t mention, but I did update to latest package.
I was able to replicate on my mac when I didn’t select the ADP source. Make sure you’re selecting an ADP source. What’s the line of code that you’re using?
Couldn’t reply to your post below. I selected all ADP sources, but I picked each manually as I still have distortion with the Calculate Projections app and can’t click the check box to select all.
myProjections <- getProjections(scrapeData=runScrape(week = 0, season = 2016, analysts = c(3, 5, 6, 9, 11, 12, 13, 14, 15, 22, 23, 17, 18, 19, 20, 25), positions = c("QB", "RB", "WR", "TE"), fbgUser = "user", fbgPwd = "password"), avgMethod = "average", leagueScoring = userScoring, vorBaseline, vorType, teams = 12, format = "ppr", mflMocks = -1, mflLeagues = -1, adpSources = c("CBS", "ESPN", "FFC", "MFL", "NFL", "Yahoo"))
As a test I tried another PC and got the same problem with FantasyPros, empty tables for QB, RB, WR, and TE, newest package.
That code includes more analysts than just FantasyPros. I tried running it and it worked for me. Do you get the blank data table when you select only FP or when you select all of those analysts together (including FP)? Does “blank data table” mean that it shows warnings or that no data is returned when running the scrape?
The
Empty data table retrieved from:
messages are not considered errors (ie scrape doesn’t fail). It indicates that there wasn’t data returned from the url provided in the scrape. Could point to multiple things: Data table actually being empty, URL not being correctly specified or site has changed its layout and the data is not where we think it is. We think we reach pages on ESPN that are actually empty with the way the configuration is set up, because they used to have projections for more players. We would rather have it read a couple of extra empty pages with no players, than potentially miss pages with player informationWhat is the output from the code you run? Also, what do you get when you run
sessionInfo()
? Finally, when you runsiteUrls[siteId == 8 & urlPeriod == "season"]
, what is the value ofurlTable
?That code was form multiple sources, but when I tried from another PC I just used FantasyPros. I will try again a little later and test what you suggested.
Just out of curiosity, can I switch to a CSV for FantasyPros? If so, how do I change this within the R package?
See the “Including Other Sources of Projections” section above.
So progress. I was able to scrape FantasyPros when I selected just Yahoo as an ADP source and not all of them. I didn’t try any other ones individually. I’m probably okay with that as this is a Yahoo draft. The only that came back with an error is EDS, below is what I got for QB, but this happened for all positions.
Got fewer columns in data than number of columns specified by names from:
http://www.eatdrinkandsleepfootball.com/fantasy/projections/2016/qb/
NOTE: Returning empty datasetGot fewer columns in data than number of columns specified by names from:
Yes, EDS football projections are not currently scrapeable.
Easy enough. Not sure why picking all sources for ADP causes the problem, but I’ll test variations and see if it’s one particular that causes the problem.
Cant run any of the add-ins. Help! Getting this error message for both the Calculate Projections and Run Scrap add-ins.
ffanalytics:::Run_Projection()
Error in setkeyv(…, physical = FALSE) :
4 arguments passed to .Internal(nchar) which requires 3
Did you load the package? Use:
library("ffanalytics")
Hey Nick, if you upgrade the version of R that you are using that problem should go away. R made some updates to the nchar function with release 3.2.1 that changed the number of arguments required. So make sure you are using a version of R that is 3.2.1 or greater.
Anybody else seeing this error message?
Retrieving player data
Opening and ending tag mismatch: meta line 5 and head
Pops up whenever I try to run a scrape or projection. Everything was working great and then this started to happen all of a sudden. Below is an example. Any ideas for a fix?
> myProjections <- getProjections(scrapeData=runScrape(week = 0, season = 2016, analysts = c(4), positions = c("QB")), avgMethod = "average", leagueScoring = userScoring, vorBaseline, vorType, teams = 12, format = "standard", mflMocks = -1, mflLeagues = -1, adpSources = c("ESPN"))
Retrieving player data
Opening and ending tag mismatch: meta line 5 and head
Opening and ending tag mismatch: br line 59 and h1
Opening and ending tag mismatch: br line 59 and div
Opening and ending tag mismatch: br line 59 and div
Opening and ending tag mismatch: br line 59 and body
Opening and ending tag mismatch: h1 line 59 and html
Premature end of data in tag div line 58
Premature end of data in tag div line 51
Premature end of data in tag body line 50
Premature end of data in tag head line 3
Premature end of data in tag html line 2
Error: 1: Opening and ending tag mismatch: meta line 5 and head
2: Opening and ending tag mismatch: br line 59 and h1
3: Opening and ending tag mismatch: br line 59 and div
4: Opening and ending tag mismatch: br line 59 and div
5: Opening and ending tag mismatch: br line 59 and body
6: Opening and ending tag mismatch: h1 line 59 and html
7: Premature end of data in tag div line 58
8: Premature end of data in tag div line 51
9: Premature end of data in tag body line 50
10: Premature end of data in tag head line 3
11: Premature end of data in tag html line 2
This is working for us. Could you make sure you’re using the latest version of the
ffanalytics
package, R, and Rstudio (along with all of the necessary packages)?Are you using the latest version of the package, R, and Rstudio? Did you install all of the necessary packages (from the Installation section)? What do you get when you run
sessionInfo()
? If you can’t get the package to work, you can download projections using our webapps:https://fantasyfootballanalytics.net/2016/06/download-projections.html
Hi Isaac,
I believe I am using all of the correct versions and packages. It was working great before, but then started showing me that “Retrieving player data
Opening and ending tag mismatch: meta line 5 and head” error message. Below is what I am getting when I run the sessionInfo(). I have used the app before but I really like the customization that R can give me, so any help on figuring out how to get this working again would be much appreciated!
> sessionInfo()
R version 3.3.1 (2016-06-21)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 7 x64 (build 7601) Service Pack 1
locale:
[1] LC_COLLATE=English_United States.1252
[2] LC_CTYPE=English_United States.1252
[3] LC_MONETARY=English_United States.1252
[4] LC_NUMERIC=C
[5] LC_TIME=English_United States.1252
attached base packages:
[1] stats graphics grDevices utils datasets
[6] methods base
other attached packages:
[1] ffanalytics_0.1.6 miniUI_0.1.1 shiny_0.13.2
loaded via a namespace (and not attached):
[1] Rcpp_0.12.6 RColorBrewer_1.1-2
[3] plyr_1.8.4 bitops_1.0-6
[5] tools_3.3.1 rpart_4.1-10
[7] digest_0.6.9 jsonlite_1.0
[9] gtable_0.2.0 lattice_0.20-33
[11] Matrix_1.2-6 rstudioapi_0.6
[13] gridExtra_2.2.1 stringr_1.0.0
[15] httr_1.2.1 cluster_2.0.4
[17] caTools_1.17.1 grid_3.3.1
[19] nnet_7.3-12 data.table_1.9.6
[21] R6_2.1.2 tcltk_3.3.1
[23] XML_3.98-1.4 survival_2.39-4
[25] readxl_0.1.1 RSelenium_1.4.0
[27] foreign_0.8-66 RJSONIO_1.3-0
[29] latticeExtra_0.6-28 Formula_1.2-1
[31] magrittr_1.5 ggplot2_2.1.0
[33] Hmisc_3.17-4 scales_0.4.0
[35] htmltools_0.3.5 splines_3.3.1
[37] mime_0.5 xtable_1.8-2
[39] colorspace_1.2-6 httpuv_1.3.3
[41] stringi_1.1.1 acepack_1.3-3.3
[43] RCurl_1.95-4.8 munsell_0.4.3
[45] chron_2.3-47
Could you try updating the
ffanalytics
package? There is a newer version than the one you’re using.I updated to ffanalytics_0.1.7 and still no luck. I tried uninstalling r and r-studio, restarting my computuer, but still getting the same “Retrieving player data Opening and ending tag mismatch: meta line 5 and head” error message.
I tired manually installing all of the dependent packages and tcltk is giving me some trouble. When I try to install, i get this error:
Warning in install.packages :
package ‘tcltk’ is not available (for R version 3.3.1)
Warning in install.packages :
package ‘tcltk’ is a base package, and should not be updated
I noticed that someone else had this issue, so I ran capabilities(“tcltk”) and got “True.” Any ideas? Could this be leading to the error?
Thanks!
It’s still not letting me download my projections. It just runs them and I click done and then it says the object is not found. I’ve run it at least 15 times. Reinstalled, all latest updates. On a macbook pro. Please help. Thanks.
What line of code are you using? What version of Rstudio? What are the results when you run
sessionInfo()
? Did you install all necessary packages (see Installation section)? If you can’t get the package to work, you can always download projections using our webapps:https://fantasyfootballanalytics.net/2016/06/download-projections.html
I was able to replicate on my mac when I didn’t select the ADP source. Make sure you’re selecting an ADP source. What’s the line of code that you’re using?
I always select all the ADP sources. The code isn’t even the problem. I can click “Done” from the projections window and then immediately type “myProjections” and it says the object isn’t found.
Not sure what’s going on. We’d need more info to reproduce. Could you share the line of code you’re using and what you get when you run
sessionInfo()
?I’m on Windows 8.1. I’ve tried R and R Studio. I’ve run all the commands. ffanalytics never opens.
I wish I could be more specific. The things I see in the R console or in R Studio are:
Loading required package: shiny
Loading required package: miniUI
And nothing ever happens.
It sounds like you’ve just loaded the package. Now you have to run the addins (see Addins section) or run code.
Getting different results depending on whether I use the web app vs. RStudio. Same settings and everything. The RStudio version is putting guys like Tyrod Taylor and Alex Smith ahead of Aaron Rodgers.
Hi Hortense,
We’d need to know what settings you’re using in order to reproduce. What’s the line of code you’re using? What changes did you make to the scoring settings?
Thanks,
Isaac
Thanks for your help!
You can find the code I’m using here: http://pastebin.com/9azehXVm
You might try removing FOX projections. Scraping FOX projections is tough because the columns often change from page to page, which sometimes messes up the calculated projections.
That seemed to do the trick – thank you!
Something weird about writing to CSV, that I’m not even sure if it’s an issue. If I use the example above, and specifically the part myProjections$projectedPoints I just get a blank CSV called projections. If I change it to this:
write.csv(myProjections$projections, file=”C:/Users/Nick/Documents/Projections/projections.csv”, row.names=FALSE)
It comes out fine. what exactly does the $ part do?
See the “Basics of R” section:
https://fantasyfootballanalytics.net/2016/06/ffanalytics-r-package-fantasy-football-data-analysis.html#learnR
Finally got everything working in R Studio and encountered this error when trying to execute the “Run Scrape” from the addins dropdown list.
Listening on http://127.0.0.1:7156
> myScrapeData warnings()
Warning messages:
1: In asMethod(object) : NAs introduced by coercion
2: In asMethod(object) : NAs introduced by coercion
3: In asMethod(object) : NAs introduced by coercion
4: In asMethod(object) : NAs introduced by coercion
5: In asMethod(object) : NAs introduced by coercion
6: In ..FUN1(opponen) : NAs introduced by coercion
7: In ..FUN1(opponen) : NAs introduced by coercion
8: In ..FUN1(opponen) : NAs introduced by coercion
9: In ..FUN1(opponen) : NAs introduced by coercion
10: In ..FUN1(opponen) : NAs introduced by coercion
11: In ..FUN1(opponen) : NAs introduced by coercion
12: In ..FUN1(opponen) : NAs introduced by coercion
13: In ..FUN1(opponen) : NAs introduced by coercion
14: In ..FUN1(opponen) : NAs introduced by coercion
15: In ..FUN1(opponen) : NAs introduced by coercion
16: In ..FUN1(opponen) : NAs introduced by coercion
17: In ..FUN1(opponen) : NAs introduced by coercion
18: In ..FUN1(opponen) : NAs introduced by coercion
The warnings aren’t an error, and aren’t necessarily a problem. Did it generate scraped projections? If not, what code did you run?
When using the getProjections function I keep getting:
projections <- getProjections(scrapeData=runScrape(week = 0, season = 2016, analysts = c(-1, 3, 4, 5, 6, 11, 12, 13, 14, 15, 22, 23, 19), positions = NULL, fbgUser = "dah2017", fbgPwd = "ender238"), avgMethod = "average", leagueScoring = userScoring, vorBaseline, vorType, teams = 12, format = "standard", mflMocks = -1, mflLeagues = -1, adpSources = c("CBS", "ESPN", "FFC", "MFL", "NFL"))
Scrape Summary:
QB :
Successfully: CBS Average, Yahoo Sports, ESPN, NFL, FOX Sports, David Dodds, Maurile Tremblay, Bob Henry, Jason Wood
Failed: FantasyFootballNerd
Calculating Points
Error in unlist(dataCol) : object 'dataCol' not found
In addition: There were 50 or more warnings (use warnings() to see the first 50)
It seems as though it fully scrapes the sites, but when I try to run it to actually get projections it breaks when it trys to unlist dataCol as it calculates points
What do you get when you run
sessionInfo()
?I am getting the same error msg with the dataCol not begin found. I’ve tried with several Analysts and positions, but trying to keep it simple, I ran it with just the CBS Average and the TE position. Here is the sessionInfo():
Scrape Summary:
TE :
Successfully: CBS Average
Failed: NA
Calculating Points
Error in unlist(dataCol) : object ‘dataCol’ not found
> sessionInfo()
R version 3.2.3 (2015-12-10)
Platform: x86_64-apple-darwin13.4.0 (64-bit)
Running under: OS X 10.10.5 (Yosemite)
locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] ffanalytics_0.1.8 miniUI_0.1.1 shiny_0.14
loaded via a namespace (and not attached):
[1] Rcpp_0.12.6 RColorBrewer_1.1-2 plyr_1.8.4 bitops_1.0-6 tools_3.2.3 rpart_4.1-10
[7] digest_0.6.10 jsonlite_1.1 gtable_0.2.0 lattice_0.20-33 rstudioapi_0.6 curl_1.2
[13] gridExtra_2.2.1 httr_1.2.1 stringr_1.1.0 cluster_2.0.3 caTools_1.17.1 grid_3.2.3
[19] nnet_7.3-11 data.table_1.9.6 R6_2.1.2 tcltk_3.2.3 XML_3.98-1.4 survival_2.38-3
[25] readxl_0.1.1 RSelenium_1.4.0 foreign_0.8-66 RJSONIO_1.3-0 latticeExtra_0.6-28 Formula_1.2-1
[31] magrittr_1.5 ggplot2_2.1.0 Hmisc_3.17-4 scales_0.3.0 htmltools_0.3.5 splines_3.2.3
[37] mime_0.5 xtable_1.8-2 colorspace_1.2-6 httpuv_1.3.3 stringi_1.1.1 acepack_1.3-3.3
[43] RCurl_1.95-4.8 munsell_0.4.2 chron_2.3-47
Looks like this was a year ago, but was it ever resolved?
Does anyone else have an issue when behind a corporate firewall? Below is what I get when retrieving ECR ranks.
Error in function (type, msg, asError = TRUE) :
SSL certificate problem: self signed certificate in certificate chain
In addition: There were 50 or more warnings (use warnings() to see the first 50)
So I’m guessing somewhere there’s a self signed certificate but is there a way to tell Rstudio to accept?
Or, where is that self signed cert error coming from?
Not sure, haven’t seen that before. You may have to approve Yahoo authentication, but not sure if that’s why you’re getting the error.
I have this exact same problem…
Any ideas why I am seeing the following issue trying to install the ffanalytics package? Has the file been moved???
> devtools::install_github(repo = “isaactpetersen/FantasyFootballAnalyticsR”, subdir = “R Package/ffanalytics”)
Downloading GitHub repo isaactpetersen/FantasyFootballAnalyticsR@master
from URL https://api.github.com/repos/isaactpetersen/FantasyFootballAnalyticsR/zipball/master
Installing ffanalytics
“C:/PROGRA~1/R/R-33~1.1/bin/i386/R” –no-site-file \
–no-environ –no-save –no-restore –quiet CMD INSTALL \
“C:/Users/Brad/AppData/Local/Temp/Rtmpa08xRr/devtools12e021b66572/isaactpetersen-FantasyFootballAnalyticsR-d4bfa8f/R \
Package/ffanalytics” \
–library=”\\Mac/Home/Documents/R/win-library/3.3″ \
–install-tests
* installing *source* package ‘ffanalytics’ …
** R
** data
*** moving datasets to lazyload DB
** inst
** preparing package for lazy loading
** help
*** installing help indices
** building package indices
** testing if installed package can be loaded
Warning in library(pkg_name, lib.loc = lib, character.only = TRUE, logical.return = TRUE) :
there is no package called ‘ffanalytics’
Error: loading failed
Execution halted
ERROR: loading failed
* removing ‘\\Mac/Home/Documents/R/win-library/3.3/ffanalytics’
Error: Command failed (1)
Thanks in advance!
The file hasn’t moved, not sure why you’re getting the error. You may have to install the tarball (see Installation section above).
Thanks Isaac for the reply…I tried the taball install method as well and returned this…
install.packages(“//Mac/Home/Documents/ffanalytics_0.1.7.tar.gz”, repos=NULL, type=”source”)
Installing package into ‘\\Mac/Home/Documents/R/win-library/3.3’
(as ‘lib’ is unspecified)
* installing *source* package ‘ffanalytics’ …
** R
** data
*** moving datasets to lazyload DB
** inst
** preparing package for lazy loading
** help
*** installing help indices
** building package indices
** testing if installed package can be loaded
Warning in library(pkg_name, lib.loc = lib, character.only = TRUE, logical.return = TRUE) :
there is no package called ‘ffanalytics’
Error: loading failed
Execution halted
ERROR: loading failed
* removing ‘\\Mac/Home/Documents/R/win-library/3.3/ffanalytics’
Warning in install.packages :
running command ‘”C:/PROGRA~1/R/R-33~1.1/bin/i386/R” CMD INSTALL -l “\\Mac\Home\Documents\R\win-library\3.3” “//Mac/Home/Documents/ffanalytics_0.1.7.tar.gz”‘ had status 1
Warning in install.packages :
installation of package ‘//Mac/Home/Documents/ffanalytics_0.1.7.tar.gz’ had non-zero exit status
Any thoughts on options at this point? I am running Parallels on my iMac which is running Windows10. Both R and R-studio are up to date.
Thanks again!
So I tried to just run R/RStudio from os x versus using my VM and followed your instructions. Worked like a charm!!!! Must have been something to do with how the files are referenced in my vm environment that I could not figure out.
Now that I have the tool working for the most part and have moved from our initial draft in our league. I was wanting to use this tool to pull in the weekly projections so I can analyze the projections each week. I understand how you pick a certain week in the scrape settings but how do you bypass the calculation settings with all the draft data/settings?
This tool is so sweet!
Not sure I understand–what do you mean bypass the calculation settings?
Sorry. The calculations tab/settings under the calculate projections is what I am referring too. Now that my draft is over I just want to pull in the projections for week one for example and I do not care about number of teams in league/draft at this point. Is it possible to just use the tool/addin to pull in the projections based on my league settings?
You can download week 1 projections from any site that has them currently up (not many), or you can download them from our Projections tool when we have them up.
http://apps.fantasyfootballanalytics.net/
When the scrape for one of the selected sources fails, does that skew things at all with the list, or do they get ignored?
Not sure what you mean by “skew things”. It’s an average, so a missing value won’t affect it in a bad way.
So I’m getting some huge values for points and upper. Most guys are in the thousands. Lower seems reasonable. What would I be doing to get these kind of results? I bumped TD’s to 6, receptions to 1, and I knocked fumbles and int’s to -2. Here’s my code.
myProjections <- getProjections(scrapeData=runScrape(week = 0, season = 2016, analysts = c(3, 5, 6, 9, 11, 12, 13, 14, 15, 25), positions = c("QB", "RB", "WR", "TE"), fbgUser = "", fbgPwd = ""), avgMethod = "average", leagueScoring = userScoring, vorBaseline, vorType, teams = 12, format = "ppr", mflMocks = -1, mflLeagues = -1, adpSources = c("Yahoo"))
And I forgot to blank out my FBG password. I reset it, but can someone delete that post or something?
FOX Sports is unstable as source as the returned columns may shift during a scrape. Can you try the scrape again without FOX? I removed your FBG username and password from the post.
Still getting the extreme values for points and upper even after taking Fox out.
myProjections <- getProjections(scrapeData=runScrape(week = 0, season = 2016, analysts = c(3, 5, 9, 11, 12, 13, 14, 15, 25), positions = c("QB", "RB", "WR", "TE"), fbgUser = "", fbgPwd = ""), avgMethod = "average", leagueScoring = userScoring, vorBaseline, vorType, teams = 12, format = "ppr", mflMocks = -1, mflLeagues = -1, adpSources = c("Yahoo"))
Can you check myProjections$scrapeData for any stats that seem out of range? You can check specific positions as well. For example, WR stats can be found by myProjections$scrapeData$WR. If you find any, then check the analyst column for the id of the analyst.
Thank you.
Those commands return null. If I run myProjections$scrape$WR it returns something. From that nothing stat wise looks out of whack.
Can you share what your userScoring object contains?
Here’s the output for just WR b/c how big the post would be. But for instance Julio Jones is projected for over a thousand points.
$WR
dataCol multiplier position
1: rushYds 0.1 WR
2: rushAtt 0 WR
3: rushTds 6 WR
4: rush40 0 WR
5: rush100 0 WR
6: rush150 0 WR
7: rush200 0 WR
8: rec 1 WR
9: recYds 0.1 WR
10: recTds 6 WR
11: rec40 0 WR
12: returnYds 0 WR
13: returnTds 6 WR
14: twoPts 2 WR
15: fumbles -2 WR
Julio Jones average stats can be extracted by
myProjections$avgStats$WR@resultData[playerId == 2495454]
. You can see the source stats viamyProjections$scrape$WR@resultData[playerId == 2495454]
. The scoring looks fine, so the issue should be somewhere in the stats.It’s the receiving TD’s….234, would probably skew things just a bit.
playerId position games rushAtt rushYds rushTds rush40 returnTds twoPts fumbles
1: 2495454 WR 16 0.1857143 0.8 0 0 0 0.2 3.00325
rec recYds recTds rec40 returnYds
1: 104.9143 1473.02 234.4139 7.4 0
Yeah, that is pretty high considering he is projected for 104.9 receptions. Could you check myProjections$scrape$WR@resultData[playerId == 2495454] to see which analyst has the high number of recTds?
It’s 4for4. Going to take a close look at the csv I downloaded.
myProjections$scrape$WR@resultData[playerId == 2495454]
playerId games rushAtt rushYds rushTds rush40 rec recYds recTds rec40
1: 2495454 16 0.0 0.0 0 0 127.0 1755.000 8.100 7.4
2: 2495454 NA NA NA NA NA NA 1372.000 8.000 NA
3: 2495454 NA 0.3 1.6 0 NA 116.4 1624.800 8.800 NA
4: 2495454 16 1.0 4.0 0 NA 115.0 1633.000 10.000 NA
5: 2495454 16 0.0 0.0 0 NA 133.0 1795.000 8.000 NA
6: 2495454 16 0.0 0.0 0 NA 125.0 1800.000 8.000 NA
7: 2495454 16 0.0 0.0 0 NA 118.0 1675.000 9.000 NA
8: 2495454 NA 0.0 0.0 0 NA 0.0 129.363 1815.411 NA
returnYds returnTds twoPts fumbles analyst player position
1: 0 0 0.2 1.000 3 Julio Jones WR
2: NA NA NA 1.000 5 Julio Jones WR
3: NA NA NA 0.800 9 Julio Jones WR
4: NA NA NA NA 11 Julio Jones WR
5: NA NA NA NA 12 Julio Jones WR
6: NA NA NA NA 14 Julio Jones WR
7: NA NA NA NA 15 Julio Jones WR
8: NA NA NA 9.213 25 Julio Jones WR
>
Thanks for this great tool!
Can the default scoring settings be changed in the Calculate Projections addin? It would be nice to be able to edit the defaults to my league settings to be set each time i run. Thanks!
Yes, you can change the scoring settings! Just modify the values in the addin (as shown in the above article).
To make sure I understand, are you referring to manually typing in new values into the addon each time it is run? I would like to permanently change those default values in the addon so they don’t need to be re-typed each time its run. Does it take a command similar to the modifying analyst weights section? Could you give an example for modifying the scoring settings?
If you want to change them in the addin, you’d have to do that manually every time you run it. You can change the values permanently if you define your own
leagueScoring
object. For instance, after you run the addin, typeuserScoring
into the console. If you create this object with code (and specify the values you want), you can put it into theleagueScoring
argument of therunScrape()
function, and you wouldn’t have to type in the values manually.So it looks like it’s shifting everything to the right, so his receptions became yards and yards became TD’s. Is there something special I need to do with the 4for4 csv? I just downloaded it from the site and didn’t adjust anything.
Looks like a column was added. I have updated to configuration, so you will need to reinstall the package to get the updated setup.
Sorry, should have responded faster. That did the trick, thank you much.
I’m receiving this error message when trying to install:
* installing *source* package ‘ffanalytics’ …
** R
** data
*** moving datasets to lazyload DB
** inst
** preparing package for lazy loading
Error in loadNamespace(i, c(lib.loc, .libPaths()), versionCheck = vI[[i]]) :
there is no package called ‘httpuv’
Error : package ‘shiny’ could not be loaded
ERROR: lazy loading failed for package ‘ffanalytics’
* removing ‘C:/Users/Owner/Documents/R/win-library/3.3/ffanalytics’
Error: Command failed (1)
Error in loadNamespace(i, c(lib.loc, .libPaths()), versionCheck = vI[[i]]) :
there is no package called ‘httpuv’
Error : package ‘shiny’ could not be loaded
It’s saying you need to install the
httpuv
andshiny
packages. See the packages you need to install manually in the Installation section in the above article.I’m now getting a new error message:
Error in ffanalytics:::Run_Projection() : object ‘analysts’ not found
How can I export the results from the RunScrape fuction? I tried the write.csv command that was suggested for saving the projections as csv but keep getting errors…
We’d need more info to reproduce. What command did you run and what error did you get?
I figured it out, I was leaving the @ResultData out of the end of the datatable. my R experience is pretty minimal and I had never worked with data set up like this.
Thank you for your help
P.S. The data back on the 29th looks good, but I wanted to update it so I pulled it again today and it seems like Yahoo is offset. Atleast for QBs it is putting yards into the passing TD column but it doesn’t seem as simple as moving it over one column because that would have all the passing completions rates extremely low (it would have matt ryan at 166/603 for example, all QBs are similarly like that). I have no idea how to begin to fix it or even how to see the code that runscrape uses.
Is the server down for the snake draft optimizer?
Isaac – I just want to say thanks for this package. I setup something very similar in VB.NET last season. I was in the process of adding in more sources when I stumbled across yours. It is working very well for a frontend data pull.
One question though, is there a way to write the myprojections$avgstats$[POS] objects to a csv file? I am having a hard time getting this to work.
Thanks
The object that is referenced is a class object, so to get to the stats you can use
myProjections$avgStats$QB@resultData
to get data for quarterbacks. That will return the `data.table` with the average stats.Within RStudio, I do not have a Calculate Projections addin. The RunScrape option is available however? I’m using OS X 10.11 and downloaded all R software last night, so everything should have been up to date. Is the only benefit to using R over your projections website the ability to have up to the minute data?
The R package is good for users who want to do stats/data analysis themselves. For most users, we recommend using our webapps instead. What results do you get when you run
sessionInfo()
?I have the same issue as Tklusk here is my session info
R version 3.3.1 (2016-06-21)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows >= 8 x64 (build 9200)
locale:
[1] LC_COLLATE=English_United States.1252 LC_CTYPE=English_United States.1252
[3] LC_MONETARY=English_United States.1252 LC_NUMERIC=C
[5] LC_TIME=English_United States.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] ffanalytics_0.1.7 miniUI_0.1.1 shiny_0.13.2
loaded via a namespace (and not attached):
[1] Rcpp_0.12.7 RColorBrewer_1.1-2 git2r_0.15.0 plyr_1.8.4 bitops_1.0-6
[6] tools_3.3.1 rpart_4.1-10 digest_0.6.10 nlme_3.1-128 memoise_1.0.0
[11] gtable_0.2.0 lattice_0.20-33 Matrix_1.2-6 curl_1.2 gridExtra_2.2.1
[16] stringr_1.1.0 withr_1.0.2 httr_1.2.1 cluster_2.0.4 caTools_1.17.1
[21] devtools_1.12.0 grid_3.3.1 nnet_7.3-12 data.table_1.9.6 R6_2.1.3
[26] tcltk_3.3.1 readxl_0.1.1 XML_3.98-1.4 survival_2.39-4 RSelenium_1.4.0
[31] foreign_0.8-66 RJSONIO_1.3-0 latticeExtra_0.6-28 Formula_1.2-1 magrittr_1.5
[36] ggplot2_2.1.0 Hmisc_3.17-4 scales_0.4.0 htmltools_0.3.5 splines_3.3.1
[41] mime_0.5 xtable_1.8-2 colorspace_1.2-6 httpuv_1.3.3 stringi_1.1.1
[46] acepack_1.3-3.3 RCurl_1.95-4.8 munsell_0.4.3 chron_2.3-47
Could you download the latest version of Rstudio and all of the packages manually (see Installation section)?
So to get setup, I did have to manually install packages. But in regards to the issue above issue, my problem was that I missed where the calculate projections is call “run_projections” … once I figured that out, it ran fine.
Was working great after the last fix for 4 For 4. But, now I’m getting projection values of 5000+ for the three point categories for all players. Thanks in advance.
myProjections <- getProjections(scrapeData=runScrape(week = 0, season = 2016, analysts = c(-1, 3, 4, 5, 6, 7, 11, 12, 13, 14, 15, 22, 23, 17, 18, 19, 20, 25, 28), positions = c("QB", "RB", "WR", "TE", "K", "DST"), fbgUser = "XXXX", fbgPwd = "XXXX"), avgMethod = "average", leagueScoring = userScoring, vorBaseline, vorType, teams = 8, format = "standard", mflMocks = -1, mflLeagues = -1, adpSources = c("Yahoo"))
Some of the messages:
“Got more columns in data than number of columns specified by names from
http://football.fantasysports.yahoo.com/f1/52880/players?&sort=PTS&sdir=1&status=A&pos=QB&cut_type=9&stat1=S_PS_2016&jsenabled=1&count=0
Removing columns after column 36″
“Empty data table retrieved from
http://games.espn.go.com/ffl/tools/projections?&slotCategoryId=0&startIndex=120”
“Got more columns in data than number of columns specified by names from
http://fantasy.nfl.com/research/projections?position=8&sort=projectedPts&statCatery=projectedStats&statSeason=2016&statType=seasonProjectedStats&offset=1
Removing columns after column 11″
“Empty data table retrieved from
http://subscribers.footballguys.com/myfbg/myviewprojections.php?projforwhat=pk&projector=60&profile=0”
“Got fewer columns in data than number of columns specified by names from:
http://www.fantasyfootballnerd.com/service/draft-projections/xml/test/QB
NOTE: Returning empty datasetGot fewer columns in data than number of columns specified by names from:
http://walterfootball.com/fantasy2016rankingsexcel.xlsx
NOTE: Returning empty dataset=================”
Seems to be something up with Yahoo. I get a message that it returned more tables and my projections are way off. Point totals in the thousands and CJ Spiller as the #1 player.
I’m seeing the same. It appears the values are all one column to the right of where they should be, resulting in RBs being projected for 60 rushTds and 17recTds.
Hi guys, thanks for making this tool available to the public.
I’m running myProjections and the scrape is successful but then I get this:
“> myProjections <- getProjections(scrapeData=runScrape(week = 1, season = 2016, analysts = c(-1), positions = c("QB")), avgMethod = "average", leagueScoring = userScoring, vorBaseline, vorType, teams = 12, format = "standard", mflMocks = -1, mflLeagues = -1, adpSources = c("CBS"))
Retrieving player data
=================
Scrape Summary:
QB :
Successfully: CBS Average
Failed: NA
Retrieving overall ECR ranks
Error in eval(expr, envir, enclos) : object 'playerId' not found
In addition: Warning message:
Weekly overall rankings not available "
When I look at scrapeData I see playerId, passAtt, passComp, etc. but it doesn't look like they are stored as objects. What is happening here?
Do you have the latest version of the package, R, and Rstudio? Did you install all necessary packages (see Installation section)? What do you get when you run
sessionInfo()
?Hi Issac,
I’am getting the same issue. All of my packages and R are up to date. I have devtools. miniui,rstudioapi,and shiny all loaded. The only df being stored for me is playerData, which has the “playerId” as one of the columns. I’ve restarted R and the computer, but theissue continues.
Did you install the other packages manually (see Installation section)?
I installed devtools, rstudioapi using install.packages, I used the tarbal to install ffanalytics manually, and shiny and miniui are loaded automatically when I do library(ffanalytics)
Could you manually install the other packages listed in the Installation section of the above article?—i.e., not just the ones you’re naming.
In RStudio I ran the “Run Scrape” from the addins menu after loading packages and this error came up. I only selected to scrape Yahoo for Week 1.
> ffanalytics:::Run_Scrape()
Listening on http://127.0.0.1:4248
> myScrapeData <- runScrape(week = 1, season = 2016, analysts = c(3), positions = c("QB", "RB", "WR", "TE", "K"), fbgUser = NULL, fbgPwd = NULL)
Retrieving player data
Got more columns in data than number of columns specified by names from
http://football.fantasysports.yahoo.com/f1/52880/players?status=A&pos=QB&cut_type=9&stat1=S_PW_1&myteam=0&sort=PTS&sdir=1&count=0
Removing columns after column 36
Got more columns in data than number of columns specified by names from
http://football.fantasysports.yahoo.com/f1/52880/players?status=A&pos=QB&cut_type=9&stat1=S_PW_1&myteam=0&sort=PTS&sdir=1&count=25
Removing columns after column 36
Got more columns in data than number of columns specified by names from
http://football.fantasysports.yahoo.com/f1/52880/players?status=A&pos=QB&cut_type=9&stat1=S_PW_1&myteam=0&sort=PTS&sdir=1&count=50
Removing columns after column 36
Got more columns in data than number of columns specified by names from
http://football.fantasysports.yahoo.com/f1/52880/players?status=A&pos=QB&cut_type=9&stat1=S_PW_1&myteam=0&sort=PTS&sdir=1&count=75
Removing columns after column 36
Got more columns in data than number of columns specified by names from
http://football.fantasysports.yahoo.com/f1/52880/players?status=A&pos=QB&cut_type=9&stat1=S_PW_1&myteam=0&sort=PTS&sdir=1&count=100
Removing columns after column 36
Got more columns in data than number of columns specified by names from
http://football.fantasysports.yahoo.com/f1/52880/players?status=A&pos=QB&cut_type=9&stat1=S_PW_1&myteam=0&sort=PTS&sdir=1&count=125
Removing columns after column 36
Got more columns in data than number of columns specified by names from
http://football.fantasysports.yahoo.com/f1/52880/players?status=A&pos=RB&cut_type=9&stat1=S_PW_1&myteam=0&sort=PTS&sdir=1&count=0
Removing columns after column 36
Got more columns in data than number of columns specified by names from
http://football.fantasysports.yahoo.com/f1/52880/players?status=A&pos=RB&cut_type=9&stat1=S_PW_1&myteam=0&sort=PTS&sdir=1&count=25
Removing columns after column 36
Got more columns in data than number of columns specified by names from
http://football.fantasysports.yahoo.com/f1/52880/players?status=A&pos=RB&cut_type=9&stat1=S_PW_1&myteam=0&sort=PTS&sdir=1&count=50
Removing columns after column 36
Got more columns in data than number of columns specified by names from
http://football.fantasysports.yahoo.com/f1/52880/players?status=A&pos=RB&cut_type=9&stat1=S_PW_1&myteam=0&sort=PTS&sdir=1&count=75
Removing columns after column 36
Got more columns in data than number of columns specified by names from
http://football.fantasysports.yahoo.com/f1/52880/players?status=A&pos=RB&cut_type=9&stat1=S_PW_1&myteam=0&sort=PTS&sdir=1&count=100
Removing columns after column 36
Got more columns in data than number of columns specified by names from
http://football.fantasysports.yahoo.com/f1/52880/players?status=A&pos=RB&cut_type=9&stat1=S_PW_1&myteam=0&sort=PTS&sdir=1&count=125
Removing columns after column 36
Got more columns in data than number of columns specified by names from
http://football.fantasysports.yahoo.com/f1/52880/players?status=A&pos=RB&cut_type=9&stat1=S_PW_1&myteam=0&sort=PTS&sdir=1&count=150
Removing columns after column 36
Got more columns in data than number of columns specified by names from
http://football.fantasysports.yahoo.com/f1/52880/players?status=A&pos=RB&cut_type=9&stat1=S_PW_1&myteam=0&sort=PTS&sdir=1&count=175
Removing columns after column 36
Got more columns in data than number of columns specified by names from
http://football.fantasysports.yahoo.com/f1/52880/players?status=A&pos=RB&cut_type=9&stat1=S_PW_1&myteam=0&sort=PTS&sdir=1&count=200
Removing columns after column 36
Got more columns in data than number of columns specified by names from
http://football.fantasysports.yahoo.com/f1/52880/players?status=A&pos=RB&cut_type=9&stat1=S_PW_1&myteam=0&sort=PTS&sdir=1&count=225
Removing columns after column 36
Got more columns in data than number of columns specified by names from
http://football.fantasysports.yahoo.com/f1/52880/players?status=A&pos=RB&cut_type=9&stat1=S_PW_1&myteam=0&sort=PTS&sdir=1&count=250
Removing columns after column 36
Got more columns in data than number of columns specified by names from
http://football.fantasysports.yahoo.com/f1/52880/players?status=A&pos=RB&cut_type=9&stat1=S_PW_1&myteam=0&sort=PTS&sdir=1&count=275
Removing columns after column 36
Got more columns in data than number of columns specified by names from
http://football.fantasysports.yahoo.com/f1/52880/players?status=A&pos=WR&cut_type=9&stat1=S_PW_1&myteam=0&sort=PTS&sdir=1&count=0
Removing columns after column 36
Got more columns in data than number of columns specified by names from
http://football.fantasysports.yahoo.com/f1/52880/players?status=A&pos=WR&cut_type=9&stat1=S_PW_1&myteam=0&sort=PTS&sdir=1&count=25
Removing columns after column 36
Got more columns in data than number of columns specified by names from
http://football.fantasysports.yahoo.com/f1/52880/players?status=A&pos=WR&cut_type=9&stat1=S_PW_1&myteam=0&sort=PTS&sdir=1&count=50
Removing columns after column 36
Got more columns in data than number of columns specified by names from
http://football.fantasysports.yahoo.com/f1/52880/players?status=A&pos=WR&cut_type=9&stat1=S_PW_1&myteam=0&sort=PTS&sdir=1&count=75
Removing columns after column 36
Got more columns in data than number of columns specified by names from
http://football.fantasysports.yahoo.com/f1/52880/players?status=A&pos=WR&cut_type=9&stat1=S_PW_1&myteam=0&sort=PTS&sdir=1&count=100
Removing columns after column 36
Got more columns in data than number of columns specified by names from
http://football.fantasysports.yahoo.com/f1/52880/players?status=A&pos=WR&cut_type=9&stat1=S_PW_1&myteam=0&sort=PTS&sdir=1&count=125
Removing columns after column 36
Got more columns in data than number of columns specified by names from
http://football.fantasysports.yahoo.com/f1/52880/players?status=A&pos=WR&cut_type=9&stat1=S_PW_1&myteam=0&sort=PTS&sdir=1&count=150
Removing columns after column 36
Got more columns in data than number of columns specified by names from
http://football.fantasysports.yahoo.com/f1/52880/players?status=A&pos=WR&cut_type=9&stat1=S_PW_1&myteam=0&sort=PTS&sdir=1&count=175
Removing columns after column 36
Got more columns in data than number of columns specified by names from
http://football.fantasysports.yahoo.com/f1/52880/players?status=A&pos=WR&cut_type=9&stat1=S_PW_1&myteam=0&sort=PTS&sdir=1&count=200
Removing columns after column 36
Got more columns in data than number of columns specified by names from
http://football.fantasysports.yahoo.com/f1/52880/players?status=A&pos=WR&cut_type=9&stat1=S_PW_1&myteam=0&sort=PTS&sdir=1&count=225
Removing columns after column 36
Got more columns in data than number of columns specified by names from
http://football.fantasysports.yahoo.com/f1/52880/players?status=A&pos=WR&cut_type=9&stat1=S_PW_1&myteam=0&sort=PTS&sdir=1&count=250
Removing columns after column 36
Got more columns in data than number of columns specified by names from
http://football.fantasysports.yahoo.com/f1/52880/players?status=A&pos=WR&cut_type=9&stat1=S_PW_1&myteam=0&sort=PTS&sdir=1&count=275
Removing columns after column 36
Got more columns in data than number of columns specified by names from
http://football.fantasysports.yahoo.com/f1/52880/players?status=A&pos=WR&cut_type=9&stat1=S_PW_1&myteam=0&sort=PTS&sdir=1&count=300
Removing columns after column 36
Got more columns in data than number of columns specified by names from
http://football.fantasysports.yahoo.com/f1/52880/players?status=A&pos=WR&cut_type=9&stat1=S_PW_1&myteam=0&sort=PTS&sdir=1&count=325
Removing columns after column 36
Got more columns in data than number of columns specified by names from
http://football.fantasysports.yahoo.com/f1/52880/players?status=A&pos=WR&cut_type=9&stat1=S_PW_1&myteam=0&sort=PTS&sdir=1&count=350
Removing columns after column 36
Got more columns in data than number of columns specified by names from
http://football.fantasysports.yahoo.com/f1/52880/players?status=A&pos=WR&cut_type=9&stat1=S_PW_1&myteam=0&sort=PTS&sdir=1&count=375
Removing columns after column 36
Got more columns in data than number of columns specified by names from
http://football.fantasysports.yahoo.com/f1/52880/players?status=A&pos=WR&cut_type=9&stat1=S_PW_1&myteam=0&sort=PTS&sdir=1&count=400
Removing columns after column 36
Got more columns in data than number of columns specified by names from
http://football.fantasysports.yahoo.com/f1/52880/players?status=A&pos=WR&cut_type=9&stat1=S_PW_1&myteam=0&sort=PTS&sdir=1&count=425
Removing columns after column 36
Got more columns in data than number of columns specified by names from
http://football.fantasysports.yahoo.com/f1/52880/players?status=A&pos=TE&cut_type=9&stat1=S_PW_1&myteam=0&sort=PTS&sdir=1&count=0
Removing columns after column 36
Got more columns in data than number of columns specified by names from
http://football.fantasysports.yahoo.com/f1/52880/players?status=A&pos=TE&cut_type=9&stat1=S_PW_1&myteam=0&sort=PTS&sdir=1&count=25
Removing columns after column 36
Got more columns in data than number of columns specified by names from
http://football.fantasysports.yahoo.com/f1/52880/players?status=A&pos=TE&cut_type=9&stat1=S_PW_1&myteam=0&sort=PTS&sdir=1&count=50
Removing columns after column 36
Got more columns in data than number of columns specified by names from
http://football.fantasysports.yahoo.com/f1/52880/players?status=A&pos=TE&cut_type=9&stat1=S_PW_1&myteam=0&sort=PTS&sdir=1&count=75
Removing columns after column 36
Got more columns in data than number of columns specified by names from
http://football.fantasysports.yahoo.com/f1/52880/players?status=A&pos=TE&cut_type=9&stat1=S_PW_1&myteam=0&sort=PTS&sdir=1&count=100
Removing columns after column 36
Got more columns in data than number of columns specified by names from
http://football.fantasysports.yahoo.com/f1/52880/players?status=A&pos=TE&cut_type=9&stat1=S_PW_1&myteam=0&sort=PTS&sdir=1&count=125
Removing columns after column 36
Got more columns in data than number of columns specified by names from
http://football.fantasysports.yahoo.com/f1/52880/players?status=A&pos=TE&cut_type=9&stat1=S_PW_1&myteam=0&sort=PTS&sdir=1&count=150
Removing columns after column 36
Got more columns in data than number of columns specified by names from
http://football.fantasysports.yahoo.com/f1/52880/players?status=A&pos=TE&cut_type=9&stat1=S_PW_1&myteam=0&sort=PTS&sdir=1&count=175
Removing columns after column 36
Got more columns in data than number of columns specified by names from
http://football.fantasysports.yahoo.com/f1/52880/players?status=A&pos=TE&cut_type=9&stat1=S_PW_1&myteam=0&sort=PTS&sdir=1&count=200
Removing columns after column 36
Got more columns in data than number of columns specified by names from
http://football.fantasysports.yahoo.com/f1/52880/players?status=A&pos=TE&cut_type=9&stat1=S_PW_1&myteam=0&sort=PTS&sdir=1&count=225
Removing columns after column 36
Got more columns in data than number of columns specified by names from
http://football.fantasysports.yahoo.com/f1/52880/players?status=A&pos=K&cut_type=9&stat1=S_PW_1&myteam=0&sort=PTS&sdir=1&count=0
Removing columns after column 22
Got more columns in data than number of columns specified by names from
http://football.fantasysports.yahoo.com/f1/52880/players?status=A&pos=K&cut_type=9&stat1=S_PW_1&myteam=0&sort=PTS&sdir=1&count=25
Removing columns after column 22
Got more columns in data than number of columns specified by names from
http://football.fantasysports.yahoo.com/f1/52880/players?status=A&pos=K&cut_type=9&stat1=S_PW_1&myteam=0&sort=PTS&sdir=1&count=50
Removing columns after column 22
=================
Scrape Summary:
QB :
Successfully: Yahoo Sports
Failed: NA
RB :
Successfully: Yahoo Sports
Failed: NA
WR :
Successfully: Yahoo Sports
Failed: NA
TE :
Successfully: Yahoo Sports
Failed: NA
K :
Successfully: Yahoo Sports
Failed: NA
There were 50 or more warnings (use warnings() to see the first 50)
What error did you get? Those appear to be warnings, not errors. Warnings are not necessarily a problem. Notice how all of the positions say that Yahoo succeeded (and didn’t fail).
So then where did the projections go?
Should be saved in the object you specified in your line of code (myScrapeData)
> write.csv(myScrapeData$projections, file=”c:/projections.csv”, row.names=FALSE)
Error in file(file, ifelse(append, “a”, “w”)) :
cannot open the connection
In addition: Warning message:
In file(file, ifelse(append, “a”, “w”)) :
cannot open file ‘c:/projections.csv’: Permission denied
The write permissions are discussed in the section of the above article on “Viewing/Saving the Projections”.
Hey I recently tried to download ffanalytics package. It looked like everything went smooth but once I try to run the application with library(“ffanalytics”) it says the package is not found. I have installed all the packages including devtools and rstudioapi among others.
I also tried to install the packages via tarball and I’m getting a non-zero exit status error.
Any help would be much appreciated! Thanks!
Did you install all of the necessary dependencies listed in the Installation section? Do you have the latest version of R and Rstudio? What do you get when you run
sessionInfo()
?I am trying to update my package to the latest one (0.1.91), but I am getting the non-zero exit status even after trying to update the dependencies one-by-one. The github install also fails due to the long name. Here is the sessioninfo() output:
> sessionInfo()
R version 3.3.1 (2016-06-21)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 7 x64 (build 7601) Service Pack 1
locale:
[1] LC_COLLATE=English_United States.1252
[2] LC_CTYPE=English_United States.1252
[3] LC_MONETARY=English_United States.1252
[4] LC_NUMERIC=C
[5] LC_TIME=English_United States.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] ffanalytics_0.1.8 miniUI_0.1.1 shiny_0.14.1
loaded via a namespace (and not attached):
[1] Rcpp_0.12.6 RColorBrewer_1.1-2 plyr_1.8.4
[4] bitops_1.0-6 tools_3.3.1 rpart_4.1-10
[7] digest_0.6.10 gtable_0.2.0 lattice_0.20-33
[10] Matrix_1.2-6 gridExtra_2.2.1 stringr_1.1.0
[13] httr_1.2.1 cluster_2.0.4 caTools_1.17.1
[16] grid_3.3.1 nnet_7.3-12 data.table_1.9.6
[19] R6_2.1.2 tcltk_3.3.1 XML_3.98-1.4
[22] survival_2.39-4 readxl_0.1.1 RSelenium_1.4.5
[25] foreign_0.8-66 latticeExtra_0.6-28 Formula_1.2-1
[28] magrittr_1.5 ggplot2_2.1.0 Hmisc_3.17-4
[31] scales_0.4.0 htmltools_0.3.5 splines_3.3.1
[34] mime_0.5 xtable_1.8-2 colorspace_1.2-6
[37] httpuv_1.3.3 stringi_1.1.1 acepack_1.3-3.3
[40] RCurl_1.95-4.8 munsell_0.4.3 chron_2.3-47
[43] rjson_0.2.15
Which package returns the non-zero exit status? Could you include the full error you receive?
This is all I get from the console after typing this – install.packages(“C:\ffanalytics_0.1.91.tar.gz”, repos=NULL, type=”source”)
fanalytics_0.1.91.tar.gz’ had non-zero exit status
I had no luck updating via the tarball file previously. My previous successful update was done through install_github with the following command:
devtools::install_github(c(“isaactpetersen/FantasyFootballAnalyticsR/R Package/ffanalytics”))
That doesn’t work for me now, it’s giving me that long name error same as the workaround described here.
Also tried the API yesterday but the sign-in is not working. Both IE and Chrome browsers.
Github install now works after several tries.
> devtools::install_github(repo = “isaactpetersen/FantasyFootballAnalyticsR”, subdir = “R Package/ffanalytics”)
Downloading GitHub repo isaactpetersen/FantasyFootballAnalyticsR@master
from URL https://api.github.com/repos/isaactpetersen/FantasyFootballAnalyticsR/zipball/master
Installing ffanalytics
“C:/PROGRA~1/R/R-33~1.1/bin/x64/R” –no-site-file –no-environ –no-save \
–no-restore –quiet CMD INSTALL \
“C:/Users/username/AppData/Local/Temp/Rtmp4ojmRH/devtools7f033a262/isaactpetersen-FantasyFootballAnalyticsR-dc26820/R \
Package/ffanalytics” –library=”C:/Program Files/R/R-3.3.1/library” \
–install-tests
* installing *source* package ‘ffanalytics’ …
** R
** data
*** moving datasets to lazyload DB
** inst
** preparing package for lazy loading
** help
*** installing help indices
** building package indices
** testing if installed package can be loaded
*** arch – i386
*** arch – x64
* DONE (ffanalytics)
I appreciate all of your help on this Isaac. Many thanks. I got it to write a csv file now but there is nothing in the csv file. What would be the reason for this?
Is there anything in the object, myScrapeData? What line of code did you use to scrape the projections?
> (myScrapeData)
$QB
Data for: QB
============
playerId games passAtt passComp passInc passYds passTds
1: 252 1 1215 0.3 1214.7 0.1 2.3
2: 264 0 1450 0.0 1450.0 0.0 0.0
3: 310 1 14 37.6 -23.6 9.9 292.0
4: 367 0 1468 0.0 1468.0 0.0 0.0
5: 382 1 23 37.5 -14.5 11.2 264.0
—
103: 2555334 1 786 2.9 783.1 1.0 19.3
104: 2555387 1 1210 0.3 1209.7 0.1 2.3
105: 2555416 0 1432 0.0 1432.0 0.0 0.0
106: 2555426 1 1176 0.3 1175.7 0.1 1.9
107: 2556477 1 791 0.3 790.7 0.1 2.0
passInt sacks pass40 rushAtt rushYds rushTds rush40 returnTds
1: 0.0 0.0 0.0 0.0 0.3 0.8 0.3 0
2: 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0
3: 1.7 0.9 2.5 0.7 1.9 4.7 0.5 0
4: 0.0 0.0 0.0 0.0 0.0 0.0 0.0
and then it continues on for rest of positions.
To scrape I used the scraper add in and just selected Week 1 yahoo and the offensive players all the way down to D/ST
To save the scraped data, you’d have to select one position at a time, e.g:
myScrapeData$QB
Or you could calculate projections from the scraped data with the Calculate Projections addin, and then save those for all positions.
I am very open to doing a screen share of my screen and a chat if you are open to that. Seems far more productive.
Hello, I have tried to download ffanalytics package via the instructions above. After reading comments above I see that it’s not working because the path names are too long. I then went onto the tarball instructions and tried to install.
When I type in this code install.packages(ffanalytics_0.1.7.tar.gz, repos=NULL, type=”source”) into R/Rstudio it returns Error in install.packages : object ‘ffanalytics_0.1.7.tar.gz’ not found.
The tarball part is confusing to me because of so there are so many files in the Github repository so my apologies if I am missing a step here somewhere or am not downloading the correct file. Any thoughts on what I’m doing wrong? thanks.
You’ll want to put the *full filename* in quotes (see Installation section). Download the latest tarball, and put the filename in the line of code you’re using.
I have tried to run the projections tonight but I get hugely exaggerated point totals for every player contrary to the previous expected values for my leagues scoring including a run I did this week on the 29th?? Any ideas on what is going wrong?
Probably an issue with the Yahoo scrape because they changed their columns. We’re aware of it and working on it.
Hi Isaac, thanks for the help. I did what you told me to do, which worked, then I received the non zero exit status error. I then loaded the line code that is shown in the install section to fix this issue. Everything unpacked successfully, however when I go to the next step of entering the line of code: library(“ffanalytics”), i get this error:
Error in library(“ffanalytics”) :
‘ffanalytics’ is not a valid installed package
Not sure if this matters but I went back and made sure I saved the latest tarball version 1.7 in the R folder of my C drive: ‘C:/Program Files/R/R-3.3.1/library’. However when I type in: Library() in Rstudio which returns all installed packages, the ffanalytics package isn’t showing up there. any thoughts on this? sorry for the hassle.
no VOR and other columns?
is there still an issue with yahoo load?
Hi Peter,
You were probably looking at projections for Week 1. Weekly projections do not include VOR, ADP, or ECR Rank. If you change to seasonal projections you should see those.
Hope that helps,
Isaac
does the free version not allow to exclude players?
You should be able to exclude players if you are logged in. Which tool are you using and what happens when you try to exclude player?
I noticed that the ffanalytics tarball on github has not been updated for a few days, but the ffanalytics folder was updated recently. How do i install these updates? is it as simple as downloading each updated file? or are these updates WIP, and will be available later?
Hey there, I have been having trouble trying to get the GetProjections function to work. It used to work for me, but now it is throwing exceptions which I am unable to resolve. At first, the missing data from sources was causing issues, but even after culling out data sources which aren’t returning data, I am still getting errors like these:
Error in `[.data.table`(scoringTbl, , `:=`(c(“dataCol”, “multiplier”, :
RHS of assignment to existing column ‘multiplier’ is zero length but not NULL. If you intend to delete the column use NULL. Otherwise, the RHS must have length > 0; e.g., NA_integer_. If you are trying to change the column type to be an empty list column then, as with all column type changes, provide a full length RHS vector such as vector(‘list’,nrow(DT)); i.e., ‘plonk’ in the new column.
I am using the code from the most recent tarball posted on the site. Any suggestions appreciated.
What line of code are you using that generates the error? What’s in your
sessionInfo()
?the command I am running:
myProjections = 8 x64 (build 9200)
locale:
[1] LC_COLLATE=English_United States.1252 LC_CTYPE=English_United States.1252 LC_MONETARY=English_United States.1252
[4] LC_NUMERIC=C LC_TIME=English_United States.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] ffanalytics_0.1.7 miniUI_0.1.1 shiny_0.13.2 RevoUtilsMath_8.0.3
loaded via a namespace (and not attached):
[1] Rcpp_0.12.5 RColorBrewer_1.1-2 plyr_1.8.3 bitops_1.0-6 tools_3.3.1
[6] rpart_4.1-10 digest_0.6.9 jsonlite_0.9.20 gtable_0.2.0 lattice_0.20-33
[11] Matrix_1.2-6 curl_0.9.7 gridExtra_2.2.1 stringr_1.0.0 httr_1.2.0
[16] cluster_2.0.4 RevoUtils_10.0.1 caTools_1.17.1 grid_3.3.1 nnet_7.3-12
[21] data.table_1.9.6 R6_2.1.2 tcltk_3.3.1 readxl_0.1.1 XML_3.98-1.4
[26] survival_2.39-4 RSelenium_1.3.5 foreign_0.8-66 RJSONIO_1.3-0 latticeExtra_0.6-28
[31] Formula_1.2-1 magrittr_1.5 ggplot2_2.1.0 Hmisc_3.17-4 scales_0.4.0
[36] htmltools_0.3.5 splines_3.3.1 mime_0.4 xtable_1.8-2 colorspace_1.2-6
[41] httpuv_1.3.3 stringi_1.1.1 acepack_1.3-3.3 RCurl_1.95-4.8 munsell_0.4.3
[46] chron_2.3-47
sorry, copy paste fail.
command:
myProjections <- ffanalytics::getProjections(scrapeData=ffanalytics::runScrape(week = 1, season = 2016, analysts = c(-1, 4, 5, 6, 19), positions = c("RB", "WR")), avgMethod = "weighted", leagueScoring = userScoring, vorBaseline, vorType, teams = 10, format = "standard", mflMocks = 0, mflLeagues = 0, adpSources = c("CBS", "ESPN", "FFC", "MFL", "NFL", "Yahoo"))
one more thing, the exception happens after the scrape appears to complete successfully, but the point calculation fails.
Retrieving player data
=================
Scrape Summary:
RB :
Successfully: CBS Average, ESPN, NFL, FOX Sports, FantasyFootballNerd
Failed: NA
WR :
Successfully: CBS Average, ESPN, NFL, FOX Sports, FantasyFootballNerd
Failed: NA
Calculating Points
Error in `[.data.table`(scoringTbl, , `:=`(c(“dataCol”, “multiplier”, :
RHS of assignment to existing column ‘multiplier’ is zero length but not NULL. If you intend to delete the column use NULL. Otherwise, the RHS must have length > 0; e.g., NA_integer_. If you are trying to change the column type to be an empty list column then, as with all column type changes, provide a full length RHS vector such as vector(‘list’,nrow(DT)); i.e., ‘plonk’ in the new column.
Do you have the most recent version of R and Rstudio? Did you install all of the necessary packages (see Installation section)?
can’t seem to reply to your last question, but yes. I should have all the recent versions. I just tried the same on a fresh install on another computer using the 1.8 tarball, 0.99.903 of R Studio and the microsoft 3.3 R package. Also downloaded the dependencies with this command:
install.packages(c(“devtools”,”rstudioapi”,”shiny”,”miniUI”,”data.table”,”stringr”,”DT”,”XML”,”httr”,”tcltk”,”RCurl”,”Hmisc”,”readxl”,”RSelenium”), dependencies=TRUE, repos=c(“http://rstudio.org/_packages”, “http://cran.rstudio.com”))
We released a new version of the package. Try that and let us know.
same error for me on my primary machine and got a similar error on another workstation:
Error in unlist(dataCol) : object ‘dataCol’ not found
Was this ever resolved?
Anyone using the run_projections gui on a UHD monitor? I am running at 1920×1080 and a lot of the drops downs and check boxes are jumbled on top of each other.
In the latest tarball, getting this error when running week 1 projections
Error in bmerge(i, x, leftcols, rightcols, io, xo, roll, rollends, nomatch, :
typeof x.player (logical) != typeof i.player (character)
I am also getting scrape failures for sites that are showing data available, is this something I can easily fix?
QB Failed: NumberFire, FantasyPros, EDS Football
RB Failed: NumberFire, FantasyPros, EDS Football
WR Failed: NumberFire, FantasyPros, EDS Football
TE Failed: NumberFire, FantasyPros, EDS Football
K : Failed: NumberFire, FantasyPros
DST Failed: FFToday, NumberFire
Thank you in advance!
Those sources were likely unavailable or could not be scraped. You might try other sources.
I am having the same problem as DC. While trying to get week 1 projections, the error described above occurs.
I tried to isolate the problem by getting the projection for only one source with one position (Week 1, ESPN, QB).
I was able to scrape the data successfully (as I ran a scrape independently of the projection). I verified the scrape did work by looking at “myScrapeData” (data looked good). I then tried to create a projection from this scrape and the error occurs.
Could this error be from something else?
NumberFire, EDS have changed their formats, so the current scripts don’t seem to work for them
Update: when i set the MFLmocks and MFLleagues to = NULL, I am able to get the projections for the full 2016 season. Though I am able to scrape data for Week 1, whenever I run a projection on the week 1 data, i get this error.
“Error in bmerge(i, x, leftcols, rightcols, io, xo, roll, rollends, nomatch, :
typeof x.player (logical) != typeof i.player (character)”
If anyone has a similar issue that would be good to know. Would like individual week data,
We released a new version of the package. Try that and let us know.
trying to run week 1 projections using the latest package and the projections window that pops up is blank. Has “no matching records found” displayed, and Showing 0 to 0 of 0 entries (filtered from 833 total entries). This is the immediate result after executing the “Calculate Projections” addin. I have not added any filtering.
The myProjections data is available and does contain projections. the noted issue above “error in bmerge…’ is resolved.
Thanks advance.
This is an outstanding package. Thanks so much.
Is there a way to get historical projections from each analyst separately as well as the actual points for the given week? For example, each player for a given week as the observation, the columns being the projections made by a given analyst, and a final column with the actual points for the given player/week. In case I wanted to attempt to run other models.
Thanks!
And by projected/actual points, I mean, fantasy points.
Yes, you can download historical projections and performance using our webapps. For more info, see here:
https://fantasyfootballanalytics.net/2016/06/download-projections.html
I am able to get the scrape values for week2 but cannot get the projections. Here is what I get:
Scrape Summary:
=================
Scrape Summary:
QB :
Successfully: CBS Average, Yahoo Sports, ESPN, NFL, FOX Sports, FantasyFootballNerd
Failed: FantasyPros
RB :
Successfully: CBS Average, Yahoo Sports, ESPN, NFL, FOX Sports, FantasyFootballNerd
Failed: FantasyPros
WR :
Successfully: CBS Average, Yahoo Sports, ESPN, NFL, FOX Sports, FantasyFootballNerd
Failed: FantasyPros
TE :
Successfully: CBS Average, Yahoo Sports, ESPN, NFL, FOX Sports, FantasyFootballNerd
Failed: FantasyPros
K :
Successfully: CBS Average, Yahoo Sports, NFL, FOX Sports, FantasyFootballNerd
Failed: FantasyPros
DST :
Successfully: CBS Average, Yahoo Sports, NFL, FOX Sports, FantasyFootballNerd
Failed: NA
There were 50 or more warnings (use warnings() to see the first 50)
> warnings()
Warning messages:
1: In readUrl(inpUrl, columnTypes = scrapeColumns$columnType, … :
2: In ..FUN1(star) : NAs introduced by coercion
3: In ..FUN1(add) : NAs introduced by coercion
———-
> myProjectionsQBWk2 <- getProjections(myScrapeData, avgMethod = "weighted", leagueScoring = userScoring, teams = 12, format = "ppr", mflMocks = -1, mflLeagues = -1, adpSources = c("CBS", "ESPN", "MFL", "NFL", "Yahoo"))
Retrieving overall ECR ranks placing Missing Data
Error in eval(expr, envir, enclos) : object 'playerId' not found
In addition: Warning message:
Weekly overall rankings not available
Trying the app but no option for week2
R studio and R are up-to-date. I was trying to update to ffanalytics_0.1.9 but getting non-zero exit error;alternative method does not work either . Package/dependencies are also updated.
I have not been able to successfully install the ffanalytics package. I believe I have all the dependencies installed correctly, but this is the error I get on my Windows 7 machine when I try to install the tar:
Installing package into ‘C:/Users/rrose.A-CC/Documents/R/win-library/3.3’
(as ‘lib’ is unspecified)
Error in getOctD(x, offset, len) : invalid octal digit
Warning in install.packages :
running command ‘”C:/PROGRA~1/R/R-33~1.1/bin/x64/R” CMD INSTALL -l “C:\Users\rrose.A-CC\Documents\R\win-library\3.3” “D:/DOCUME~1/FANTAS~1/R/FFANAL~1/ffanalytics_0.1.8.tar.gz”‘ had status 1
Warning in install.packages :
installation of package ‘D:/DOCUME~1/FANTAS~1/R/FFANAL~1/ffanalytics_0.1.8.tar.gz’ had non-zero exit status
Nevermind… I didn’t download the tar file correctly….
Hi,
Once I installed ffanalytics package I run the “Calculate Projections” add-in, it downloads data from the ESPN but I am getting the following error:
There were 50 or more warnings (use warnings() to see the first 50)
> warnings()
Warning messages:
1: In ..FUN1(opponen) : NAs introduced by coercion
2: In ..FUN1(status) : NAs introduced by coercion
3: In ..FUN1(opponen) : NAs introduced by coercion
4: In ..FUN1(status) : NAs introduced by coercion
Etc.
Am I doing something wrong? Could you please help?
Hi Anna,
Are projections generated? Those aren’t errors (just warnings), so they might not be a problem if projections are generated correctly.
-Isaac
Thanks for your help and sorry to bother you. Yes, I got the projections generated.
Hello,
has anyone managed to get NumberFire or EDS scrapes to Work? I am struggling with these 2.
Thanks in advance.
Hey FFAnalytics Team!
I have been enjoying your tool on your webpage, but I’ve been having trouble replicating it through your package in R. I had no issues downloading the package but running runScrape() and getProjections() has given me troubles. Example code below:
R, and RStudio up to date on Windows7 –
myProjections <- getProjections(scrapeData=runScrape(week = 10, season = 2016, analysts = c(4), positions = c("QB", "RB", "WR", "TE")), avgMethod = "average", leagueScoring = userScoring, vorBaseline, vorType, teams = 12, format = "standard", mflMocks = -1, mflLeagues = -1, adpSources = NULL)
Retrieving player data
=================
Scrape Summary:
QB :
Successfully: ESPN
Failed: NA
RB :
Successfully: ESPN
Failed: NA
WR :
Successfully: ESPN
Failed: NA
TE :
Successfully: ESPN
Failed: NA
Retrieving ECR ranks for position
Error in data.table::setnames(rnks, cNames) :
Can't assign 7 names to a 8 column data.table
AND
test <- runScrape(season = 2016, week = 1, analysts = c(-1,5), positions = c("QB", "RB"))
Retrieving player data
=================
Scrape Summary:
QB :
Successfully: CBS Average, NFL
Failed: NA
RB :
Successfully: CBS Average, NFL
Failed: NA
Thanks for your help!
Has anyone had issues as of lately with Yahoo? The package has stopped pulling projections from yahoo for all positions. i tried updating the URL and the same result.
Error below:
Empty data table retrieved from
https://football.fantasysports.yahoo.com/f1/52880/players?utmpdku=1&status=A&pos=QB&cut_type=9&stat1=S_PW_13&myteam=0&sort=PTS&sdir=1&count=0
I am getting the same problem.
Hi, every time I try to run a scrape or a projection I get this error message:
Error: 1: failed to load HTTP resource
Any help with this would be appreciated!
manage to load the library but when I try to use the runscrape tool I get this error “Start tag expected, ‘<' not found
Error: 1: Start tag expected, '<' not found"
I have installed all of the packages correctly so I dont understand
Does this package work on Ubuntu server (where x11 is not available)? I was thinking of using this for running scheduled cronjob that scrapes FF data regularly and that obviously will need to use CLI only without even R Studio as well. What do you think @Dennis?
I forgot how I was able to write projections to csv. I wrote:
write.csv(myProjections$projections, file=”c:/projections.csv”, row.names = FALSE)
and I see:
Error in file(file, ifelse(append, “a”, “w”)) :
cannot open the connection
In addition: Warning message:
In file(file, ifelse(append, “a”, “w”)) :
cannot open file ‘c:/projections.csv’: No such file or directory
Any suggestions? Thanks!
This issue is addressed in the “Viewing/Saving the Projections” section.
Oh I think I figured it out. I left out the file= … part and it worked.
I personally had lots of trouble installing the package from the .tar with R-3.4.1, but it worked fine with R-3.3.1. If this is a version compatibility issue, the article should be edited from its current recommendation of the latest version of R.
Hi Logan. Thanks for catching this. We haven’t tested with 3.4.1 yet. We will update as necessary.
While downloading the package on the devtools::install_github(repo = “isaactpetersen/ffanalytics”) step, here is my output.
Downloading GitHub repo isaactpetersen/ffanalytics@master
from URL https://api.github.com/repos/isaactpetersen/ffanalytics/zipball/master
Installing ffanalytics
“C:/PROGRA~1/R/R-34~1.1/bin/x64/R” –no-site-file –no-environ –no-save \
–no-restore –quiet CMD INSTALL \
“C:/Users/Jdpre/AppData/Local/Temp/Rtmps30NEv/devtools17c58a1185d/isaactpetersen-ffanalytics-952873f” \
–library=”C:/Users/Jdpre/Documents/R/win-library/3.4″ –install-tests
* installing *source* package ‘ffanalytics’ …
** R
** data
*** moving datasets to lazyload DB
** inst
** preparing package for lazy loading
Error : .onLoad failed in loadNamespace() for ‘tcltk’, details:
call: inDL(x, as.logical(local), as.logical(now), …)
error: unable to load shared object ‘C:/Program Files/R/R-3.4.1/library/tcltk/libs/x64/tcltk.dll’:
LoadLibrary failure: The specified procedure could not be found.
ERROR: lazy loading failed for package ‘ffanalytics’
* removing ‘C:/Users/Jdpre/Documents/R/win-library/3.4/ffanalytics’
Installation failed: Command failed (1)
> devtools::install_github(repo = “isaactpetersen/ffanalytics”)
Downloading GitHub repo isaactpetersen/ffanalytics@master
from URL https://api.github.com/repos/isaactpetersen/ffanalytics/zipball/master
Installing ffanalytics
“C:/PROGRA~1/R/R-34~1.1/bin/x64/R” –no-site-file –no-environ –no-save \
–no-restore –quiet CMD INSTALL \
“C:/Users/Jdpre/AppData/Local/Temp/Rtmps30NEv/devtools17c319e7c10/isaactpetersen-ffanalytics-952873f” \
–library=”C:/Users/Jdpre/Documents/R/win-library/3.4″ –install-tests
* installing *source* package ‘ffanalytics’ …
** R
** data
*** moving datasets to lazyload DB
** inst
** preparing package for lazy loading
Error : .onLoad failed in loadNamespace() for ‘tcltk’, details:
call: inDL(x, as.logical(local), as.logical(now), …)
error: unable to load shared object ‘C:/Program Files/R/R-3.4.1/library/tcltk/libs/x64/tcltk.dll’:
LoadLibrary failure: The specified procedure could not be found.
ERROR: lazy loading failed for package ‘ffanalytics’
* removing ‘C:/Users/Jdpre/Documents/R/win-library/3.4/ffanalytics’
Installation failed: Command failed (1)
I am on Windows 10. How do I fix this?
Hi Jeff. We will take a look at this. Another user who had the same issue had to revert to R 3.3.1, see https://fantasyfootballanalytics.net/2016/06/ffanalytics-r-package-fantasy-football-data-analysis.html#comment-19684
Version 3.3.3 should be the latest compatible version.
Hi Guys – love the tool but it appears to have a number of errors for me this year. ESPN, Yahoo, Fantasy Pros, Football Guys, and EDS, are all not working and causing error messages during the scrape. I thought it was URL problems, but even after updating them, its persisted. This is just a smattering of it:
Empty data table retrieved from
http://football.fantasysports.yahoo.com/f1/52880/players?&sort=PTS&sdir=1&status=A&pos=TE&cut_type=9&stat1=S_PS_2017&jsenabled=1&count=200
Empty data table retrieved from
http://football.fantasysports.yahoo.com/f1/52880/players?&sort=PTS&sdir=1&status=A&pos=TE&cut_type=9&stat1=S_PS_2017&jsenabled=1&count=225
Got more columns in data than number of columns specified by names from
http://www.foxsports.com/fantasy/football/commissioner/Research/Projections.aspx?page=6&position=16&split=3&playerSearchStatus=1
Removing columns after column 12
Got more columns in data than number of columns specified by names from
http://www.foxsports.com/fantasy/football/commissioner/Research/Projections.aspx?page=8&position=16&split=3&playerSearchStatus=1
Removing columns after column 12
Got more columns in data than number of columns specified by names from
http://www.foxsports.com/fantasy/football/commissioner/Research/Projections.aspx?page=6&position=1&split=3&playerSearchStatus=1
Removing columns after column 12
Got more columns in data than number of columns specified by names from
http://www.foxsports.com/fantasy/football/commissioner/Research/Projections.aspx?page=14&position=1&split=3&playerSearchStatus=1
Removing columns after column 12
Error in sharkSegment[[as.character(srcPeriod@season)]] :
subscript out of bounds
In addition: There were 50 or more warnings (use warnings() to see the first 50)
Wanted to give you the heads up. Thanks again for all your hard work.
I could be wrong, but it looks like you’re using last year’s URL’s. Even if you edited the source file to this year’s URL’s, you probably didn’t rebuild the package and your changes didn’t commit. Try deleting the package and installing a fresh copy from isaactpetersen/ffanalytics.
Thanks Logan. I’ll wipe it all and give it a fresh start and see if that helps.
HELP!
Error: package or namespace load failed for ‘ffanalytics’:
.onLoad failed in loadNamespace() for ‘tcltk’, details:
call: dyn.load(file, DLLpath = DLLpath, …)
error: unable to load shared object ‘/Library/Frameworks/R.framework/Versions/3.4/Resources/library/tcltk/libs/tcltk.so’:
dlopen(/Library/Frameworks/R.framework/Versions/3.4/Resources/library/tcltk/libs/tcltk.so, 10): Library not loaded: /opt/X11/lib/libfontconfig.1.dylib
Referenced from: /usr/local/lib/libtk8.6.dylib
Reason: Incompatible library version: libtk8.6.dylib requires version 11.0.0 or later, but libfontconfig.1.dylib provides version 10.0.0
oh i just saw jeff’s post
Okay R-3.3.1 works fine, definitely don’t use R-3.4.1, at least not on a MacOS
Okay well now I’m getting this message after scraping:
Error: failed to load external entity “http://www.cbssports.com/fantasy/football/draft/averages?&print_rows=9999”
In addition: There were 50 or more warnings (use warnings() to see the first 50)
We’ll look into this, but we’ll need more info to troubleshoot. Could you see the Troubleshooting section of the article to see what info we’d need to help troubleshoot? Thanks.
We just fixed this. You’ll need to download the newest version of the package.
Hey guys
I’m having trouble with RStudio saving the projections to an object. I know I’m running all the code right. The problem is that about 9 out of 10 times, when the projections are finished…I see the object…but then when I click “Done”, there is no “myProjections” object. Sometimes it randomly does work…but it’s not anything different I’m doing. I will just copy and paste the same info, and hope it works that time.
Any ideas?
Here’s the code, it just won’t always save as an object when I click “done” in the pop up. Please help!
myProjections <- getProjections(scrapeData=runScrape(week = 0, season = 2017, analysts = c(-1, 3, 4, 5, 6, 7, 9, 17, 18, 19, 20, 28), positions = c("QB", "RB", "WR", "TE", "K", "DST")), avgMethod = "weighted", leagueScoring = userScoring, vorBaseline, vorType, teams = 12, format = "ppr", mflMocks = 0, mflLeagues = 0, adpSources = c("CBS", "ESPN", "FFC", "MFL", "NFL", "Yahoo"))
Once I get to entering the ffantics package I get an error entry point not found? The procedure entry point deflate set header could not be located in the dynamic link library c:\progra~1\r\r-34~1.1\tcl\bin64\tcl86.dll
Please email me directly
Had the same error–for some reason the new version of R was causing this error. Try downloading an earlier version…that worked for me. I think I ended up using version 3.2.3 https://cran.r-project.org/bin/windows/base/old/3.2.3/
Alright I have everything up and running as expected now – with the exception of being able to scrape from FootballGuys. I am running R 3.3.3 and receiving the following error:
No encoding supplied: defaulting to UTF-8.
Error in doc_parse_raw(x, encoding = encoding, base_url = base_url, as_html = as_html, :
Input is not proper UTF-8, indicate encoding !
Bytes: 0x92 0x73 0x20 0x66 [9]
Any ideas? Thanks!
Getting the exact same error when trying FootballGuys.
Same error for me as Ryan and Nick. I do not see any answer in the thread from FFA yet??? Did I miss the answer or is one coming?
Anyone know why I’m getting this error when calculating?
Calculating Points
Error in calculatePoints(projectionData, scoringRules) :
object ‘userScoring’ not found
I was able to Scrape from several sites.
same issue. just started. code previously worked
Try running the command with “leagueScoring = scoringRules” instead.
Any update with scraping from FootballGuys not working?
Also, question about FantasyPros. When I look at their projections, I’m only seeing 5 sources, CBS, ESPN, FFToday, NumberFire, and STATS. In your app I only see three of those. Do they expand this to your knowledge as the season gets closer? Would it make sense when I scrape to just include FantasysPros but leave out ESPN, FFToday, and CBS?
Something weird is happening with the projections right now. I’m getting numbers in the thousands. Can you please check it? I’ve ran my code three separate times. No idea. I know it’s the correct code. It was working just a few days ago.
Thanks!
Thanks for bringing this to our attention. We believe we have identified the issue and are looking into a solution. For now, if you exclude Yahoo from the sources everything should be working normally.
Thanks Val. Any update on this issue?
Yes, should be fixed now!
Thanks for fixing yahoo!
One small bug I noticed today is that Leonard Fournette isn’t getting scraped, despite his very lofty projections at most sites. He’s not in the playerData data frame; is the solution as simple as adding him there?
I believe he doesn’t have a MFL player ID yet.
Hi Isaac, I appreciate the reply. However, I don’t think that’s correct — his mflId is 13129. You can find him in the xml at http://www03.myfantasyleague.com/2017/export?TYPE=players&L=&W=0&JSON=0&DETAILS=1. I also dug the mflPlayers.R code out of the github and ran it on its own; he *is* found by that process, but still isn’t getting scraped.
Weird one – I wonder what’s going on. He’s the only rookie this is an issue for that I’d found (my search has not been exhaustive, though).
Excuse me, I meant he’s missing an NFL.com ID.
I’m sorry, I’m not trying to be a best, but that can’t be the (exact) problem — his NFL.com ID is 2557973.
I think I’ve isolated the issue in the code, but I can’t figure out 1) why it’s an issue, or 2) how to fix it. Take a look at getPlayerData.R.
I tried running individual pieces of the function, and found where it’s losing him (I used dplyr to filter, so if you’re not a tidyverse guy you’ll have to filter another way).
mfl % filter(player %in% c(‘Leonard Fournette’,’Christian McCaffrey’)) returns two rows, one per player; in both cases, the NFL Id is N/A.
nfl % filter(player %in% c(‘Leonard Fournette’,’Christian McCaffrey’)) also returns two rows, and each player has their correct NFL ID.
allPlayers <- merge(mfl, nfl, by = c("player", "position", "team"),
suffixes = c("", "_nfl"), all.x = TRUE) is the next step; it returns two rows, but in the case of Fournette the playerId_nfl field is while for McCaffrey it’s correct.
I’m not sure what to do about that, but this seems like the central place of issue.
He does have an NFL.com ID but not an NFL.com ID in the MFL database.
Looks like I reached the end of the prior comment depth of the other chain – eeep!
Anyway, I’m not 100% following, because I can’t find any NFL.com IDs for any rookies (but no one else has issues), but you guys know your code better than I do of course.
Regardless, I found a workaround. Use mflPlayers() and nflPlayerData() to get the Fournette data, merge them and isolate him, manually add his NFL id, the rbind him to the playerData table and set the update player option to FALSE when scraping.
New to R and trying to get things setup to try your stuff. I am getting this error installation of package ‘shiny’ had non-zero exit status.
Try installing shiny from source or binaries: https://cran.r-project.org/web/packages/shiny/index.html
Ok got it installed but still cant get ffanalytics to install error below
> devtools::install_github(repo = “isaactpetersen/ffanalytics”)
Downloading GitHub repo isaactpetersen/ffanalytics@master
from URL https://api.github.com/repos/isaactpetersen/ffanalytics/zipball/master
Installing ffanalytics
“C:/PROGRA~1/R/R-33~1.3/bin/x64/R” –no-site-file \
–no-environ –no-save –no-restore –quiet CMD \
INSTALL \
“C:/Users/Zack/AppData/Local/Temp/RtmpeQRO2q/devtools1cbc1d59f6c/isaactpetersen-ffanalytics-dc81c5a” \
–library=”C:/Users/Zack/Documents/R/win-library/3.3″ \
–install-tests
Installation failed: Command failed (65535)
Tried running the command to install everything dont see any errors
I cant get shiny to install please help
Warning in install.packages :
running command ‘”C:/PROGRA~1/R/R-34~1.1/bin/x64/R” CMD INSTALL -l “C:\Users\Zack\Documents\R\win-library\3.4” C:\Users\Zack\AppData\Local\Temp\Rtmp27A7LV/downloaded_packages/shiny_1.0.4.tar.gz’ had status 65535
Warning in install.packages :
installation of package ‘shiny’ had non-zero exit status
Is week 1 of 2017 just not available yet? I dont see it as an option on the online app, and when I try to scrape it using the R package, I get really bogus data for Yahoo, it looks like the columns are shifted weird. I get zero results for ESPN, just a bunch of empty tables, and the QB table from CBS is also empty.
Expected or issues?
How do I cancel my subscription? I believe I’ve been getting charged $5 a month. Thanks!
To cancel you can just click the “Cancel Subscription” button under “My Account” in the app or just let us know (sales@fantasyfootballanalytics.net) and you won’t be billed for the following month.
I’m getting the same error I’ve seen mentioned in previous posts:
Error in unlist(dataCol) : object ‘dataCol’ not found
Any solution for this?
> devtools::install_github(repo = “isaactpetersen/ffanalytics”) Downloading GitHub repo isaactpetersen/ffanalytics@master from URL https://api.github.com/repos/isaactpetersen/ffanalytics/zipball/master Installing ffanalytics “C:/PROGRA~1/R/R-33~1.3/bin/x64/R” –no-site-file \ –no-environ –no-save –no-restore –quiet CMD \ INSTALL \ “C:/Users/Zack/AppData/Local/Temp/RtmpeQRO2q/devtools1cbc1d59f6c/isaactpetersen-ffanalytics-dc81c5a” \ –library=”C:/Users/Zack/Documents/R/win-library/3.3″ \ –install-tests Installation failed: Command failed (65535) Tried running the command to install everything dont see any errors
Can anyone help with above error
I am getting high projections for week 1. Not sure what’s going on. I was able to get what I expect for it to show previously; but successive runs show higher projections.
Scrape Summary shows that some sites failed. Most of this came up with warnings like “Got more columns than specified names” or “Empty data set retrieved”, even though there were data if going to the links manually:
Empty data table retrieved from
http://www.fftoday.com/rankings/playerwkproj.php?Season=2017&GameWeek=1&LeaugeID=1&PosID=30&cur_page=2
Empty data table retrieved from
http://www.fantasyfootballnerd.com/service/weekly-projections/xml//QB/1
=================
Scrape Summary:
QB :
Successfully: Yahoo Sports, NFL, FOX Sports, FFToday, FantasyPros, FantasySharks
Failed: CBS Average, ESPN, FantasyFootballNerd
RB :
Successfully: CBS Average, Yahoo Sports, NFL, FOX Sports, FFToday, FantasyPros, FantasySharks
Failed: ESPN, FantasyFootballNerd
WR :
Successfully: CBS Average, Yahoo Sports, NFL, FOX Sports, FFToday, FantasyPros, FantasySharks
Failed: ESPN, FantasyFootballNerd
TE :
Successfully: CBS Average, Yahoo Sports, NFL, FOX Sports, FFToday, FantasyPros, FantasySharks
Failed: ESPN, FantasyFootballNerd
K :
Successfully: CBS Average, Yahoo Sports, NFL, FOX Sports, FFToday, FantasyPros, FantasySharks
Failed: FantasyFootballNerd
DST :
Successfully: CBS Average, Yahoo Sports, NFL, FOX Sports, FantasySharks
Failed: FFToday, FantasyFootballNerd
player position team points lower
1 Dwayne Washington RB DET 284.4036 254.97000
2 Ty Montgomery RB GB 269.5904 185.55000
3 Tyler Ervin RB HOU 258.7602 258.00000
4 Fozzy Whittaker RB CAR 238.9750 213.05000
5 Darren Sproles RB PHI 230.9936 173.16288
6 Corey Grant RB JAC 230.5328 197.31000
7 Duke Johnson RB CLE 207.4581 131.37639
8 T.J. Logan RB ARI 191.4000 191.40000
9 LeVeon Bell RB PIT 159.3635 0.00000
10 David Johnson RB ARI 158.2778 22.23278
11 Chris Thompson RB WAS 158.0041 100.97000
12 Ezekiel Elliott RB DAL 156.6869 16.74521
13 Melvin Gordon RB LAC 133.0402 13.68000
14 Devonta Freeman RB ATL 129.0280 14.93639
15 LeSean McCoy RB BUF 123.4349 14.56278
16 DeMarco Murray RB TEN 121.1005 13.16000
17 Jordan Howard RB CHI 117.8661 14.90639
18 Todd Gurley RB LAR 114.9501 12.94719
19 Kareem Hunt RB KC 113.4309 9.93000
20 Marshawn Lynch RB OAK 111.9485 10.82483
upper positionRank dropoff tier
1 324.8521 1 20.2282398 1
2 394.3487 2 20.7228335 1
3 259.4146 3 23.7759628 2
4 274.1008 4 8.2117422 3
5 316.3288 5 11.9981242 3
6 273.4587 6 31.1038024 3
Removing Yahoo from the analyst did the trick but when I was doing another round for another league, some of the DST projections are high.
This package is amazing – thank you so much for the work you have done to make it available. I noticed that I think the Yahoo DST rankings are adding the LA Rams and LA Chargers projections together.
As a workaround, I have been dropping Yahoo projections for the LA teams DST:
la_teams <- c("Rams","Chargers")
fullseason.proj <- fullseason.proj[-which(fullseason.proj$player %in% la_teams &
fullseason.proj$analyst == 3),]
Hey Isaac, first of all I want to thank you for taking the time to create this amazing tool for fantasy! It’s awesome. I seem to be getting an error though when I run calculate projection from Rstudio. The error is: “Error in `[.data.table`(rankTable, , c(“player”, “position”, “team”, “avgRank”, :
column(s) not found: position, team
In addition: There were 50 or more warnings (use warnings() to see the first 50)”,
Do you have any idea of why this might be?
Thanks,
Joe
I’m getting the same error, started last week. I have not had any luck tracking it down, but it looks like its happening in the getRanks.R
Hi there, have you resolved your problem? I’m also getting same error.
Hi, I’ve been reviewing your work for some time now and I think what you have here is great I have been attempting to use it for my own project. I am having problems implementing two of the functions from this package. runScrape and getProjections. My goal is to pull the projected fantasy points from each engine for every week of the season and output it into an excel file. I am able to do this successfully with this code here:
> library(“ffanalytics”)
> setwd(“C:/Users/Adam/terror12/FLEX/ffanalytics”)
> data 2017
> 1
> 2
> 1 2 3 4 5 6
> getProjections(scrapeData = data, writeFile = TRUE)
This successfully outputs a file for 2017, week 1, Yahoo, with all positions I am asking for QB, RB, WR, TE, K, DST
I can very the success that these positions were called from the output of runscrape
Scrape Summary:
QB :
Successfully: Yahoo Sports
Failed: NA
RB :
Successfully: Yahoo Sports
Failed: NA
WR :
Successfully: Yahoo Sports
Failed: NA
TE :
Successfully: Yahoo Sports
Failed: NA
K :
Successfully: Yahoo Sports
Failed: NA
DST :
Successfully: Yahoo Sports
Failed: NA
The issue I have come across is that this will only work for some Analysts on some weeks, more often then not the output of runScrape will look like this.
Scrape Summary:
QB :
Successfully:
Failed: Yahoo Sports
RB :
Successfully:
Failed: Yahoo Sports
WR :
Successfully:
Failed: Yahoo Sports
TE :
Successfully:
Failed: Yahoo Sports
K :
Successfully: Yahoo Sports
Failed: NA
DST :
Successfully: Yahoo Sports
Failed: NA
I have seen numerous different warnings after runScrape, but it doesnt seem to throw any hard errors, it just appears that it is saying that data doesnt exist for some reason. I am not sure how to get around this.
I am really only concerned with pulling in the projections from all of the Analysts, is there a better way to do that then what I am doing here? Are there any steps needed to get around something like this. My goal is to have every projection from every platform for the entire year. Any help would be great, or even just pointing me in the right direction would be a awesome!
Thank you for your time
Hi all,
I just wanted to update my comment. I have been able to successfully scrape and get the projections for Yahoo and NFL.com for all of the 2017 season. My goal is to do this all the way through till at least the 2012 season.
So far the data I have been calling in from any year previous to 2017 has been incomplete. I believe the 2017 data has been called in through the websites that are currently active on these platforms, but not all of these platforms hold their recent years projections, so when the ffanalytics tools tries to scrape the webpage of a previous year it doesn’t have the data to read.
I am wondering if there is an archive of some sort or a different strategy to pull in data from previous years. I have read that there could be issues with past data. Any information on this would be greatly appreciated.
Thank you
You can’t download prior years using scraping because other websites don’t store prior years. For how to download historical data, see here:
https://fantasyfootballanalytics.net/about-the-site/faq#download
Thank you for the response! I have followed your links and was able to secure historical projection data for previous years as a whole.
For my purpose I am looking for projections broken down from week to week. Throughout my search I have seen others that have this same problem. I have been looking for archives that hold this type of data and have not come across it, I am wondering if anyone out there has found archives of different platform’s historical weekly projection data. I have found weekly historically projection data of Fan Duel through rotoguru1.com. Although the platforms such as Yahoo, ESPN and NFL.com will only show projection data as of the most current year.
Thank you for your time.
Hi Adam,
I’m trying to do something similar to your for a class project, but keep encountering errors here. I was wondering if you’d be able to share the data you were able to pull for 2016 and 2017?
Thanks
As noted in the above article, “Note that historical data scrapes are nearly impossible to do as sites usually don’t store their historical projections. For historical data scrapes, the projections will not be current and the scrape may fail due to missing data. If you want to download historical projections, use our Projections tool.”
You can download historical weekly projections using the Projections tool: https://fantasyfootballanalytics.net/about-the-site/faq#download
Hi Isaac,
Thanks for the reply. I tried use your projections tool from the start, but it does not seem to be working. The instructions are different from the actual site, as it seems you’ve changed your format.
The instructions say to click on “Change Data Settings” but there is no such button that I see. What I have been doing is clicking on “Settings” and then “General Settings” and then changing to the week/year/provider (E.g. 2016, Week 1, ESPN, all offensive players) that I want. But, when I click to save my changed settings and all the data reloads, it always just shows the current week (2017 week 15). I must have tried this 20 different ways now, but I can’t get it to show anything but this weeks data for download. I’ve been able to download data no problem, but it’s always only the current week.
We aren’t able to reproduce. Could you try the following steps, and if it still isn’t working, please provide the requested info:
https://fantasyfootballanalytics.net/about-the-site/faq#errors
Hi Issac,
Thank you for sending me the link to the projection application and for reassuring my belief that sites do not store their historical projections. I have been working several different angles with the fantasy football analytics app. I have been following the conversation between you and Giles and have run into many of the same issues that Giles has.
Link to Download Our Fantasy Football Projections https://fantasyfootballanalytics.net/2016/06/download-projections.html
I have run through this document and have not been able to successfully bring up data for different weeks of the season. The problem I am having is that no matter what configuration I give in the General Settings it always comes out to display the current week (for 2017 it is week 15) all other seasons show just the most recent week of data, no matter what week I select.
I then went to the document for troubleshooting the issue.
https://fantasyfootballanalytics.net/about-the-site/faq#errors
I ran through steps 1-7 in order
1. Disabled ad blockers and script blockers
2. Verified ad blockers are OFF: success
3. Verified Javascript is working: success
4. Cleared browser cache
5. Logged out of the application then logged back in
6. Tried a new browser (Google Chrome Incognito Mode, Microsoft Edge)
7. Tried a different computer
– Computer 1:
– Dell Latitude
– OS: Windows 10 (Google Chrome Incognito), Linux ran
through Virtual Box (Firefox)
– Computer 2:
– Lenovo T470s
– Linux (Firefox)
After completing this troubleshooting I came across the exact same problem regardless of the machine I was using or operating system. This makes me wonder what exactly you guys use to run this application. What machine, operating system, and browser are you using when you attempt to reproduce this error?
I have also supplied a few things that I noticed in the GUI that could be considered.
Documentation Discrepancies:
Step 2. a. Click “Change Data Settings” (top left of the page).
The document refers to a button that is called Change Data Settings located at the top left of the page above the table, but the version of the GUI that I am seeing has no such button. In order to make changes to the current configuration I have to click Setting -> General Settings which brings up options to select many different configuration settings. Either the button Change Data Settings should be on the page, or the Documentation could be updated to reflect what is being seen on the page.
Bug:
I didn’t come across this bug until I had finished the 7 troubleshooting steps, I went back to the app to test if these fixes had worked and I saw this.
After clicking Settings -> General Settings, and editing the configuration I was not able to click the buttons Cancel or Save Settings. These buttons appeared on the screen but were not clickable with a curser I was able to click on the boxes used to edit the configuration and then from there use tab to navigate toward the bottom of the page and click enter to press the Save Settings button. This eventually still led to the problem that no matter what week was selected only the most current week of that season appeared.
Thank you for your time looking this over, I have also posted this on this page as well.
https://fantasyfootballanalytics.net/2013/09/win-your-fantasy-football-snake-draft.html
Thank you,
Adam Scerra
Also Giles I am more then happy to share the data that I pulled for the 2017 season. I have not been able to pull data from the 2016 season as of yet. In a previous post I stated that I had full season weekly projections for Yahoo and NFL.com. Although after further analysis I realized the NFL data was incomplete.
After some digging I found that there is a bug that when they put someone on the IR it completely wipes out their projected points for the whole season even for the weeks they were active. I have filed a ticket to their website and hopefully it gets fixed soon.
Long story short I can send you the complete weekly projections for Yahoo.com if you would give me an e-mail to send it to.
Could you try again? We updated the app. Also, are you sure you have an account? We don’t see your email as having an account in our database. If you’re still having an issue, it’d be helpful for us to see a screencast of the issue you’re experiencing.
I wonder if this might have something to do with adblocker extensions? I disabled Adblocker Plus in Chrome just now, and the `General Settings` modal seems to be working normally. Might be worth checking whether you’re using an adblocker, and if disabling it on our app helps fix the problem(s).
Another idea if that still doesn’t do the trick: there’s an extension for Chrome called “iFrame Allow” which allows all websites to be displayed in iFrames within Chrome: https://chrome.google.com/webstore/detail/iframe-allow/gifgpciglhhpmeefjdmlpboipkibhbjg?hl=en
Maybe worth a shot if disabling the adblocker doesn’t work.
Hi Isaac,
I have been having trouble getting my replies to post on any of these pages, once I make a reply nothing shows up, yet when I try to enter the reply again it says that I have already made that post although I cant see it show up on your site. If there is an e-mail I can reach you at or any way that we can communicate so that I could show you the screencast that I took it would be greatly appreciated.
Thank you for your time,
Adam Scerra
I think your comment was automatically flagged for spam because of its length. I found it and un-marked it as spam. Sorry for the trouble, and thanks for the screencast. We’ll look into this.
Hi Adam,
I believe we identified the issue and fixed it. Could you try again?
Thanks!
-Isaac
Hi Isaac,
Great job with the fix! I appreciate you looking into this, although I have come across another road block. I am now able to select any week available from the drop down menu and view the data that I am after under the Table tab, yet when I go to click the blue download button at the top right of the table my cursor appears to be a red crossed circle and I am not able to click the button to download the data table. I have tried this with the most recent week, week 17 and the download button is clickable and I can download the data table as a csv file. I have ran through the 7 trouble shooting steps that we have gone through before and I came out with the same result I have attached another screencast to better explain this situation.
http://youtu.be/12sxwoReaqk?hd=1
Thank you for your continued help.
Hi Adam,
That’s by design:
https://fantasyfootballanalytics.net/about-the-site/faq#historicalProjections
-Isaac
Ahh I see, that makes sense, I have purchased my subscription and can not be happier with this apps service. Thank you for help along the way.
When I try to install i get ERROR: loading failed for ‘i386? What is this issue
Here’s what I find when I google the error. You might try these:
https://support.rstudio.com/hc/en-us/articles/203775903-Fixing-startup-error-where-manipulate-and-rstudio-packages-will-not-install-with-networked-drives
https://stackoverflow.com/questions/14755033/r-custom-package-install-from-file-error?utm_medium=organic&utm_source=google_rich_qa&utm_campaign=google_rich_qa
If those don’t work. We’ll need more info in order to troubleshoot. Which version of R, RStudio, OS, you’re using, what line of code you’re using, and the whole console output.
Question, RSelenium has been archived by CRAN, and net new installs do not work. Will there be updates to the package?
I just tried to install this a few days ago as well and had the same issue.
same here
I had the same issue as well: “ERROR: dependency ‘RSelenium’ is not available for package ‘ffanalytics’
* removing ‘C:/Users/mattbu/Documents/R/win-library/3.5/ffanalytics’
In R CMD INSTALL
Installation failed: Command failed (1)” Are there are any workarounds for this issue at this time?
I had the same issue as well; are there any workarounds at this time? “ERROR: dependency ‘RSelenium’ is not available for package ‘ffanalytics’
…”
Hi all,
We are aware of this issue, and are developing alternative methods that don’t depend on the RSelenium package.
Cheers,
Isaac
Hi, is there any update on this issue?
Hi Isaac – I appear to have the package running in RStudio (v 1.1.453) but when I run a data scrape I get an error that the directory/file ffanalytics pulls from is unavailable:
> myScrapeData <- runScrape(week = 0, season = 2018, analysts = c(5), positions = c("QB", "RB", "WR", "TE", "K", "DST", "DL", "LB", "DB"), fbgUser = NULL, fbgPwd = NULL)
Retrieving player data
No such file or directoryfailed to load external entity "http://football.myfantasyleague.com/2018/export?TYPE=players&L=&W=0&JSON=0&DETAILS=1"
Error: 1: No such file or directory2: failed to load external entity "http://football.myfantasyleague.com/2018/export?TYPE=players&L=&W=0&JSON=0&DETAILS=1"
Is this just due to the time of year, or something else? My league plans to draft for the preseason, so we are about a month out. I'm early, but trying to get everything working. Thanks! : )
The package isn’t yet updated for the 2018 sources, but we’re working on it! The specific error is occurring when trying to retrieve player data from MyFantasyLeague.com.
-Isaac
Thanks, Isaac! I suspected this might be the answer. I’ll try again in another few weeks – now that I at least have the packages running, I feel more confident. 🙂
You guys have done some great work with the R package over the past years, do you have a timeline on when it will be updated for the 2018 season to adjust for the changes on MyFantansyLeague.com? Thanks again!
You guys have done some great work with the R package over the past years, do you have a timeline on when it will be updated for the 2018 season? Thanks again!
Listening on http://127.0.0.1:5727
> myScrapeData <- runScrape(week = 0, season = 2017, analysts = c(-1, 3, 4, 5, 6, 7, 9, 17, 18, 19, 20, 28, 30), positions = c("WR"), fbgUser = NULL, fbgPwd = NULL)
Retrieving player data
No such file or directoryfailed to load external entity "http://football.myfantasyleague.com/2017/export?TYPE=players&L=&W=0&JSON=0&DETAILS=1"
Error: 1: No such file or directory2: failed to load external entity "http://football.myfantasyleague.com/2017/export?TYPE=players&L=&W=0&JSON=0&DETAILS=1"
The above error gets generated for 2017 sources as well. Assuming this is because, as you say in the article, historical projections are not obtainable.
Hello Isaac, I have followed the steps to installing, but when I try to install the ffanalytics R package, I get this error:
The procedure entry point deflateSetHeader could not be located in the dynamic link library C:\PROGRA~1\R\R-35~1.0\Tcl\bin64\tcl86.dll
Below is the information within the R console:
Downloading GitHub repo isaactpetersen/ffanalytics@master
from URL https://api.github.com/repos/isaactpetersen/ffanalytics/zipball/master
Installing ffanalytics
“C:/PROGRA~1/R/R-35~1.0/bin/x64/R” –no-site-file –no-environ –no-save \
–no-restore –quiet CMD INSTALL \
“C:/Users/nromanas/AppData/Local/Temp/Rtmpywifz2/devtools23f43c503c5d/isaactpetersen-ffanalytics-2078a5e” \
–library=”C:/Users/nromanas/Documents/R/win-library/3.5″ –install-tests
* installing *source* package ‘ffanalytics’ …
** R
** data
*** moving datasets to lazyload DB
** inst
** byte-compile and prepare package for lazy loading
Error : .onLoad failed in loadNamespace() for ‘tcltk’, details:
call: inDL(x, as.logical(local), as.logical(now), …)
error: unable to load shared object ‘C:/Program Files/R/R-3.5.0/library/tcltk/libs/x64/tcltk.dll’:
LoadLibrary failure: The specified procedure could not be found.
ERROR: lazy loading failed for package ‘ffanalytics’
* removing ‘C:/Users/nromanas/Documents/R/win-library/3.5/ffanalytics’
In R CMD INSTALL
Installation failed: Command failed (1)
I found a copy of the “tcl86.dll” file online and wrote over the original, but the problem is still there.
Any help would be appreciated.
Thank you,
Nick
I got the same error, which makes me feel a little better (I suppose). I wonder if it’s at all related to the subscription status of ffanalytics, where you now have to pay for the api.
Awesome package, I’ve used it for the past 2 drafts and ended up winning the league last year! Just looking to install on my new laptop. Thanks for the great work Isaac!
We are aware of this error and are working on updating the package for this season! The R package is free and not tied to the API (which is more for developers)!
I found that the issue seemed to be with the newest versions of R (3.5.1). Running v3.3.3 the package installed no problem.
Though as others mentioned, the package won’t really work anyway until it’s updated, as it fails when trying to retrieve player data from MyFantasyLeague.com.
Any thoughts on when we might see that 2018 update? My draft is coming up soon and I’m trying to Moneyball the hell out of my league 3 years in a row.
For those that want to install RSelenium — you can use devtools to install it:
devtools::install_github(“ropensci/RSelenium”)
Is there any update on if the package is ready to be used for 2018 data? Used this last year and absolutely loved it
Does this new version of the package still have the GUI? I’m not seeing the typical button you could hit to run it.
No, but our webapps have a GUI!
https://apps.fantasyfootballanalytics.net/
I received error in the R Console:
Error: cannot allocate vector of size 4.0 Gb
Steps I took:
1. install.packages(“devtools”)
2. library(devtools)
3. install_github(“FantasyFootballAnalytics/ffanalytics”)
4. library(“ffanalytics”)
5. my_scrape <- scrape_data(src = c("CBS", "ESPN", "FantasyData", "FantasyPros", "FantasySharks", "FFToday","FleaFlicker", "NumberFire", "Yahoo", "FantasyFootballNerd", "NFL","RTSports","Walterfootball"), pos = c("QB", "RB", "WR", "TE", "K", "DST"), season = 2018, week = 0)
6. my_projections <- projections_table(my_scrape)
7. error above
Did I do something wrong? Thanks!
I suggest trying to remove FantasyPros, FantasyData and FantasyFootballNerd from the src list and see if that resolves the issue.
I’ve intermittently gotten this error and an allocation error when trying to go through projections
Error in right_join_impl(x, y, by_x, by_y, aux_x, aux_y, na_matches) : std::bad_alloc
have tried cutting down size of table join by removing sources suggested by Dennis, as well as cutting positions down to only QB/RB/TE/WR, but still no dice. very open to helping debug this with whatever extra info might be needed!
This was due to players listed at different positions with different projections at FantasyPros. The package has been updated to handle this, please install the updated version and try again
still getting the error seemingly with the newer release of the 2018 package, except this time it’s saying can’t allocate vector of size 6.0 GB
hey all, got the new package up and runnings without too much trouble, but when I try to go and create my projections, I get an allocation error when it tries to do the large join of all the sources I’ve picked (everything except fantasydata).
Error in inner_join_impl(x, y, by_x, by_y, aux_x, aux_y, na_matches) : std::bad_alloc
Workstation has 16GB of RAM so I’m not exactly sure what the problem could be, but would you recommend just cutting down on the number of sources I’m pulling until it goes through?
This was due to players listed at different positions with different projections at FantasyPros. The package has been updated to handle this, please install the updated version and try again
Are there plans to allow for weekly data when using the scrape functions? If I use week=1 I get an error…possibly too early for this, or user error?
Trying to run just snake draft with no regard for auction value or cost, just VOR.
Why is still optimizing based on cost?
It sounds like you’re using the Lineup Optimizer (https://apps.fantasyfootballanalytics.net/?app=lineupoptimizer). The Lineup Optimizer isn’t for snake drafts. It’s for auction drafts (https://fantasyfootballanalytics.net/2013/06/win-your-fantasy-football-auction-draft.html) and DFS leagues (https://fantasyfootballanalytics.net/2016/09/win-daily-fantasy-dfs-league-lineup-optimizer.html).
If you’re doing a snake draft (https://fantasyfootballanalytics.net/2013/09/win-your-fantasy-football-snake-draft.html), you’ll want to use the Projections Tool instead:
https://apps.fantasyfootballanalytics.net/
I am in the Projections Tool and I am not seeing a VOR column. Has something changed since yesterday?
There is no VOR for weekly data. Change it to seasonal data to see VOR.
When will the ffanalytics package be updated for R version 3.5.1?
Hello. First, this is f’ing awesome. Thank you. Two small requests from someone who learned stats in SAS and now has a data analyst at work who does all of our R work 🙂 1) Could you post the script that generates the very pretty weekly projections graph that you have on the site? I would like to make my own from time to time. 2) Is there a documentation manual beyond the page linked on the site? For example, currently I am scraping from just three sites. I suspect that you defined more than that, but I am not sure which ones and what the correct pointer is (for example “ESPN” clearly goes to ESPN.com and “YAHOO” to yahoo. Which others have you defined? THANKS!
Is there any way to access the actual fantasy score per player for weeks already past? Since the Id is unique to ffanalytics, it’s fault ridden to line up the data scrubbed from Fantasy Data etc.
When I scrape the data it gives me an error that says data not found then does not let me run the projections. Do you have any tips to help me make it work, its for extra credit in my r course and I was wondering if it does not work because its the off season. Thank you
Looking to use your stuff to build a dataset for my final project for my machine learning class. My goal is to use the historical projections to predict player performance (and if I have time/bandwidth I’d like to add a simulation element to take into account the weekly sit/start decisions. Would love to find out if there are certain variables that mean even though a player doesn’t have the highest projected stats, he’s more valuable for a fantasy team.)
What is the best way to build a complete dataset of everything available? Can I just run something like:
“season = c(2014:2018), week = c(0:16)”? or do I need to execute an actual loop?
Also, what if I want to add variables to the weekly data like the vegas line on the game, or the team’s W/L record?
Any other tips for my (probably overambitious) project?
Have googled everything I could to find out how to fix this and nothing seems to work.
Does anyone know what is causing this error after running devtools::install_github(repo = “FantasyFootballAnalytics/ffanalytics”, build_vignettes = TRUE) ?
. . .
preparing ‘ffanalytics’: (393ms)
√ checking DESCRIPTION meta-information …
– installing the package to build vignettes (474ms)
E creating vignettes (43.5s)
— re-building ‘scoring_settings.Rmd’ using rmarkdown
pandoc.exe: \\: openBinaryFile: does not exist (No such file or directory)
Error: processing vignette ‘scoring_settings.Rmd’ failed with diagnostics:
pandoc document conversion failed with error 1
— failed re-building ‘scoring_settings.Rmd’
SUMMARY: processing the following file failed:
‘scoring_settings.Rmd’
Error: Vignette re-building failed.
Execution halted
Error: Failed to install ‘ffanalytics’ from GitHub:
System command error, exit status: 1, stderr empty
I’ve used R before and I’m pretty sure I have every package I need installed, but still can’t get this to work.
Hey Isaac, I love this site and the apps that you’ve published. I am trying to view projections for Cincinnati WR Damion Willis, but I can’t find any in any of the apps. He is reported to be in the starting lineup tomorrow. Is there a fix in for this?
Hi Isaac, I’m starting to work with R in FF analytics and love your package! When I follow the steps mentioned above
my_scrape <- scrape_data(src = c("CBS"),
pos = c("QB", "RB", "WR", "TE", "DST"),
season = 2018, week = 0)
my_projections <- projections_table(my_scrape)
I get the error "Error in rowSums(., na.rm = TRUE) : 'x' must be numeric"
I'd love to work with the package to do some analysis for my German Fantasy Football Podcast (and give u some credits in it 😉 ).
Any advice on how to solve the problem? Tried to remove some sources this and that, nothing worked 🙁
Best regards from Germany, Christian
Hey Isaac! I discovered this FF Analytics R package a couple of weeks ago and have been messing around with it because I’m very interested in using R for some FF analyses. I’m fairly new to using R, but I’ve received a number of errors when using some of the functions. It’s mostly errors when I try scraping projections for example, I get the following error when trying to scrape 2020 QB projections from FantasyPros using the srape_data function:
Error: Can’t subset columns that don’t exist.
x The columns `player` and `team` don’t exist.
I’ve tried diagnosing them myself to see if it something in the backend code that I could fix, but my skills aren’t quite advanced enough to understand all the nuances of the code listed on your github. I wonder if there plan on being any updates made to the package this offseason? Thanks!
We’re in the process of updating the webapps for the next season. We haven’t updated the package for 2020 projections yet because most sites don’t have 2020 projections, but it’s on our to-do list!
Any chance she’s ready this week?
They’re up!
Though I ask for several sources to be scraped using the code above described above, the My_scrape tibble seems to only have the CBS source?
my_scrape <- scrape_data(src = c("CBS", "ESPN", "Yahoo"),
pos = c("QB", "RB", "WR", "TE", "DST"),
season = 2018, week = 0)
I would like to use multiple sources. What am I doing wrong?
Whenever I run the command for anything other than “CBS”, nothing is scraped. I wonder if the URLs need updating in ffanalytics?
Input:
my_scrape<-scrape_data(
src = c("ESPN"),
pos = c("QB", "RB", "WR", "TE", "K", "DST"),
season = 2020,
week = 1
)
Output:
Scraping QB projections from
Scraping RB projections from
Scraping WR projections from
Scraping TE projections from
Scraping K projections from
Scraping DST projections from
if I use "CBS", this is the output:
Scraping QB projections from
https://www.cbssports.com/fantasy/football/stats/QB/2020/1/projections/nonppr
Scraping RB projections from
https://www.cbssports.com/fantasy/football/stats/RB/2020/1/projections/nonppr
Scraping WR projections from
https://www.cbssports.com/fantasy/football/stats/WR/2020/1/projections/nonppr
Scraping TE projections from
https://www.cbssports.com/fantasy/football/stats/TE/2020/1/projections/nonppr
Scraping K projections from
https://www.cbssports.com/fantasy/football/stats/K/2020/1/projections/nonppr
Scraping DST projections from
https://www.cbssports.com/fantasy/football/stats/DST/2020/1/projections/nonppr
Hey Isaac,
I’ve been having a few troubles adding info to the projections table.
1. With add_adp() I’m getting the error message “Error in UseMethod(“html_table”) : no applicable method for ‘html_table’ applied to an object of class “xml_missing”
I’ve searched for solutions to this problem, and most sources I’ve found indicate it’s an issue of single vs double quotes. I’ve tried manually including source with both formats, though, and I keep getting the same error.
2. with add_uncertainty() I’m getting the error “object ‘sd_ecr’ not found.” However, when I check the data table manually, sd_ecr is one of the column labels. Is this an issue of which sources I’m including? Or is it more likely due to something going wrong in my code?
Thanks for creating and maintaining this package! I appreciate your work!
Please post a GitHub issue: https://github.com/FantasyFootballAnalytics/ffanalytics/issues. Thanks!
Hi Isaac,
When do you expect the 2023 projections to be out? I appreciate you taking the time to do this, thanks.
Soon, thanks!
They’re live!
Quick Question
Do you know if Yahoo or ESPN sell their Historical Data for Fantasy Football?
I’m not sure, but I doubt it. We have obtained projections from sources through APIs and/or via scraping. We have historical projections going back to 2008: https://fantasyfootballanalytics.net/about-the-site/faq#historicalProjections. You can download historical projections using our webapp.