How to Get the Function Code in R
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://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的更多相关文章
- js eval()函数 接收一个字符串,做为js代码来执行。 如: s='var d="kaka"'; 或者s=‘function (code){return code }’;
eval函数接收一个参数s,如果s不是字符串,则直接返回s.否则执行s语句.如果s语句执行结果是一个值,则返回此值,否则返回undefined. 需要特别注意的是对象声明语法“{}”并不能返回一个值, ...
- Android Project from Existing Code 生成 R 文件错误、失败等问题解决办法 - 持续更新
Android Project from Existing Code 生成 R 文件错误.失败等问题解决办法 - 持续更新 git 上的项目,pull下来之后用Android Project fro ...
- 自执行匿名函数: (function() { /* code */ })();
1,常见格式:(function() { /* code */ })(); 2,解释:包围函数(function(){})的第一对括号向脚本返回未命名的函数,随后一对空括号立即执行返回的未命名函数,括 ...
- javascript (function() { /* code */ })() 自执行函数
(function(){ function a(){ alert("a"); } })(); 自执行匿名函数: 常见格式:(function() { /* code */ })() ...
- 设置Windows 8.1屏幕自己主动旋转代码, Auto-rotate function code
程序代码实现启用或禁用Windows 8.1 Tablet的自己主动旋转功能 方法一:使用SetDisplayAutoRotationPreferences函数功能 #include <Wind ...
- JavaScript模板引擎原理,几行代码的事儿
一.前言 什么是模板引擎,说的简单点,就是一个字符串中有几个变量待定.比如: var tpl = 'Hei, my name is <%name%>, and I\'m <%age% ...
- JavaScript 页面模板引擎
var TemplateEngine = function(html, options) { var re = /<%([^%>]+)?%>/g, reExp = /(^( )?(i ...
- 最近兰州的js风格写个插件和一个template engine
/* *@Product Name: Rational Framework Author: Calos Description: pager !important: pager */ (functio ...
- JS模版引擎[20行代码实现模版引擎读后感]
曾经阅读过<只有20行JAVASCRIPT代码, 手把手教你写一个页面模版引擎>这篇文章, 对其中实现模版的想法实在膜拜, 于是有了这篇读后感, 谈谈自己对模版引擎的理解, 以及用自己的语 ...
随机推荐
- Linux三剑客grep、sed、awk
grep grep file grep -i file grep -v file
- 【题解】Luogu P5072 [Ynoi2015]盼君勿忘
众所周知lxl是个毒瘤,Ynoi道道都是神仙题,题面好评 原题传送门 一看这题没有修改操作就知道这是莫队题 我博客里对莫队的简单介绍 既然是莫队,我们就要考虑每多一个数或少一个数对答案的贡献是什么 假 ...
- (4运行例子)自己动手,编写神经网络程序,解决Mnist问题,并网络化部署
1.联通ColaB 2.运行最基础mnist例子,并且打印图表结果 # https://pypi.python.org/pypi/pydot#!apt-get -qq install -y gra ...
- 神经网络优化算法如何选择Adam,SGD
之前在tensorflow上和caffe上都折腾过CNN用来做视频处理,在学习tensorflow例子的时候代码里面给的优化方案默认很多情况下都是直接用的AdamOptimizer优化算法,如下: o ...
- Codeforces 822D My pretty girl Noora - 线性筛 - 动态规划
In Pavlopolis University where Noora studies it was decided to hold beauty contest "Miss Pavlop ...
- InstallShield 2015 生成单个EXE包和 MSI包
生成EXE包: 生成MSI包:
- minicom支持向串口自动发送命令的功能
1. 用法 minicom -S <script name> -C <log name> 参数解析: -S: 指定要执行的脚本 -C: 指定输出日志文件名 2. 既然可以指定脚 ...
- 【POJ1509】Glass Beads
[POJ1509]Glass Beads [题目描述]给定字符串S,并规定首尾相连成环,求出最小字典序. [输入]输入有多个数据,第一行只包括正整数N,表示有N组数据.每个数据包括一行,输入该字符串. ...
- 为linux dns (bind named)服务器配置 单独的笔记
注意: 当在把 named.ca文件下载好13个根dns服务器的 全球记录后, 就不再需要别的 dns服务器来辅助获得了. 只要把所有 本地服务器 不能解析的请求, 都发送到 . 点根去就行了, 所以 ...
- UVA11417 GCD
题目地址 题目链接 题解 先讨论任何没有限制的情况 \[ \large { \begin{aligned} &\sum_{i=1}^{n}\sum_{j=1}^{n}gcd(i,j)\\ &a ...