This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| install.packages("ggtext") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| install.packages("mdthemes") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| plot + mdthemes::as_md_theme(theme_minimal()) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| plot + | |
| labs( | |
| x = "**Year**", | |
| y = "Revenue (*Billion* USD)", | |
| caption = "Data Source: *en.wikipedia.org/wiki/List_of_largest_biomedical_companies_by_revenue*" | |
| ) + | |
| mdthemes::md_theme_minimal() | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| plot + mdthemes::md_theme_minimal() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| plot + theme_minimal() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <span style = 'color:color name or hex code'>Text you want to color</span> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| library(ggplot2) | |
| library(dplyr) | |
| data(biomedicalrevenue, package = "ggcharts") | |
| plot <- biomedicalrevenue %>% | |
| filter(company %in% c("Roche", "Novartis")) %>% | |
| ggplot(aes(year, revenue, color = company)) + | |
| geom_line(size = 1.2) + | |
| ggtitle( | |
| paste0( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| do_if <- function(data, predicate, expr) { | |
| if (predicate) { | |
| eval.parent(insert_data( | |
| substitute(expr), | |
| substitute(data) | |
| )) | |
| } else { | |
| data | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| `:=` <- function(lhs, rhs) { | |
| var <- deparse(substitute(lhs)) | |
| if (exists(var, parent.frame(), inherits = FALSE)) { | |
| stop("Variable `", var, "` is already defined.", call. = FALSE) | |
| } else { | |
| assign(var, rhs, parent.frame()) | |
| } | |
| } | |
| # An alternative version making use of `lockBinding`. This prevents users from overwriting |
NewerOlder