美文网首页
[R包开发]报错解决:replacing previous im

[R包开发]报错解决:replacing previous im

作者: 郑宝童 | 来源:发表于2019-01-09 12:17 被阅读16次

    1.问题产生

    最近开发R包的时候碰到了一个warmings:


    warmings

    2.寻求解决途径

    这个warmings困扰了我好久,都没找到解决办法。于是我又开启了一波疯狂的网络搜索:下方是搜索到相关资料
    2.1前人的类似问题:

    how to avoid the warning of replacing previous import edgeR::rpkm by NOISeq::rpkm when loading ComSeq
    https://stat.ethz.ch/pipermail/bioc-devel/2017-June/011129.html

    链接中关键信息如下截图


    关键信息.png

    2.2搜索Writing R Extensions中关于import和importfrom内容,然而并未找到有效的解决办法
    https://cran.r-project.org/doc/manuals/r-release/R-exts.html

    3.最终的解决方案

    https://stackoverflow.com/questions/8662285/warning-replacing-previous-import-head-when-loading-utils-in-r

    解决办法
    将所有的import改成 importfrom

    4.问题分析

    该报错是由于import和importfrom混用所造成的,我们只保留importfrom即可解决这类warming。

    最后看看大神Y叔的clusterprofiler中的namespace,果然都没用import

     Generated by roxygen2: do not edit by hand
    S3method("[",compareClusterResult)
    S3method("[[",compareClusterResult)
    S3method(as.data.frame,compareClusterResult)
    S3method(dim,compareClusterResult)
    S3method(fortify,compareClusterResult)
    S3method(geneID,groupGOResult)
    S3method(geneInCategory,groupGOResult)
    S3method(head,compareClusterResult)
    S3method(tail,compareClusterResult)
    export(GSEA)
    export(Gff2GeneTable)
    export(bitr)
    export(bitr_kegg)
    export(browseKEGG)
    export(buildGOmap)
    export(compareCluster)
    export(download_KEGG)
    export(dropGO)
    export(enrichDAVID)
    export(enrichGO)
    export(enrichKEGG)
    export(enrichMKEGG)
    export(enricher)
    export(go2ont)
    export(go2term)
    export(gofilter)
    export(groupGO)
    export(gseGO)
    export(gseKEGG)
    export(gseMKEGG)
    export(idType)
    export(merge_result)
    export(plot)
    export(plotGOgraph)
    export(read.gmt)
    export(search_kegg_organism)
    exportClasses(compareClusterResult)
    exportClasses(groupGOResult)
    exportMethods(dotplot)
    exportMethods(simplify)
    importClassesFrom(DOSE,enrichResult)
    importClassesFrom(DOSE,gseaResult)
    importClassesFrom(methods,data.frame)
    importFrom(AnnotationDbi,Ontology)importFrom(AnnotationDbi,as.list)
    importFrom(AnnotationDbi,keys)
    importFrom(AnnotationDbi,keytypes)
    importFrom(AnnotationDbi,select)
    importFrom(AnnotationDbi,toTable)
    importFrom(DOSE,dotplot)
    importFrom(DOSE,geneID)
    importFrom(DOSE,geneInCategory)
    importFrom(DOSE,setReadable)
    importFrom(DOSE,theme_dose)
    importFrom(GO.db,GOBPANCESTOR)
    importFrom(GO.db,GOBPCHILDREN)
    importFrom(GO.db,GOCCANCESTOR)
    importFrom(GO.db,GOCCCHILDREN)
    importFrom(GO.db,GOMFANCESTOR)
    importFrom(GO.db,GOMFCHILDREN)
    importFrom(GO.db,GOTERM)
    importFrom(GOSemSim,godata)
    importFrom(GOSemSim,load_OrgDb)
    importFrom(GOSemSim,mgoSim)
    importFrom(ggplot2,"%+%")
    importFrom(ggplot2,aes)
    importFrom(ggplot2,aes_)
    importFrom(ggplot2,aes_string)
    importFrom(ggplot2,coord_flip)
    importFrom(ggplot2,element_text)
    importFrom(ggplot2,fortify)
    importFrom(ggplot2,geom_bar)
    importFrom(ggplot2,geom_point)
    importFrom(ggplot2,ggplot)
    importFrom(ggplot2,ggtitle)
    importFrom(ggplot2,scale_colour_gradient)
    importFrom(ggplot2,theme)
    importFrom(ggplot2,theme_bw)
    importFrom(ggplot2,xlab)
    importFrom(ggplot2,ylab)
    importFrom(magrittr,"%<>%")
    importFrom(magrittr,"%>%")
    importFrom(methods,new)
    importFrom(plyr,.)
    importFrom(plyr,ddply)
    importFrom(plyr,dlply)
    importFrom(plyr,ldply)
    importFrom(plyr,llply)
    importFrom(plyr,mdply)
    importFrom(plyr,rename)
    importFrom(qvalue,qvalue)
    importFrom(rvcheck,get_fun_from_pkg)
    importFrom(stats,formula)
    importFrom(stats,setNames)
    importFrom(stats4,plot)
    importFrom(tidyr,gather)
    importFrom(utils,browseURL)
    importFrom(utils,citation)
    importFrom(utils,head)
    importFrom(utils,installed.packages)
    importFrom(utils,packageDescription)
    importFrom(utils,read.table)
    importFrom(utils,stack)
    importFrom(utils,str)
    importFrom(utils,tail)
    importMethodsFrom(AnnotationDbi,mappedkeys)
    importMethodsFrom(AnnotationDbi,mget)
    importMethodsFrom(DOSE,plot)
    importMethodsFrom(DOSE,show)
    importMethodsFrom(DOSE,summary)
    

    相关文章

      网友评论

          本文标题:[R包开发]报错解决:replacing previous im

          本文链接:https://www.haomeiwen.com/subject/rrbwrqtx.html