Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

errors from functions I've tried include get_tracking and get_all_tracking - errors due to check_if_numeric #9

Open
fraupflaume opened this issue May 2, 2024 · 1 comment

Comments

@fraupflaume
Copy link

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"
@PatrickChodowski
Copy link
Owner

Hello, thank you for the issue and thorough review! I have to admit the package is kind of abandoned since I stopped using R and importing the data myself. I guess its good time to refresh it a bit - I will have a look and try to fix the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants