@@ -438,10 +438,10 @@ srv_a_pca <- function(id, data, reporter, filter_panel_api, dat, plot_height, pl
438438 selector_list = selector_list ,
439439 datasets = data
440440 )
441-
441+ qenv <- teal.code :: eval_code(data(), " library('ggplot2') " )
442442 anl_merged_q <- reactive({
443443 req(anl_merged_input())
444- data() %> %
444+ qenv %> %
445445 teal.code :: eval_code(as.expression(anl_merged_input()$ expr ))
446446 })
447447
@@ -585,12 +585,12 @@ srv_a_pca <- function(id, data, reporter, filter_panel_api, dat, plot_height, pl
585585 theme = list (
586586 legend.position = " right" ,
587587 legend.spacing.y = quote(grid :: unit(- 5 , " pt" )),
588- legend.title = quote(element_text(vjust = 25 )),
588+ legend.title = quote(ggplot2 :: element_text(vjust = 25 )),
589589 axis.text.x = substitute(
590- element_text(angle = angle_value , hjust = hjust_value ),
590+ ggplot2 :: element_text(angle = angle_value , hjust = hjust_value ),
591591 list (angle_value = angle_value , hjust_value = hjust_value )
592592 ),
593- text = substitute(element_text(size = font_size ), list (font_size = font_size ))
593+ text = substitute(ggplot2 :: element_text(size = font_size ), list (font_size = font_size ))
594594 )
595595 )
596596
@@ -615,24 +615,24 @@ srv_a_pca <- function(id, data, reporter, filter_panel_api, dat, plot_height, pl
615615 )
616616
617617 cols <- c(getOption(" ggplot2.discrete.colour" ), c(" lightblue" , " darkred" , " black" ))[1 : 3 ]
618- elbow_plot <- ggplot(mapping = aes_string(x = " component" , y = " value" )) +
619- geom_bar(
620- aes(fill = " Single variance" ),
618+ elbow_plot <- ggplot2 :: ggplot(mapping = aes_string(x = " component" , y = " value" )) +
619+ ggplot2 :: geom_bar(
620+ ggplot2 :: aes(fill = " Single variance" ),
621621 data = dplyr :: filter(elb_dat , metric == " Proportion of Variance" ),
622622 color = " black" ,
623623 stat = " identity"
624624 ) +
625- geom_point(
626- aes(color = " Cumulative variance" ),
625+ ggplot2 :: geom_point(
626+ ggplot2 :: aes(color = " Cumulative variance" ),
627627 data = dplyr :: filter(elb_dat , metric == " Cumulative Proportion" )
628628 ) +
629- geom_line(
630- aes(group = 1 , color = " Cumulative variance" ),
629+ ggplot2 :: geom_line(
630+ ggplot2 :: aes(group = 1 , color = " Cumulative variance" ),
631631 data = dplyr :: filter(elb_dat , metric == " Cumulative Proportion" )
632632 ) +
633633 labs +
634- scale_color_manual(values = c(" Cumulative variance" = cols [2 ], " Single variance" = cols [3 ])) +
635- scale_fill_manual(values = c(" Cumulative variance" = cols [2 ], " Single variance" = cols [1 ])) +
634+ ggplot2 :: scale_color_manual(values = c(" Cumulative variance" = cols [2 ], " Single variance" = cols [3 ])) +
635+ ggplot2 :: scale_fill_manual(values = c(" Cumulative variance" = cols [2 ], " Single variance" = cols [1 ])) +
636636 ggthemes +
637637 themes
638638 },
@@ -660,9 +660,9 @@ srv_a_pca <- function(id, data, reporter, filter_panel_api, dat, plot_height, pl
660660
661661 dev_ggplot2_args <- teal.widgets :: ggplot2_args(
662662 theme = list (
663- text = substitute(element_text(size = font_size ), list (font_size = font_size )),
663+ text = substitute(ggplot2 :: element_text(size = font_size ), list (font_size = font_size )),
664664 axis.text.x = substitute(
665- element_text(angle = angle_val , hjust = hjust_val ),
665+ ggplot2 :: element_text(angle = angle_val , hjust = hjust_val ),
666666 list (angle_val = angle , hjust_val = hjust )
667667 )
668668 )
@@ -692,15 +692,15 @@ srv_a_pca <- function(id, data, reporter, filter_panel_api, dat, plot_height, pl
692692 y = sin(seq(0 , 2 * pi , length.out = 100 ))
693693 )
694694
695- circle_plot <- ggplot(pca_rot ) +
696- geom_point(aes_string(x = x_axis , y = y_axis )) +
697- geom_label(
698- aes_string(x = x_axis , y = y_axis , label = " label" ),
695+ circle_plot <- ggplot2 :: ggplot(pca_rot ) +
696+ ggplot2 :: geom_point(ggplot2 :: aes_string(x = x_axis , y = y_axis )) +
697+ ggplot2 :: geom_label(
698+ ggplot2 :: aes_string(x = x_axis , y = y_axis , label = " label" ),
699699 nudge_x = 0.1 , nudge_y = 0.05 ,
700700 fontface = " bold"
701701 ) +
702- geom_path(aes(x , y , group = 1 ), data = circle_data ) +
703- geom_point(aes(x = x , y = y ), data = data.frame (x = 0 , y = 0 ), shape = " x" , size = 5 ) +
702+ ggplot2 :: geom_path(ggplot2 :: aes(x , y , group = 1 ), data = circle_data ) +
703+ ggplot2 :: geom_point(ggplot2 :: aes(x = x , y = y ), data = data.frame (x = 0 , y = 0 ), shape = " x" , size = 5 ) +
704704 labs +
705705 ggthemes +
706706 themes
@@ -794,7 +794,7 @@ srv_a_pca <- function(id, data, reporter, filter_panel_api, dat, plot_height, pl
794794 pca_plot_biplot_expr <- c(
795795 pca_plot_biplot_expr ,
796796 substitute(
797- geom_point(aes_string(x = x_axis , y = y_axis ), data = pca_rot , alpha = alpha , size = size ),
797+ ggplot2 :: geom_point(ggplot2 :: aes_string(x = x_axis , y = y_axis ), data = pca_rot , alpha = alpha , size = size ),
798798 list (x_axis = input $ x_axis , y_axis = input $ y_axis , alpha = input $ alpha , size = input $ size )
799799 )
800800 )
@@ -805,7 +805,7 @@ srv_a_pca <- function(id, data, reporter, filter_panel_api, dat, plot_height, pl
805805 response <- ANL [[resp_col ]]
806806
807807 aes_biplot <- substitute(
808- aes_string(x = x_axis , y = y_axis , color = " response" ),
808+ ggplot2 :: aes_string(x = x_axis , y = y_axis , color = " response" ),
809809 env = list (x_axis = x_axis , y_axis = y_axis )
810810 )
811811
@@ -826,15 +826,15 @@ srv_a_pca <- function(id, data, reporter, filter_panel_api, dat, plot_height, pl
826826 qenv ,
827827 quote(pca_rot $ response <- as.factor(response ))
828828 )
829- quote(scale_color_brewer(palette = " Dark2" ))
829+ quote(ggplot2 :: scale_color_brewer(palette = " Dark2" ))
830830 } else if (inherits(response , " Date" )) {
831831 qenv <- teal.code :: eval_code(
832832 qenv ,
833833 quote(pca_rot $ response <- numeric (response ))
834834 )
835835
836836 quote(
837- scale_color_gradient(
837+ ggplot2 :: scale_color_gradient(
838838 low = c(getOption(" ggplot2.discrete.colour" )[2 ], " darkred" )[1 ],
839839 high = c(getOption(" ggplot2.discrete.colour" ), " lightblue" )[1 ],
840840 labels = function (x ) as.Date(x , origin = " 1970-01-01" )
@@ -845,7 +845,7 @@ srv_a_pca <- function(id, data, reporter, filter_panel_api, dat, plot_height, pl
845845 qenv ,
846846 quote(pca_rot $ response <- response )
847847 )
848- quote(scale_color_gradient(
848+ quote(ggplot2 :: scale_color_gradient(
849849 low = c(getOption(" ggplot2.discrete.colour" )[2 ], " darkred" )[1 ],
850850 high = c(getOption(" ggplot2.discrete.colour" ), " lightblue" )[1 ]
851851 ))
@@ -854,7 +854,7 @@ srv_a_pca <- function(id, data, reporter, filter_panel_api, dat, plot_height, pl
854854 pca_plot_biplot_expr <- c(
855855 pca_plot_biplot_expr ,
856856 substitute(
857- geom_point(aes_biplot , data = pca_rot , alpha = alpha , size = size ),
857+ ggplot2 :: geom_point(aes_biplot , data = pca_rot , alpha = alpha , size = size ),
858858 env = list (aes_biplot = aes_biplot , alpha = alpha , size = size )
859859 ),
860860 scales_biplot
@@ -865,17 +865,17 @@ srv_a_pca <- function(id, data, reporter, filter_panel_api, dat, plot_height, pl
865865 pca_plot_biplot_expr <- c(
866866 pca_plot_biplot_expr ,
867867 substitute(
868- geom_segment(
869- aes_string(x = " xstart" , y = " ystart" , xend = x_axis , yend = y_axis ),
868+ ggplot2 :: geom_segment(
869+ ggplot2 :: aes_string(x = " xstart" , y = " ystart" , xend = x_axis , yend = y_axis ),
870870 data = rot_vars ,
871871 lineend = " round" , linejoin = " round" ,
872872 arrow = grid :: arrow(length = grid :: unit(0.5 , " cm" ))
873873 ),
874874 env = list (x_axis = x_axis , y_axis = y_axis )
875875 ),
876876 substitute(
877- geom_label(
878- aes_string(
877+ ggplot2 :: geom_label(
878+ ggplot2 :: aes_string(
879879 x = x_axis ,
880880 y = y_axis ,
881881 label = " label"
@@ -886,7 +886,7 @@ srv_a_pca <- function(id, data, reporter, filter_panel_api, dat, plot_height, pl
886886 ),
887887 env = list (x_axis = x_axis , y_axis = y_axis )
888888 ),
889- quote(geom_point(aes(x = xstart , y = ystart ), data = rot_vars , shape = " x" , size = 5 ))
889+ quote(ggplot2 :: geom_point(ggplot2 :: aes(x = xstart , y = ystart ), data = rot_vars , shape = " x" , size = 5 ))
890890 )
891891 }
892892
@@ -896,9 +896,9 @@ srv_a_pca <- function(id, data, reporter, filter_panel_api, dat, plot_height, pl
896896 dev_ggplot2_args <- teal.widgets :: ggplot2_args(
897897 labs = dev_labs ,
898898 theme = list (
899- text = substitute(element_text(size = font_size ), list (font_size = font_size )),
899+ text = substitute(ggplot2 :: element_text(size = font_size ), list (font_size = font_size )),
900900 axis.text.x = substitute(
901- element_text(angle = angle_val , hjust = hjust_val ),
901+ ggplot2 :: element_text(angle = angle_val , hjust = hjust_val ),
902902 list (angle_val = angle , hjust_val = hjust )
903903 )
904904 )
@@ -946,9 +946,9 @@ srv_a_pca <- function(id, data, reporter, filter_panel_api, dat, plot_height, pl
946946
947947 dev_ggplot2_args <- teal.widgets :: ggplot2_args(
948948 theme = list (
949- text = substitute(element_text(size = font_size ), list (font_size = font_size )),
949+ text = substitute(ggplot2 :: element_text(size = font_size ), list (font_size = font_size )),
950950 axis.text.x = substitute(
951- element_text(angle = angle_val , hjust = hjust_val ),
951+ ggplot2 :: element_text(angle = angle_val , hjust = hjust_val ),
952952 list (angle_val = angle , hjust_val = hjust )
953953 )
954954 )
@@ -969,17 +969,17 @@ srv_a_pca <- function(id, data, reporter, filter_panel_api, dat, plot_height, pl
969969 list (
970970 quote(ggplot(pca_rot )),
971971 substitute(
972- geom_bar(
973- aes_string(x = " Variable" , y = pc ),
972+ ggplot2 :: geom_bar(
973+ ggplot2 :: aes_string(x = " Variable" , y = pc ),
974974 stat = " identity" ,
975975 color = " black" ,
976976 fill = c(getOption(" ggplot2.discrete.colour" ), " lightblue" )[1 ]
977977 ),
978978 env = list (pc = pc )
979979 ),
980980 substitute(
981- geom_text(
982- aes(
981+ ggplot2 :: geom_text(
982+ ggplot2 :: aes(
983983 x = Variable ,
984984 y = pc_name ,
985985 label = round(pc_name , 3 ),
0 commit comments