patrickchodowski / nbar Goto Github PK
View Code? Open in Web Editor NEWR package to interact with NBA api
R package to interact with NBA api
.
When I run the functions get_tracking
or get_all_tracking
I'm returned the error [1] "Can't convert `replace` <double> to match type of `data` <character>."
The problem stems from the internal call to check_if_numeric
.
Here's code to make this reproducible.
library(NBAr)
get_tracking(season = 2023, type = "Player", measure_type = "Passing",
date_from = "02/07/2024", date_to = "02/07/2024")
When the function encounters a column that is all character data (e.g., player names) you'll get an error here, instead of a warning, due to the way it's used.
I would be remiss not to mention that mutate_if
is deprecated, as well.
Although I did not explore all the ways this function is used, I was curious as to why type.convert()
from the R utlils
package wasn't used instead. (There may be a very good reason for that!)
I didn't do anything that I would consider a thorough examination, but using type.convert
worked for me.
df3 <- data.frame(a = c("10", NA, 4), b = LETTERS[1:3], c = c(29, "2", 1)) %>% type.convert(as.is = T)
> lapply(df3, typeof)
$a
[1] "integer"
$b
[1] "character"
$c
[1] "integer"
Amazing package. But I noticed the package automatically converts numbers to integers dropping the decimal points, which is making working with averages sort of tricky and also causing many variables (ex PIE and Freq) to appear as 0, especially with single digit percentages. For example, team shotclock FG Freq is 4%, but stored as 0.04 in the raw data is converting it to 0.
Title is self-explanatory - Version control of .Rhistory is useless.
I've created appropriate pull request.
Conversions from double to integer causing all data in player season usage tables (get_general("player", measure_type = "usage") ) to return all 0's . If I may , I would probably suggest to just let it return numbers as double and remove the integer conversions and leave it up to the users to convert on the front end if they wish. It would just save you a great deal of headaches.
Otherwise, still loving the package! By far the best NBA api wrapper in R.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.