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

object ‘Teams’ is not exported by 'namespace:Lahman' #67

Open
darh78 opened this issue May 8, 2023 · 6 comments
Open

object ‘Teams’ is not exported by 'namespace:Lahman' #67

darh78 opened this issue May 8, 2023 · 6 comments

Comments

@darh78
Copy link

darh78 commented May 8, 2023

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.

@friendly
Copy link
Collaborator

friendly commented May 8, 2023

How are you referencing the Teams data in your package?

data(Teams, package = "Lahman") works for me.

@friendly
Copy link
Collaborator

friendly commented May 8, 2023

In your code at line 146, how about :::

team_palette <- Lahman:::Teams

@darh78
Copy link
Author

darh78 commented May 9, 2023

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 ✔

@friendly
Copy link
Collaborator

friendly commented May 9, 2023

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

@darh78
Copy link
Author

darh78 commented May 10, 2023

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.

@beanumber
Copy link

I don't think data frames are "exported" by packages. Using the triple colon notation feels like the right solution to me.

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

3 participants