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

Return data slots #87

Merged
merged 32 commits into from
Jun 10, 2022
Merged

Return data slots #87

merged 32 commits into from
Jun 10, 2022

Conversation

damianooldoni
Copy link
Collaborator

This PR has the goal to solve #84 by changing the output returned by indicator_total_year and indicator_introduction_year functions. Instead of returning a plot (with or without facting) now the functions return a list with three slots:

  1. plot slot containing the plot as before
  2. data_top_graph, the data.frame used in the top graph, i.e. the global plot
  3. data_facet_graph, the data.frame used in the facet graph, i.e. the plot below the global one, showing the faceting

As this update can break code, this is a major change and so I bumped the version to 2.0.0.

Some minor changes:

  1. Improved documentation: typo, removing warnings while reading example text files
  2. using pkgname::func_name for some functions (see Adapt Roxygen documentation by using pkgname::func_name everywhere #86)
  3. Replace superseded dplyr functions such rename_at() or mutate_all()
  4. Replace deprecated dplyr function distinct_()

@damianooldoni
Copy link
Collaborator Author

@SanderDevisscher: there are strange issues while installing dependencies on Win and macOS machines in automatic checks (see the GitHub actions in the box). However this shouldn't be a problem for you to review the PR. So, do it whenever you want it. Meanwhile, I will try to solve these check related issues.

@damianooldoni
Copy link
Collaborator Author

Temp solution: win and mac operative systems removed from automatic checks.

Copy link
Contributor

@SanderDevisscher SanderDevisscher left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@damianooldoni I think you currently export the wrong dataframe in the data_top_graph slot for indicator_total_year. It now contains these columns year , key, kingdom & first_observed. Can you check this ?

@damianooldoni
Copy link
Collaborator Author

Function indicator_total_year() returns the internal defined df_extended in slot data_top_graph, see L227 and L200.
This data.frame is used in L180(https://github.com/trias-project/trias/blob/return-data-slots/R/indicator_total_year.R#L180) to generate top_graph.

What I see is that I use ggplot2::geom_line(stat = "count") for the top graph, while for facet graph I group first and then I use ggplot2::geom_line(stat = "identity"). I suppose you want data_top_graph looking something like:

year n
1900 2
1902 5
... ...

Is this what you want?

@SanderDevisscher
Copy link
Contributor

Function indicator_total_year() returns the internal defined df_extended in slot data_top_graph, see L227 and L200. This data.frame is used in L180(https://github.com/trias-project/trias/blob/return-data-slots/R/indicator_total_year.R#L180) to generate top_graph.

What I see is that I use ggplot2::geom_line(stat = "count") for the top graph, while for facet graph I group first and then I use ggplot2::geom_line(stat = "identity"). I suppose you want data_top_graph looking something like:

year n
1900 2
1902 5
... ...
Is this what you want?

that is exactly what I want ;-)

@SanderDevisscher
Copy link
Contributor

@damianooldoni should I wait for all checks to finish before merging or does it not matter ?

@damianooldoni
Copy link
Collaborator Author

Well, a good rule is to wait for it. Just to be 100% sure. But, if you have urgent need, merge. Still, it hsould not take so much time more.

@SanderDevisscher
Copy link
Contributor

I'll wait

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

Successfully merging this pull request may close these issues.

2 participants