Title: | Creating Publication Data Visualization Dashboards |
---|---|
Description: | Package to facilitate the creation of data visualization dashboards through the flexdashboard and openalexR packages. |
Authors: | Rémi Thériault [aut, cre] |
Maintainer: | Rémi Thériault <[email protected]> |
License: | GPL (>= 3) |
Version: | 0.0.1 |
Built: | 2024-09-08 19:13:12 UTC |
Source: | https://github.com/rempsyc/pubDashboard |
Add regions to pubDashboard dataframe
add_region(data, progress_bar = FALSE)
add_region(data, progress_bar = FALSE)
data |
The dataframe on which to add region. |
progress_bar |
Logical, whether to print a progress bar. |
## Not run: x <- fetch_openalex_pubs(journal_name = "Collabra", pages = 1, per_page = 1) x <- add_region(x) names(x) ## End(Not run)
## Not run: x <- fetch_openalex_pubs(journal_name = "Collabra", pages = 1, per_page = 1) x <- add_region(x) names(x) ## End(Not run)
Clean dataframe, for names of journals and continents
clean_journals_continents(data, progress_bar = FALSE)
clean_journals_continents(data, progress_bar = FALSE)
data |
The processed dataframe of data |
progress_bar |
Logical, whether to print a progress bar. |
## Not run: x <- fetch_openalex_pubs(journal_name = "Collabra", pages = 1, per_page = 1) x <- clean_journals_continents(x) names(x) ## End(Not run)
## Not run: x <- fetch_openalex_pubs(journal_name = "Collabra", pages = 1, per_page = 1) x <- clean_journals_continents(x) names(x) ## End(Not run)
countrycode
List of countries taken from the package countrycode
countries
countries
A vector of class character containing country names.
Detect missing journals
detect_missing_journals(data)
detect_missing_journals(data)
data |
The processed dataframe of data |
Generate a dygraph of journal paper percentages, by country and year
dygraph_year(data, level = "continent")
dygraph_year(data, level = "continent")
data |
The processed dataframe of data |
level |
Level of analysis, either country or continent |
## Not run: data <- fetch_openalex_pubs(journal_name = "Collabra", pages = 1) data <- clean_journals_continents(data) dygraph_year(data) dygraph_year(data, "country") ## End(Not run)
## Not run: data <- fetch_openalex_pubs(journal_name = "Collabra", pages = 1) data <- clean_journals_continents(data) dygraph_year(data) dygraph_year(data, "country") ## End(Not run)
openalexR
Downloads relevant publication data using openalexR
fetch_openalex_pubs( journal_name = NULL, journal_id = NULL, clean_journals_continents = FALSE, progress_bar = FALSE, verbose = TRUE, ... )
fetch_openalex_pubs( journal_name = NULL, journal_id = NULL, clean_journals_continents = FALSE, progress_bar = FALSE, verbose = TRUE, ... )
journal_name |
The list of desired journals (by journal name). |
journal_id |
The list of desired journals (by OpenAlex ID). |
clean_journals_continents |
Logical, whether to also process the dataframe with the clean_journals_continents function. It is set to FALSE by default because on large datasets it can be very time consuming. |
progress_bar |
Logical, whether to print a progress bar. |
verbose |
Passed to |
... |
Arguments passed to |
As recommended by the authors of the openalexR
package,
Before we go any further, we highly recommend you set openalexR.mailto
option so that your requests go to the polite pool for faster response times.
If you have OpenAlex Premium, you can add your API key to the
openalexR.apikey
option as well. These lines best go into .Rprofile with
file.edit("~/.Rprofile")
.
options(openalexR.mailto = "[email protected]") options(openalexR.apikey = "EXAMPLE_APIKEY")"
## Not run: x <- fetch_openalex_pubs(journal_name = "Collabra", pages = 1, per_page = 1) names(x) # Same as: x <- fetch_openalex_pubs(journal_id = "S4210175756", pages = 1, per_page = 1) names(x) ## End(Not run)
## Not run: x <- fetch_openalex_pubs(journal_name = "Collabra", pages = 1, per_page = 1) names(x) # Same as: x <- fetch_openalex_pubs(journal_id = "S4210175756", pages = 1, per_page = 1) names(x) ## End(Not run)
List of academic journals and corresponding fields
journal_field
journal_field
A data frame with 25 rows and 3 variables:
academic journal
abbreviation of the journal name
the OpenAlex ID
the field of research
Whether it is part of one of the six original journals
...
Read local pubDashboard data files and bind them in a single dataframe
read_bind_all_data(data_folder = "data", check_duplicate = FALSE)
read_bind_all_data(data_folder = "data", check_duplicate = FALSE)
data_folder |
The folder in which the data lives |
check_duplicate |
whether to check article ids with rempsyc::best_duplicate |
Render complete pubDashboard dashboard
render_dashboard( file_name = "dashboard", title = "title", author = "author", journal_name = NULL, journal_id = NULL, data_folder = "data", tab_continent = TRUE, tab_continent_year = TRUE, tab_continent_journal = TRUE, tab_country = TRUE, tab_country_journal = TRUE, tab_psychology = FALSE, tab_economics = FALSE, tab_general = FALSE, tab_figure1 = FALSE, tab_missing = TRUE, ... )
render_dashboard( file_name = "dashboard", title = "title", author = "author", journal_name = NULL, journal_id = NULL, data_folder = "data", tab_continent = TRUE, tab_continent_year = TRUE, tab_continent_journal = TRUE, tab_country = TRUE, tab_country_journal = TRUE, tab_psychology = FALSE, tab_economics = FALSE, tab_general = FALSE, tab_figure1 = FALSE, tab_missing = TRUE, ... )
file_name |
Desired file name. |
title |
Desired dashboard title. |
author |
Desired displayed dashboard author. |
journal_name |
The list of desired journals (by journal name). |
journal_id |
The list of desired journals (by OpenAlex ID). |
data_folder |
Folder where to save the data. |
tab_continent |
Whether to render the "Continent" tab. |
tab_continent_year |
Whether to render the "Continent by year" tab. |
tab_continent_journal |
Whether to render the "Continent by journal" tab. |
tab_country |
Whether to render the "Country" tab. |
tab_country_journal |
Whether to render the "Country by journal" tab. |
tab_psychology |
Whether to render the "Psychology" tab. |
tab_economics |
Whether to render the "Economics" tab. |
tab_general |
Whether to render the "General" tab. |
tab_figure1 |
Whether to render the "Figure 1" tab. |
tab_missing |
Whether to render the "Missing" tab. |
... |
Arguments passed to |
## Not run: render_dashboard( file_name = "my_dashboard", title = "Wonderful Dashboard", author = "Rémi Thériault", journal_name = c("Journal of Personality and Social Psychology", "Health Psychology"), from_publication_date = "2024-01-01", tab_figure1 = TRUE ) ## End(Not run)
## Not run: render_dashboard( file_name = "my_dashboard", title = "Wonderful Dashboard", author = "Rémi Thériault", journal_name = c("Journal of Personality and Social Psychology", "Health Psychology"), from_publication_date = "2024-01-01", tab_figure1 = TRUE ) ## End(Not run)
Generate table of journal paper percentages, by continent and year
scatter_continent_year( data, method = "lm", ymin = 0, ymax = 100, yby = 20, plotly = TRUE, citation = NULL, citation_size = 15, text_size = NULL, height = NULL, ... )
scatter_continent_year( data, method = "lm", ymin = 0, ymax = 100, yby = 20, plotly = TRUE, citation = NULL, citation_size = 15, text_size = NULL, height = NULL, ... )
data |
The processed dataframe of data |
method |
Which method to use for the regression line, either "lm" (default) or "loess" |
ymin |
Minimum value for y-axis |
ymax |
Maximum value for y-axis |
yby |
Tick increments for y-axis |
plotly |
Logical, whether to use plotly for dynamic data visualization |
citation |
Optionally, a citation to add as a footer |
citation_size |
Font size of the citation |
text_size |
Size of the element_text ggplot2 element |
height |
Height argument of plotly::ggplotly |
... |
Further arguments passed to rempsyc::nice_scatter |
## Not run: data <- fetch_openalex_pubs(journal_name = "Collabra", pages = 1) data <- clean_journals_continents(data) scatter_continent_year(data) ## End(Not run)
## Not run: data <- fetch_openalex_pubs(journal_name = "Collabra", pages = 1) data <- clean_journals_continents(data) scatter_continent_year(data) ## End(Not run)
Generate table of journal paper percentages, by continent and year
scatter_country_year( data, method = "lm", ymin = 0, ymax = 100, yby = 20, plotly = TRUE, citation = NULL, citation_size = 15, text_size = NULL, height = NULL, ... )
scatter_country_year( data, method = "lm", ymin = 0, ymax = 100, yby = 20, plotly = TRUE, citation = NULL, citation_size = 15, text_size = NULL, height = NULL, ... )
data |
The processed dataframe of data |
method |
Which method to use for the regression line, either "lm" (default) or "loess". |
ymin |
Minimum value for y-axis |
ymax |
Maximum value for y-axis |
yby |
Tick increments for y-axis |
plotly |
Logical, whether to use plotly for dynamic data visualization. |
citation |
Optionally, a citation to add as a footer. |
citation_size |
Font size of the citation. |
text_size |
Size of the element_text ggplot2 element |
height |
Height argument of plotly::ggplotly |
... |
Further arguments passed to rempsyc::nice_scatter |
## Not run: data <- fetch_openalex_pubs(journal_name = "Collabra", pages = 1) data <- clean_journals_continents(data) suppressWarnings(scatter_country_year(data)) ## End(Not run)
## Not run: data <- fetch_openalex_pubs(journal_name = "Collabra", pages = 1) data <- clean_journals_continents(data) suppressWarnings(scatter_country_year(data)) ## End(Not run)
Generate table of journal paper percentages, by continent and year
scatter_figure1(data, method = "lm", original = TRUE, plotly = TRUE, ...)
scatter_figure1(data, method = "lm", original = TRUE, plotly = TRUE, ...)
data |
The processed dataframe of data |
method |
Which method to use for the regression line, either "lm" (default) or "loess". |
original |
Logical; if |
plotly |
Logical, whether to use plotly for dynamic data visualization. |
... |
Further arguments passed to rempsyc::nice_scatter |
## Not run: journals <- c("Developmental Psychology", "Journal of Personality and Social Psychology", "Journal of Abnormal Psychology", "Journal of Family Psychology", "Health Psychology", "Journal of Educational Psychology" ) data <- fetch_openalex_pubs(journal_name = journals, pages = 10) data <- clean_journals_continents(data) scatter_figure1(data) ## End(Not run)
## Not run: journals <- c("Developmental Psychology", "Journal of Personality and Social Psychology", "Journal of Abnormal Psychology", "Journal of Family Psychology", "Health Psychology", "Journal of Educational Psychology" ) data <- fetch_openalex_pubs(journal_name = journals, pages = 10) data <- clean_journals_continents(data) scatter_figure1(data) ## End(Not run)
Generate table of journal paper percentages, by continent and year
scatter_journal_year( data, method = "lm", ymin = 0, ymax = 100, yby = 20, plotly = TRUE, citation = NULL, citation_size = 15, ncol = 4, ... )
scatter_journal_year( data, method = "lm", ymin = 0, ymax = 100, yby = 20, plotly = TRUE, citation = NULL, citation_size = 15, ncol = 4, ... )
data |
The processed dataframe of data |
method |
Which method to use for the regression line, either "lm" (default) or "loess" |
ymin |
Minimum value for y-axis |
ymax |
Maximum value for y-axis |
yby |
Tick increments for y-axis |
plotly |
Logical, whether to use plotly for dynamic data visualization |
citation |
Optionally, a citation to add as a footer |
citation_size |
Font size of the citation |
ncol |
How many columns for ggplot2::facet_wrap |
... |
Further arguments passed to rempsyc::nice_scatter |
## Not run: data <- fetch_openalex_pubs(journal_name = "Collabra", pages = 1) data <- clean_journals_continents(data) scatter_journal_year(data) ## End(Not run)
## Not run: data <- fetch_openalex_pubs(journal_name = "Collabra", pages = 1) data <- clean_journals_continents(data) scatter_journal_year(data) ## End(Not run)
Generate table of journal paper percentages, by continent
table_continent(data, datatable = TRUE)
table_continent(data, datatable = TRUE)
data |
The processed dataframe of data |
datatable |
Whether to output a DT::datatable HTML table widget instead of a regular dataframe (defaults to TRUE). |
## Not run: data <- fetch_openalex_pubs(journal_name = "Collabra", pages = 1) data <- clean_journals_continents(data) table_continent(data) ## End(Not run)
## Not run: data <- fetch_openalex_pubs(journal_name = "Collabra", pages = 1) data <- clean_journals_continents(data) table_continent(data) ## End(Not run)
Generate table of journal paper percentages, by continent and journals
table_continent_journal(data, datatable = TRUE)
table_continent_journal(data, datatable = TRUE)
data |
The processed dataframe of data |
datatable |
Whether to output a DT::datatable HTML table widget instead of a regular dataframe (defaults to TRUE). |
## Not run: data <- fetch_openalex_pubs(journal_name = "Collabra", pages = 1) data <- clean_journals_continents(data) table_continent_journal(data) ## End(Not run)
## Not run: data <- fetch_openalex_pubs(journal_name = "Collabra", pages = 1) data <- clean_journals_continents(data) table_continent_journal(data) ## End(Not run)
Generate table of journal paper percentages, by continent and year
table_continent_year(data, datatable = TRUE)
table_continent_year(data, datatable = TRUE)
data |
The processed dataframe of data |
datatable |
Whether to output a DT::datatable HTML table widget instead of a regular dataframe (defaults to TRUE). |
## Not run: data <- fetch_openalex_pubs(journal_name = "Collabra", pages = 1) data <- clean_journals_continents(data) table_continent_year(data) ## End(Not run)
## Not run: data <- fetch_openalex_pubs(journal_name = "Collabra", pages = 1) data <- clean_journals_continents(data) table_continent_year(data) ## End(Not run)
Generate table of journal paper percentages, by country
table_country(data, datatable = TRUE)
table_country(data, datatable = TRUE)
data |
The processed dataframe of data |
datatable |
Whether to output a DT::datatable HTML table widget instead of a regular dataframe (defaults to TRUE). |
## Not run: data <- fetch_openalex_pubs(journal_name = "Collabra", pages = 1) data <- clean_journals_continents(data) table_country(data) ## End(Not run)
## Not run: data <- fetch_openalex_pubs(journal_name = "Collabra", pages = 1) data <- clean_journals_continents(data) table_country(data) ## End(Not run)
Generate table of journal paper percentages, by continent and year
table_country_journal(data, datatable = TRUE)
table_country_journal(data, datatable = TRUE)
data |
The processed dataframe of data |
datatable |
Whether to output a DT::datatable HTML table widget instead of a regular dataframe (defaults to TRUE). |
## Not run: data <- fetch_openalex_pubs(journal_name = "Collabra", pages = 1) data <- clean_journals_continents(data) table_country_journal(data) ## End(Not run)
## Not run: data <- fetch_openalex_pubs(journal_name = "Collabra", pages = 1) data <- clean_journals_continents(data) table_country_journal(data) ## End(Not run)
Generate table of journal paper percentages, by country and year
table_country_year(data, datatable = TRUE)
table_country_year(data, datatable = TRUE)
data |
The processed dataframe of data |
datatable |
Whether to output a DT::datatable HTML table widget instead of a regular dataframe (defaults to TRUE). |
## Not run: data <- fetch_openalex_pubs(journal_name = "Collabra", pages = 1) data <- clean_journals_continents(data) table_country_year(data) ## End(Not run)
## Not run: data <- fetch_openalex_pubs(journal_name = "Collabra", pages = 1) data <- clean_journals_continents(data) table_country_year(data) ## End(Not run)
Count number of papers per journal, with year range
table_journal_count(data, datatable = TRUE)
table_journal_count(data, datatable = TRUE)
data |
The processed dataframe of data |
datatable |
Whether to output a DT::datatable HTML table widget instead of a regular dataframe (defaults to TRUE). |
## Not run: data <- fetch_openalex_pubs(journal_name = "Collabra", pages = 1) data <- clean_journals_continents(data) table_journal_count(data) ## End(Not run)
## Not run: data <- fetch_openalex_pubs(journal_name = "Collabra", pages = 1) data <- clean_journals_continents(data) table_journal_count(data) ## End(Not run)
Generate table of journal paper percentages, by journal, continent and year
table_journal_year(data, datatable = TRUE)
table_journal_year(data, datatable = TRUE)
data |
The processed dataframe of data |
datatable |
Whether to output a DT::datatable HTML table widget instead of a regular dataframe (defaults to TRUE). |
## Not run: data <- fetch_openalex_pubs(journal_name = "Collabra", pages = 1) data <- clean_journals_continents(data) table_journal_year(data) ## End(Not run)
## Not run: data <- fetch_openalex_pubs(journal_name = "Collabra", pages = 1) data <- clean_journals_continents(data) table_journal_year(data) ## End(Not run)
Generate table of journal paper percentages, by country
table_missing_country(data, datatable = TRUE)
table_missing_country(data, datatable = TRUE)
data |
The processed dataframe of data |
datatable |
Whether to output a DT::datatable HTML table widget instead of a regular dataframe (defaults to TRUE). |
## Not run: data <- fetch_openalex_pubs(journal_name = "Collabra", pages = 1) data <- clean_journals_continents(data) data[1, c(4, 6)] <- NA table_missing_country(data) ## End(Not run)
## Not run: data <- fetch_openalex_pubs(journal_name = "Collabra", pages = 1) data <- clean_journals_continents(data) data[1, c(4, 6)] <- NA table_missing_country(data) ## End(Not run)
Obtained from GitHub, and then modified with minor improvements and more universities.
universities
universities
A data frame with 9420 rows and 2 variables:
the country code
the university
...
https://raw.githubusercontent.com/endSly/world-universities-csv/master/world-universities.csv
countrycode
List of US states taken from the package countrycode
us_states
us_states
A data frame with 50 rows and 3 variables:
the name of the state
the name of the abbreviation
the regex for that state
...
Generate a waffle chart of journal paper percentages, by continent (each square = 1% of data)
waffle_continent(data, citation = NULL, citation_size = NULL)
waffle_continent(data, citation = NULL, citation_size = NULL)
data |
The processed dataframe of data |
citation |
Optionally, a citation to add as a footer. |
citation_size |
Font size of the citation. |
## Not run: data <- fetch_openalex_pubs(journal_name = "Journal of Economic Psychology", pages = 1) data <- clean_journals_continents(data) waffle_continent(data) ## End(Not run)
## Not run: data <- fetch_openalex_pubs(journal_name = "Journal of Economic Psychology", pages = 1) data <- clean_journals_continents(data) waffle_continent(data) ## End(Not run)
Generate a waffle chart of journal paper percentages, by continent (each square = 1% of data)
waffle_continent_journal( data, citation = NULL, citation_size = NULL, journal_abbreviation = TRUE )
waffle_continent_journal( data, citation = NULL, citation_size = NULL, journal_abbreviation = TRUE )
data |
The processed dataframe of data |
citation |
Optionally, a citation to add as a footer. |
citation_size |
Font size of the citation. |
journal_abbreviation |
Logical, whether to use the journal abbreviation to fit the entire plot, otherwise some journal names can be quite long and accordingly be cropped. |
## Not run: data <- fetch_openalex_pubs(journal_name = "Collabra", pages = 1) data <- clean_journals_continents(data) waffle_continent_journal(data) ## End(Not run)
## Not run: data <- fetch_openalex_pubs(journal_name = "Collabra", pages = 1) data <- clean_journals_continents(data) waffle_continent_journal(data) ## End(Not run)
Generate a waffle plot made of country flags
waffle_country(data, citation = NULL, citation_size = NULL)
waffle_country(data, citation = NULL, citation_size = NULL)
data |
The processed dataframe of data |
citation |
Optionally, a citation to add as a footer. |
citation_size |
Font size of the citation. |
## Not run: data <- fetch_openalex_pubs(journal_name = "Collabra", pages = 1) data <- clean_journals_continents(data) waffle_country(data) ## End(Not run)
## Not run: data <- fetch_openalex_pubs(journal_name = "Collabra", pages = 1) data <- clean_journals_continents(data) waffle_country(data) ## End(Not run)
Generate a waffle chart of journal paper percentages, by continent (each square = 1% of data)
waffle_country_journal( data, citation = NULL, citation_size = NULL, journal_abbreviation = TRUE )
waffle_country_journal( data, citation = NULL, citation_size = NULL, journal_abbreviation = TRUE )
data |
The processed dataframe of data |
citation |
Optionally, a citation to add as a footer. |
citation_size |
Font size of the citation. |
journal_abbreviation |
Logical, whether to use the journal abbreviation to fit the entire plot, otherwise some journal names can be quite long and accordingly be cropped. |
## Not run: data <- fetch_openalex_pubs(journal_name = "Collabra", pages = 1) data <- clean_journals_continents(data) waffle_country_journal(data) ## End(Not run)
## Not run: data <- fetch_openalex_pubs(journal_name = "Collabra", pages = 1) data <- clean_journals_continents(data) waffle_country_journal(data) ## End(Not run)
maps
List of world capitals taken from the package maps
world_capitals
world_capitals
A data frame with 259 rows and 6 variables:
the name of the capital
the country of the capital
population of the capital
latitude of the capital
longitude of the capital
whether it is a capital
...