Export all hidden functions from a package

Is there a way to automatically import all hidden functions from a package, ie functions accessible only with package:::fun ? Indeed I have brought some modifications to a given function which uses quite a lot of internal functions and I want to avoid retyping package::: everywhere. I looked at loadNamespace base function but it does not attach the non exported ones. Ok I finally found sort

从包中导出所有隐藏的函数

有没有办法从包中自动导入所有隐藏的函数,即只能用package:::fun访问的函数? 事实上,我对一个给定的函数带来了一些修改,它使用了很多内部函数,我想避免重新package:::无处不在。 我查看了loadNamespace基本函数,但它不附加非导出的函数。 好吧,我终于找到了一些使用这个相关的帖子和eval的黑客攻击: # get all the function names of the given package "mypack" r <- unclass(lsf.str(envir = asNamespace("my

Speed up pairwise counting of unique observations

I have a vector of objects ( object ) along with a corresponding vector of time frames ( tframe ) in which the objects were observed. For each unique pair of objects, I want to calculate the number of time frames in which both objects were observed. I can write the code using for() loops, but it takes a long time to run as the number of unique objects increases. How might I change the code to

加速独特观察的成对计数

我有一个对象( object )矢量以及相应的时间帧向量( tframe ),其中观察对象。 对于每对独特的对象,我想计算两个对象被观察的时间帧的数量。 我可以使用for()循环编写代码,但需要很长时间才能随着唯一对象数量的增加而运行。 我如何更改代码以加快运行时间? 下面是一个有4个独特对象的例子(实际上我有大约300个)。 例如,在时间框架1和2中都观察到对象a和c ,因此它们的计数为2 。 对象b和d在同一时间段内从未被

How to access the script/source history in RStudio?

I would like to access the history of what have been typed in the source panel in RStudio. I'm interested in the way we learn and type code. Three things I would like to analyse are: i) the way a single person type code, ii) how different persons type code, iii) the way a beginner improve typing. Grabbing the history of commands is quite satisfying as first attempt in this way but I woul

如何访问RStudio中的脚本/源历史记录?

我想要访问在RStudio的源面板中键入的内容的历史记录。 我对我们学习和输入代码的方式感兴趣。 我想分析的三件事是:i)单人类型代码的方式,ii)不同人员输入代码的方式,iii)初学者改进打字的方式。 抓取命令的历史是非常令人满意的,因为这样做的第一次尝试,但我希望达到更精细的粒度,从而以一种方式在一条线内访问连续的变化。 所以,为了清楚起见,我既没有寻找命令的历史,也没有寻找不同版本和.R文件之间的差异

Could not install package ‘readr’!

Good day to everyone! I need to launch swirl course Getting and Cleaning Data: Tidying Data with tidyr when I launch it says: This lesson requires the 'readr' package. Would you like me to install it for you now? | Trying to install package 'readr' now... Warning in install.packages : installation of package 'readr' had non-zero exit status | Could not insta

无法安装包'readr'!

祝大家好日子! 我需要启动漩涡课程获取和清洁数据: 用tidyr整理数据 当我启动它时说: 本课需要“阅读器”包。 你想我现在为你安装吗? | 尝试现在安装包'readr'... install.packages中的警告:包'readr'的安装具有非零退出状态 | 无法安装包'readr'! | | 0%seq.default错误(0,1,length = nrow(e $ les)):参数'length.out'的长度必须为1 | 现在离开漩涡。 键入

Centos 6.3 R installation error

i am newbie centos so i have tried to install R. It's installed but giving this error when i write console R Error in dyn.load(file, DLLpath = DLLpath, ...) : unable to load shared object '/usr/lib64/R/library/utils/libs/utils.so': /usr/lib64/R/library/utils/libs/utils.so: undefined symbol: libssh2_agent_disconnect In addition: Warning message: package "methods" in optio

Centos 6.3 R安装错误

我是新手centos,所以我试图安装R.它的安装,但当我写控制台时给这个错误 R dyn.load中的错误(文件,DLLpath = DLLpath,...):无法加载共享对象'/usr/lib64/R/library/utils/libs/utils.so': /usr/lib64/R/library/utils/libs/utils.so:undefined symbol:libssh2_agent_disconnect另外:警告消息:未找到options(“defaultPackages”)中的包“methods”错误:package'grDevices'没有命名空间此外:警告

