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

type.convert error for get_league_teams_stats and get_players_seasons_stats #7

Closed
leobeta92 opened this issue Aug 23, 2019 · 2 comments

Comments

@leobeta92
Copy link


The type.convert function for the two functions above throws up an error that the first argument must be of mode character. Is there an additional package needed or an issue with my operating system?

All functions in team.R and players.R give me the same error. Except for get_team_meta().

library(reprex)
library(understatr)
league_data <- get_league_teams_stats(league_name = "EPL", year = 2018)
Error in type.convert(teams_df) : 
  the first argument must be of mode character
player_data <- get_player_stats(player_id = 882)
Error in get_player_stats(player_id = 882) : 
  could not find function "get_player_stats"
player_data <- get_player_matches_stats(player_id = 882)
Error in type.convert(player_data) : 
  the first argument must be of mode character
Sys.info()
                                                                                           sysname 
                                                                                          "Darwin" 
                                                                                           release 
                                                                                          "18.6.0" 
                                                                                           version 
"Darwin Kernel Version 18.6.0: Thu Apr 25 23:16:27 PDT 2019; root:xnu-4903.261.4~2/RELEASE_X86_64" 
                                                                                          nodename 
                                                                                        "---" 
                                                                                           machine 
                                                                                          "x86_64" 
                                                                                             login 
                                                                                             "--" 
                                                                                              user 
                                                                                             "--" 
                                                                                    effective_user 
                                                                                             "--" 


@ewenme ewenme closed this as completed in e2bc4e2 Aug 27, 2019
@ewenme
Copy link
Owner

ewenme commented Aug 27, 2019

huh. I haven't been able to recreate the error in my own session, but I have edited type.convert calls to use the as.is argument to prevent coercing of characters into factors. Hopefully this will solve the issue, try re-installing the package and see if it's fixed.

@leobeta92
Copy link
Author

cheers man, I see what as.is would do. Unfortunately, it kept happening even after reinstalling. When I remove the type.convert from your function, it works. But, obviously the numeric columns remain characters. Adding rows to type.convert the numeric layers works, too. I think it's the player_name and player_id column.

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