R语言学习笔记:查看函数的R源代码
getAnywhere
该函数可以返回一些函数的R源代码,如:
- getAnywhere(kmeans)
该函数具体用法,请参看官方说明。
Retrieve an R Object, Including from a Namespace
Description
These functions locate all objects with name matching their argument, whether visible on the search path, registered as an S3 method or in a namespace but not exported. getAnywhere()
returns the objects and argsAnywhere()
returns the arguments of any objects that are functions.
Usage
getAnywhere(x)
argsAnywhere(x)
Arguments
x |
a character string or name. |
Details
These functions look at all loaded namespaces, whether or not they are associated with a package on the search list.
They do not search literally “anywhere”: for example, local evaluation frames and namespaces that are not loaded will not be searched.
Where functions are found as registered S3 methods, an attempt is made to find which namespace registered them. This may not be correct, especially if namespaces have been unloaded.
Value
For getAnywhere()
an object of class "getAnywhere"
. This is a list with components
name |
the name searched for |
objs |
a list of objects found |
where |
a character vector explaining where the object(s) were found |
visible |
logical: is the object visible |
dups |
logical: is the object identical to one earlier in the list. |
In computing whether objects are identical, their environments are ignored.
Normally the structure will be hidden by the print
method. There is a [
method to extract one or more of the objects found.
For argsAnywhere()
one or more argument lists as returned by args
.
See Also
getS3method
to find the method which would be used: this might not be the one of those returned by getAnywhere
since it might have come from a namespace which was unloaded or be registered under another name.
Examples
getAnywhere("format.dist")
getAnywhere("simpleLoess") # not exported from stats
argsAnywhere(format.dist)
R语言学习笔记:查看函数的R源代码的更多相关文章
- R 语言学习笔记(1)——R 工作空间与输入输出
什么是工作空间? 工作空间(workspace)就是当前 R 的工作环境,它储存着所有用户定义的对象(objectives)包括了向量.矩阵.函数.数据框.列表等. 处理 R 文件的工作流程 #设置当 ...
- R语言学习笔记:基础知识
1.数据分析金字塔 2.[文件]-[改变工作目录] 3.[程序包]-[设定CRAN镜像] [程序包]-[安装程序包] 4.向量 c() 例:x=c(2,5,8,3,5,9) 例:x=c(1:100) ...
- R语言学习笔记(五)绘图(1)
R是一个惊艳的图形构建平台,这也是R语言的强大之处.本文将分享R语言简单的绘图命令. 本文所使用的数据或者来自R语言自带的数据(mtcars)或者自行创建. 首先,让我们来看一个简单例子: ...
- R语言学习笔记2——绘图
R语言提供了非常强大的图形绘制功能.下面来看一个例子: > dose <- c(20, 30, 40, 45, 60)> drugA <- c(16, 20, 27, 40, ...
- R语言学习笔记——C#中如何使用R语言setwd()函数
在R语言编译器中,设置当前工作文件夹可以用setwd()函数. > setwd("e://桌面//")> setwd("e:\桌面\")> s ...
- R语言学习笔记:sort、rank、order、arrange排序函数
R语言中排序有几个基本函数:sort().rank().order().arrange() 一.总结 sort()函数是对向量进行从小到大的排序 rank()函数返回的是对向量中每个数值对应的秩 or ...
- R语言学习笔记之: 论如何正确把EXCEL文件喂给R处理
博客总目录:http://www.cnblogs.com/weibaar/p/4507801.html ---- 前言: 应用背景兼吐槽 继续延续之前每个月至少一次更新博客,归纳总结学习心得好习惯. ...
- R语言学习笔记:向量
向量是R语言最基本的数据类型. 单个数值(标量)其实没有单独的数据类型,它只不过是只有一个元素的向量. x <- c(1, 2, 4, 9) x <- c(x[1:3], 88, x[4] ...
- R语言学习笔记:小试R环境
买了三本R语言的书,同时使用来学习R语言,粗略翻下来感觉第一本最好: <R语言编程艺术>The Art of R Programming <R语言初学者使用>A Beginne ...
随机推荐
- Windows7旗舰版32激活码 OEM密钥
1.win7旗舰版32激活码如下: KH2J9-PC326-T44D4-39H6V-TVPBY TFP9Y-VCY3P-VVH3T-8XXCC-MF4YK 236TW-X778T-8MV9F-937G ...
- 关于C#正则表达式MatchCollection类的总结,正则表达式的应用
认识MatchCollection 类 表示通过以迭代方式将正则表达式模式应用于输入字符串所找到的成功匹配的集合. 命名空间: System.Text.RegularExpressions 属性:C ...
- 中科红旗倒下,谁来挑战windows
中科红旗解散 国产操作系统从此梦断 2月10日,关门上锁的中科红旗北京总部大门上粘贴了一张最新公告,这张公告彻底击破了那些仍然坚守公司工作的员工“拯救中国红旗”的希望.该公告称:因北京中科红旗软件技术 ...
- eclipse 分屏
刚刚一直找不到eclipse分屏功能,查了下发现是可以的. 具体见:http://www.coderanch.com/t/101996/vc/Split-screen-editor-Eclipse E ...
- php substr,iconv_substr,mb_substr
php进行中文字符串的截取时,会经常用到二个函数iconv_substr和mb_substr,对这二个函数应该如何选择呢?参考下本文介绍的例子就明白了. 示例代码,用到了函数substr与iconv_ ...
- C# 学习之旅(3) --- 会说话的简易计算器
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; usin ...
- leetcode学习笔记--开篇
1 LeetCode是什么? LeetCode是一个在线的编程测试平台,国内也有类似的Online Judge平台.程序开发人员可以通过在线刷题,提高对于算法和数据结构的理解能力,夯实自己的编程基础. ...
- c 递归函数浅析
所谓递归,简而言之就是应用程序自身调用自身,以实现层次数据结构的查询和访问. 递归的使用可以使代码更简洁清晰,可读性更好(对于初学者到不见得),但由于递归需要系统堆栈,所以空间消耗要比非递归代码要大很 ...
- Linux进程间通信IPC学习笔记之同步二(Posix 信号量)
Linux进程间通信IPC学习笔记之同步二(Posix 信号量)
- 【转】perl特殊符号及默认的内部变量
perl特殊符号及默认的内部变量,有需要的朋友不妨参考下 Perl的特殊符号 @ 数组 $x{} x名字前面是美元符号($),后面是花 ...