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

  • 相关阅读:
    数据库隔离级别
    前端传递的参数名称和后端接收的参数名称不一致
    事务管理
    AOP
    spring 集成 shiro安全框架
    SpringMVC----@RequestMapping__请求方式
    SpringMVC----@RequestMapping__修饰类
    SpringMVC入门概述+案例
    SpringMVC-web.xml头代码
    Spring注解驱动开发----->容器day02
  • 原文地址:https://www.cnblogs.com/foreverycc/p/4251885.html
Copyright © 2011-2022 走看看