登录  
 加关注
   显示下一条  |  关闭
温馨提示!由于新浪微博认证机制调整,您的新浪微博帐号绑定已过期,请重新绑定!立即重新绑定新浪微博》  |  关闭

云之南

风声,雨声,读书声,声声入耳;家事,国事,天下事,事事关心

 
 
 

日志

 
 
关于我

专业背景:计算机科学 研究方向与兴趣: JavaEE-Web软件开发, 生物信息学, 数据挖掘与机器学习, 智能信息系统 目前工作: 基因组, 转录组, NGS高通量数据分析, 生物数据挖掘, 植物系统发育和比较进化基因组学

How to Get the Function Code in R  

2010-05-11 22:31:01|  分类: R&Bioconductor |  标签: |举报 |字号 订阅

  下载LOFTER 我的照片书  |

http://blog.sina.com.cn/s/blog_61f013b80100gekp.html

http://rbbs.biosino.org/Rbbs/posts/list/1073.page

How to Get the Function Code in R

R is “open-access”, so I can read and modify the function code for further application. And that is the reason I choose it, use it and love it.

 

But first, let’s explore how to get the function code.

1. On R Console. function_name + Enter. For example:

> fivenum

function (x, na.rm = TRUE)

{

    xna <- is.na(x)

    if (na.rm)

        x <- x[!xna]

    else if (any(xna))

        return(rep.int(NA, 5))

    x <- sort(x)

    n <- length(x)

    if (n == 0)

        rep.int(NA, 5)

    else {

        n4 <- floor((n + 3)/2)/2

        d <- c(1, n4, (n + 1)/2, n + 1 - n4, n)

        0.5 * (x[floor(d)] + x[ceiling(d)])

    }

}

<environment: namespace:stats>

2. function_name.default. For example:

>qqnorm.default

# this is a visible function, a special case of 3 later.

3. For generic functions like “rep”

>t.test

function (x, ...)

UseMethod("t.test")

<environment: namespace:stats>

 

>methods(“t.test”)

 [1] t.test.default* t.test.formula*

   Non-visible functions are asterisked

# first, we should known the “methods” used.

 

>getAnywhere(“t.test.default”)  or >stats:::t.test.default or >getS3method(“t.test”,“default”)

# get “t.test.default” code

4.  If all the methods discussed above cannot help, just open the R-code(.tar.gz) for the Z-plan.

 

 

For more:

http://cran.csdb.cn/

http://rbbs.biosino.org/Rbbs/posts/list/63.page#574#574

http://www.pinggu.org/bbs/b69i336419.html

http://cos.name/bbs/read.php?tid=1065

http://tel.pinggu.org/bbs/b69i456670p4.html

 

In addition, thanks for Dr. Ding’s prompt help and discussion about the “wilcox.test” function code in R.

  评论这张
 
阅读(1614)| 评论(0)

历史上的今天

评论

<#--最新日志,群博日志--> <#--推荐日志--> <#--引用记录--> <#--博主推荐--> <#--随机阅读--> <#--首页推荐--> <#--历史上的今天--> <#--被推荐日志--> <#--上一篇,下一篇--> <#-- 热度 --> <#-- 网易新闻广告 --> <#--右边模块结构--> <#--评论模块结构--> <#--引用模块结构--> <#--博主发起的投票-->
 
 
 
 
 
 
 
 
 
 
 
 
 
 

页脚

网易公司版权所有 ©1997-2018