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"
When I run the functions
get_trackingorget_all_trackingI'm returned the error[1] "Can't convert `replace` <double> to match type of `data` <character>."The problem stems from the internal call tocheck_if_numeric.Here's code to make this reproducible.
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_ifis 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 Rutlilspackage 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.convertworked for me.