r - 调用编译后的 R 函数
问题描述
很抱歉错过了(我确信很明显)文档,但我看不到如何从另一个函数调用已编译的函数。例如,考虑:
compiledFunction <- function(x) {
return(x+1)
}
在 R 中,运行:
source( '~/compiledFunction.R' )
compiledFunction_cmp <- cmpfun( compiledFunction)
save( compiledFunction_cmp, file='compiledFunction_cmp.?')
然后:
callCompiledFunction <- function() {
source( <can I load the executable in some way?> )
print( compiledFunction_cmp(1) )
}
或者,您是否从不保存可执行文件,而是让外部函数调用'compile ...'?如果是这样,那和即时编译(enableJIT(3))有什么区别?
解决方案
推荐阅读
- python - 使用 subprocess.call 后如何打印变量?
- arrays - 给定一个单词,我需要获取该单词的所有空格变体
- regex - replace CamelCase function argument with SNAKE_CASE
- apache-kafka - kafka + 从主题日志文件中读取
- php - 如何在 MySQL 的消息表中选择用户并按日期排序?
- c# - Kendo UI 和 ASP.NET MVC:服务器端过滤
- scala - 无法在 Scala HTTP Akka 中测试 POST 请求
- java - 基于搜索从网站抓取
- reactjs - 获取此 Twitter 的 api 响应 {"errors":[{"code":215,"message":"Bad Authentication data."}]} 解决方案
- java - 如何让 jUnit 类有参数