zoukankan      html  css  js  c++  java
  • 用Rprofile文件配置打开时R的设置

    R中经常会使用一些命令,而且需要重复输入,非常麻烦。如果能够一打开R就直接使用会方便很多。

    通过配置一个.Rprofile文件,可以达到我们的目的。

    注:本文仅适用于Mac

    # 创建一个.Rprofile file
    emacs ~/.Rprofile
    # Edit the .Rprofile file
    # General options
    options(tab.width = 4)
    options(width = 130)
    options(graphics.record=TRUE)
    
    .First <- function(){
    # To load bioconductor ( I have typed this command for hundreds of times )
     source("http://bioconductor.org/biocLite.R")
    # To load some functions that is convenient to you
     source("~/.MyRfunctions.R")
     cat("
    Welcome at", date(), "
    ")
    }
    
    .Last <- function(){
     cat("
    Goodbye at ", date(), "
    ")
     

    这个.MyRfunctions.R 可以写一些自己方便的函数,比如:

    # Function: a brief function to read data from clippboard 
    read.clippboard    = function() {
            return(read.table(pipe("pbpaste")))
    }

    当然,还可以加入很多其他的东西。。。

    这样,当我打开R时,可以直接输入bioconductor的命令 biocLite("package")!

    当我想要阅读剪贴板的data,直接打read.clippboard()即可!

    Reference: 

    http://www.statmethods.net/interface/customizing.html

  • 相关阅读:
    组合模式
    MySQL8.0 下载安装启动(Windows10)
    OI如逆旅,我亦是行人——省选
    闲话—江湖痴情浅,信步余生。平剑红烛,青丝微绾,却话奁中。
    此时彼方
    CSP 2019游记 & 退役记
    西狂 杨过
    SDOI 2019 Round1 游记
    NOIP2018游记
    未来可期,不知所终
  • 原文地址:https://www.cnblogs.com/foreverycc/p/4251885.html
Copyright © 2011-2022 走看看