简体   繁体   English

R:来自另一个文件的DeployR访问功能

[英]R: DeployR access functions from another file

I am executing a R script within DeployR but currently all my function definitions etc. lie inside this same file which then becomes huge. 我正在DeployR中执行R脚本,但是当前我所有的函数定义等都位于同一文件内,该文件随后变得很大。

Is there a way to split the definitions into another file? 有没有办法将定义拆分到另一个文件? Right now if I paste them into another file and save that file in the same dir in the Online DeployR Repository the original file cannot seem to see them. 现在,如果我将它们粘贴到另一个文件中,然后将该文件保存在Online DeployR存储库中的同一目录中,则原始文件似乎看不到它们。

Any workarounds? 任何解决方法?

The easiest way is to put the function file inside the deployr external folder and source it from there. 最简单的方法是将功能文件放在部署程序的external文件夹中,然后从那里获取源文件。 See https://deployr.revolutionanalytics.com/documents/dev/scientist-portable-code/#fileaccessport for an example (the example is reading a csv file but the idea is the same) 有关示例,请参见https://deployr.revolutionanalytics.com/documents/dev/scientist-portable-code/#fileaccessport (示例读取的是csv文件,但想法是相同的)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 R shiny:为什么我无法从 server.R 访问另一个文件中定义的函数? - R shiny: Why am I unable to access functions defined in another file from server.R? 从 .Rmd 文件访问 R 文件函数 - Access R file functions from .Rmd file R函数包含在另一个文件中时需要包声明吗? - R Functions require package declaration when they are included from another file? 在 R 中将函数和代码从一个文件导出和导入到另一个文件 - Export and import functions and code from one file to another in R 在一个.R文件中定义所有函数,从另一个.R文件中调用它们。如果可能的话怎么样? - Define all functions in one .R file, call them from another .R file. How, if possible? 将用户名作为变量传递并使用deployR返回r脚本的结果 - Passing user name as variable and returning the results of r script using deployR 如何从R中的不同函数一个接一个地写入csv文件中的数据? - How to write data in a csv file from different functions in R one after another? 使用来自另一个 dataframe 的值将函数子集和应用到 R dataframe? - Subsetting and applying functions to an R dataframe using values from another dataframe? 从另一个.r文件中编辑.r文件 - Editing a .r file from within another .r file 从R's Rd文件中访问元素? - Access elements from R's Rd file?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM