http://fhqdddddd.blog.163.com/blog/static/1869915420104111031148/

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.

How to Get the Function Code in R的更多相关文章

  1. js eval()函数 接收一个字符串,做为js代码来执行。 如: s='var d="kaka"'; 或者s=‘function (code){return code }’;

    eval函数接收一个参数s,如果s不是字符串,则直接返回s.否则执行s语句.如果s语句执行结果是一个值,则返回此值,否则返回undefined. 需要特别注意的是对象声明语法“{}”并不能返回一个值, ...

  2. Android Project from Existing Code 生成 R 文件错误、失败等问题解决办法 - 持续更新

    Android Project from Existing Code 生成 R 文件错误.失败等问题解决办法 - 持续更新 git  上的项目,pull下来之后用Android Project fro ...

  3. 自执行匿名函数: (function() { /* code */ })();

    1,常见格式:(function() { /* code */ })(); 2,解释:包围函数(function(){})的第一对括号向脚本返回未命名的函数,随后一对空括号立即执行返回的未命名函数,括 ...

  4. javascript (function() { /* code */ })() 自执行函数

    (function(){ function a(){ alert("a"); } })(); 自执行匿名函数: 常见格式:(function() { /* code */ })() ...

  5. 设置Windows 8.1屏幕自己主动旋转代码, Auto-rotate function code

    程序代码实现启用或禁用Windows 8.1 Tablet的自己主动旋转功能 方法一:使用SetDisplayAutoRotationPreferences函数功能 #include <Wind ...

  6. JavaScript模板引擎原理,几行代码的事儿

    一.前言 什么是模板引擎,说的简单点,就是一个字符串中有几个变量待定.比如: var tpl = 'Hei, my name is <%name%>, and I\'m <%age% ...

  7. JavaScript 页面模板引擎

    var TemplateEngine = function(html, options) { var re = /<%([^%>]+)?%>/g, reExp = /(^( )?(i ...

  8. 最近兰州的js风格写个插件和一个template engine

    /* *@Product Name: Rational Framework Author: Calos Description: pager !important: pager */ (functio ...

  9. JS模版引擎[20行代码实现模版引擎读后感]

    曾经阅读过<只有20行JAVASCRIPT代码, 手把手教你写一个页面模版引擎>这篇文章, 对其中实现模版的想法实在膜拜, 于是有了这篇读后感, 谈谈自己对模版引擎的理解, 以及用自己的语 ...

随机推荐

  1. 如何使用 lsyncd 实时同步并执行 shell 命令

    修改 lsyncd 的默认配置,不直接执行rsync 进行同步,而是改用自己的脚本. binary 指定我们的脚本 vim /usr/local/lsyncd/etc/lsyncd.conf sett ...

  2. Linux的常用路由配置

    1.配置默认路由 ip route add default via 192.168.10.1 dev eth0 route add default gw 192.168.10.1 2.间接路由: ip ...

  3. socket - option编程:SO_REUSEADDR

    网友vmstat多次提出了这个问题:SO_REUSEADDR有什么用处和怎么使用.而且很多网友在编写网络程序时也会遇到这个问题.所以特意写了这么一篇文章,希望能够解答一些人的疑难. 其实这个问题在Ri ...

  4. Android图片裁剪解决方案 -- 从相册截图

    在看Storage Access Framework,里面有一个加载相册图片的程序片断,可能是系统版本的问题,无法返回结果,这里找到一个适用于旧版本的方法. 在Android开发中,可以轻松调用一个I ...

  5. 接口自动化(unittest)

    一.用例 TestCase 也就是测试用例 TestSuite 多个测试用例集合在一起,就是TestSuite TestLoader是用来加载TestCase到TestSuite中的 TestRunn ...

  6. python简说(十三)递归

    #递归就是函数自己调用自己count = 0# def abc():# pass# abc()最多循环999次

  7. Codeforces 839C Journey - 树形动态规划 - 数学期望

    There are n cities and n - 1 roads in the Seven Kingdoms, each road connects two cities and we can r ...

  8. 树之105 Construct Binary Tree from Preorder and Inorder Traversal

    题目链接:https://leetcode-cn.com/problems/construct-binary-tree-from-preorder-and-inorder-traversal/ 参考链 ...

  9. Junit中的setUp()与setUpBefore(), tearDown()与tearDownAfterClass()解析

    @BeforeClass public static void setUpBeforeClass() throws Exception { } @AfterClass public static vo ...

  10. easyui-datagrid合并相同行功能扩展

    //合并相同行$.extend($.fn.datagrid.methods, { autoMergeCells: function (jq, fields) { return jq.each(func ...