Warnings thrown when accessing methods of reference class through RStudio

The code and the warnings: tinyclass <- setRefClass("TinyClass", methods = list(doNothing=function(){})) tc <- tinyclass() tc$doNothing() NULL Warning messages: 1: In installClassMethod(value, self, field, selfEnv, thisClass) : method .objectPackage from class TinyClass was not processed into a class method until being installed. Possible corruption of the methods in the class. 2: In in

通过RStudio访问参考类的方法时引发警告

代码和警告: tinyclass <- setRefClass("TinyClass", methods = list(doNothing=function(){})) tc <- tinyclass() tc$doNothing() NULL Warning messages: 1: In installClassMethod(value, self, field, selfEnv, thisClass) : method .objectPackage from class TinyClass was not processed into a class method until being installed. Possible corruption of the methods in the class. 2: In installClassMeth

R package selective import and namespace

My question is: How do I selectively import functions from two packages in the case where two of the packages have functions named DanielPlot (which is one of the functions I wish to import). I would like to import the DanielPlot function from the FrF2 package, but the BsMD package also has a function called DanielPlot. I tried selectively importing the functions I want from each package, but i

R包选择性导入和命名空间

我的问题是:在两个包中有两个函数名为DanielPlot(这是我希望导入的函数之一)的情况下,我如何有选择地从两个包中导入函数。 我想从FrF2软件包中导入DanielPlot函数,但是BsMD软件包也有一个名为DanielPlot的函数。 我尝试有选择地从每个包中导入我想要的功能,但它不起作用。 我的DESCRIPTION文件的一部分如下: Depends: lattice Imports: FrF2, BsMD 并且我的NAMESPACE文件的一部分是: import(

DescTools package output to word document

This question already has an answer here: How should I deal with “package 'xxx' is not available (for R version xyz)” warning? 13 answers Downloading the source .tar.gz files from the RDCOM website, I was able to install the package by uncompressing the files and then using devtools::install . I'm a little out of date, using R 3.1.0, but it looks like you are too, so it should w

DescTools包输出到word文档

这个问题在这里已经有了答案: 我应该如何处理“package'xxx'不可用(对于R版本xyz)”警告? 13个答案 从RDCOM网站下载源.tar.gz文件,我可以通过解压文件然后使用devtools::install来安装软件包。 我有点过时了,使用R 3.1.0,但看起来你也是如此,所以它应该也能工作。

Are R packages (and their dependencies) OS specific?

On Mac OS X, loading data.table. did not require chron . On Windows, it was required. Is there something wrong with either the Mac or the Windows version? If not, how could I detect these OS specific differences prior to trying to load data.table (or similar)? Output on MAC: require(data.table, lib.loc='packrat/lib/x86_64-apple-darwin10.8.0/3.1.1') sessionInfo() R version 3.1.1

R包(及其依赖项)操作系统是否具体?

在Mac OS X上,加载data.table. 不需要chron 。 在Windows上,它是必需的。 Mac或Windows版本有问题吗? 如果不是,在尝试加载data.table (或类似的)之前,如何检测这些操作系统特定的差异? MAC上的输出: require(data.table,lib.loc ='packrat / lib / x86_64-apple-darwin10.8.0 / 3.1.1')sessionInfo()R版本3.1.1(2014-07-10)平台:x86_64-apple-darwin10 .8.0(64位) locale:[1] en_US.UTF

Proper way to pass parameters to query in R DBI

In perl/python DBI APIs have a mechanism to safely interpolate in parameters to an sql query. For example in python I would do: cursor.execute("SELECT * FROM table WHERE value > ?", (5,)) Where the second parameter to the execute method is a tuple of parameters to add into the sql query Is there a similar mechanism for R's DBI compliant APIs? The examples I've seen never show

正确的方式传递参数在R DBI中查询

在perl / python DBI API中有一种机制可以安全地将参数插入sql查询中。 例如在Python中,我会这样做: cursor.execute("SELECT * FROM table WHERE value > ?", (5,)) 其中execute方法的第二个参数是要添加到sql查询中的参数元组 R的符合DBI的API有没有类似的机制? 我见过的例子从不显示传递给查询的参数。 如果不是,在参数中插入查询的最安全方法是什么? 我特别关注使用RPostgresSQL。 为了完整起见,我会