Lahman
Lahman copied to clipboard
object ‘Teams’ is not exported by 'namespace:Lahman'
Hello Lahman contributors,
I'm developing an R package (bbgraphsR) that uses the Teams dataframe from your package in one of my functions (viz_standings), but either when running devtools::load_all() or devtools::check(), I receive the following warning:
Warning: object ‘Teams’ is not exported by 'namespace:Lahman'
I indeed checked the NAMESPACE file and it makes sense because there is no line exporting that table.
In that case, can I save the table data and use it in my package? Or is it expected to export that table in the future?
Thanks in advance for your feedback.
Regards.
Daniel.
How are you referencing the Teams data in your package?
data(Teams, package = "Lahman") works for me.
In your code at line 146, how about :::
team_palette <- Lahman:::Teams
In your code at line 146, how about
:::
team_palette <- Lahman:::Teams
Hello @friendly,
Thanks for your prompt reply. I've tried both of your proposals but I get the same error (after those modifications):
> devtools::load_all()
ℹ Loading bbgraphsR
Warning messages:
1: object ‘Teams’ is not exported by 'namespace:Lahman'
2: object ‘teamcolors’ is not exported by 'namespace:teamcolors'
> devtools::document()
ℹ Updating bbgraphsR documentation
ℹ Loading bbgraphsR
Warning messages:
1: object ‘Teams’ is not exported by 'namespace:Lahman'
2: object ‘teamcolors’ is not exported by 'namespace:teamcolors'
> devtools::check()
══ Documenting ═══════════════════════════════════════════════════════════════════════════════════════════════════════════════
ℹ Updating bbgraphsR documentation
ℹ Loading bbgraphsR
Warning: object ‘Teams’ is not exported by 'namespace:Lahman'
Warning: object ‘teamcolors’ is not exported by 'namespace:teamcolors'
.......
❯ checking whether package 'bbgraphsR' can be installed ... ERROR
See below...
── Install failure ───────────────────────────────────────────────────────────────────────────────────────────────────────────
* installing *source* package 'bbgraphsR' ...
** using staged installation
** R
** data
*** moving datasets to lazyload DB
** byte-compile and prepare package for lazy loading
Error: object 'Teams' is not exported by 'namespace:Lahman'
Execution halted
ERROR: lazy loading failed for package 'bbgraphsR'
* removing 'C:/Users/darh78/AppData/Local/Temp/RtmpQrQFVH/file31482be37450/bbgraphsR.Rcheck/bbgraphsR'
1 error ✖ | 0 warnings ✔ | 0 notes ✔
I still don't understand the source of this problem, but you might check out how this is handled in some other packages that suggest / depend on Lahman. There is nothing (no code) I can see on your Github site, so I don't think I can help further
Reverse suggests: | baseballDBR, broom, dbplyr, dplyr, ibawds, implyr, mdsr, pinnacle.data, raw, sparklyr, teamcolors
Thanks for your support anyway. I do not know neither where the root cause of the issue.
Meanwhile, I've just implemented a workaround to solve the error:
Teams_Lahman <- read.csv("data/Teams.csv")[ , -1]
team_palette <- Teams_Lahman |>
dplyr::filter(yearID == 2021) |>
dplyr::select(name, teamIDBR)
I've just exported the Teams dataframe to a .csv and saved it in my data folder, then imported in the function.
I don't think data frames are "exported" by packages. Using the triple colon notation feels like the right solution to me.