55# ' @keywords internal
66
77GenTimeTrend <- function (idata , hist_col , axis_txt_lim = 60 ) {
8- # bind variables locally to function
9- idata <- hist_col <- axis_txt_lim <- NULL
10-
118 UseMethod(" GenTimeTrend" , object = idata [hist_col ][[1 ]])
129}
1310
11+ # ' Create Histogram from dataset - default method
12+ # ' @method GenTimeTrend default
13+ # ' @export
14+ # ' @keywords internal
1415GenTimeTrend.default <- function (idata , hist_col , axis_txt_lim = 60 ) {
1516 gttmp <- ggplot2 :: ggplot(idata , ggplot2 :: aes_string(x = hist_col )) +
1617 ggplot2 :: geom_bar(
@@ -19,7 +20,10 @@ GenTimeTrend.default <- function(idata, hist_col, axis_txt_lim = 60) {
1920 fill = " dodger blue"
2021 ) +
2122 ggplot2 :: labs(y = " Studies" ) +
22- ggplot2 :: scale_x_discrete(name = paste(hist_col ), labels = function (x ) substr(x , 1 , axis_txt_lim )) +
23+ ggplot2 :: scale_x_discrete(
24+ name = paste(hist_col ),
25+ labels = function (x ) substr(x , 1 , axis_txt_lim )
26+ ) +
2327 ggplot2 :: theme_bw() +
2428 ggplot2 :: theme(
2529 axis.line = ggplot2 :: element_line(colour = " black" ),
@@ -31,12 +35,21 @@ GenTimeTrend.default <- function(idata, hist_col, axis_txt_lim = 60) {
3135 # Rotate xaxis label if too many categories
3236 if (dplyr :: n_distinct(idata [hist_col ]) > 15 ) {
3337 gttmp <- gttmp + ggplot2 :: theme(
34- axis.text.x = ggplot2 :: element_text(angle = 40 , hjust = 0.95 , size = 12 )
38+ axis.text.x = ggplot2 :: element_text(
39+ angle = 40 ,
40+ hjust = 0.95 ,
41+ size = 12
42+ )
3543 )
3644 }
3745 gttmp
3846}
3947
48+ # ' Create Histogram from dataset - numeric column
49+ # ' @method GenTimeTrend numeric
50+ # ' @export
51+ # ' @keywords internal
52+
4053GenTimeTrend.numeric <- function (idata , hist_col , axis_txt_lim = 60 ) {
4154 ggplot2 :: ggplot(idata , ggplot2 :: aes_string(x = hist_col )) +
4255 ggplot2 :: geom_bar(
0 commit comments