How to solve Error in ggplot could not find function "+<-"?
0
0
Entering edit mode
nattzy94 ▴ 20
@nattzy94-23466
Last seen 2.0 years ago
Singapore

Hi,

I am running gene set enrichment analysis on R using the fgsea package and plotting the results using ggplot. The main code for plotting the results is as follows:

ggplot(fgseaRes_sig, aes(reorder(pathway, NES), NES)) +
    geom_col(aes(fill=padj<0.1)) + 
    coord_flip() + 
    labs(x="Pathway", y="Normalized Enrichment Score",
         title=fig_title) + 
    theme_minimal() + 
    theme(axis.text.y = element_text(colour = a))

I ran this code previously and it worked fine. However, when I run it now, it gives the following error:

Error in ggplot(fgseaRes_sig, aes(reorder(pathway, NES), NES)) + geom_col(aes(fill = padj <  : 
  could not find function "+<-"

It seems that ggplot doesn't get that I want to use the comparator '<'? And it's confusing it for a tidyverse function perhaps?

Here is my sessionInfo():

sessionInfo()
R version 4.1.1 (2021-08-10)
Platform: x86_64-apple-darwin17.0 (64-bit)
Running under: macOS Catalina 10.15.6

Matrix products: default
BLAS:   /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/4.1/Resources/lib/libRlapack.dylib

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
 [1] data.table_1.14.0 fgsea_1.21.0      forcats_0.5.1     stringr_1.4.0     dplyr_1.0.7      
 [6] purrr_0.3.4       readr_2.0.1       tidyr_1.1.3       tibble_3.1.4      ggplot2_3.3.5    

loaded via a namespace (and not attached):
 [1] tidyselect_1.1.1     haven_2.4.3          lattice_0.20-45      colorspace_2.0-2    
 [5] vctrs_0.3.8          generics_0.1.0       utf8_1.2.2           rlang_0.4.12        
 [9] pillar_1.6.3         glue_1.4.2           withr_2.4.2          DBI_1.1.1           
[13] BiocParallel_1.27.10 dbplyr_2.1.1         modelr_0.1.8         readxl_1.3.1        
[17] lifecycle_1.0.1      munsell_0.5.0        gtable_0.3.0         cellranger_1.1.0    
[21] rvest_1.0.1          tzdb_0.1.2           parallel_4.1.1       fansi_0.5.0         
[25] broom_0.7.9          Rcpp_1.0.7           scales_1.1.1         backports_1.2.1     
[29] jsonlite_1.7.2       fs_1.5.0             gridExtra_2.3        fastmatch_1.1-3     
[33] hms_1.1.1            stringi_1.7.4        grid_4.1.1           cli_3.0.1           
[37] tools_4.1.1          magrittr_2.0.1       crayon_1.4.1         pkgconfig_2.0.3     
[41] ellipsis_0.3.2       Matrix_1.3-4         xml2_1.3.2           reprex_2.0.1        
[45] lubridate_1.7.10     assertthat_0.2.1     httr_1.4.2           rstudioapi_0.13     
[49] R6_2.5.1             compiler_4.1.1 
ggplot • 2.2k views
ADD COMMENT

Login before adding your answer.

Traffic: 623 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6