R的某些功能是否与系统有关? [英] Are there features of R that are system-dependent?

查看:79
本文介绍了R的某些功能是否与系统有关?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的同事想确保我们在R中的工作独立于平台,特别是代码将在Linux,Mac和Windows上运行,并且在一个系统上创建的文件将在其他系统上运行.

My co-workers would like to make sure that our work in R is platform-independent, specifically that code will run on Linux, Mac, and Windows, and that files created on one system will work on other systems.

由于该问题已经在我的小组中提出,因此我希望能得到一个一般性的答案,这将使我更容易自信地向我的合作者保证不会出现问题.例如,除了"(主题专家)这样说之外"以外,其他参考也将有所帮助.

Since the issue has come up before in my group, I would appreciate a general answer that will make it easier for me to confidently assure my collaborators that there will not be an issue. E.g., it would help to have a reference other than "because (subject matter expert) said so on SO".

  1. 通常,是否有办法知道R的任何功能是否特定于平台(我是否可以假设这将在函数的帮助中说明)?
  2. 是否有我可以确定的独立于平台的软件包或功能?
  3. 我应该警惕哪些类型的软件包或功能?

我之前曾问过两个有关R创建的文件的跨平台可读性的问题:使用.Rdata文件有哪些缺点?与HDF5或netCDF相比?是否使用"dump"可读跨平台转储R对象?

I have previously asked two questions about the cross-platform readability of files created by R: What are the disadvantages of using .Rdata files compared to HDF5 or netCDF? and Are R objects dumped using `dump` readable cross-platform?

推荐答案

除了卡尔的回答外,显而易见的方法可确保您独立于平台的工作是 test 在所有平台上.

Besides Carl's answer, the obvious way to ensure that your work in platform-independent is to test on all platforms.

这正是CRAN使用其3800+软件包所做的,您可以访问日志

Which is precisely what CRAN does with its 3800+ packages, and you have access to logs here.

简而言之,R确实努力做到与平台无关,并且大多数都成功了.要使用您的代码来执行此操作,您必须避免使用会引入依赖关系的API或工具.看一下system.file(package="boot")之类的抽象及其使用的功能-您可以轻松地抽象文件系统的根",并且已经处理好了分隔符.

In short, R really tries hard to be platform-independent, and mostly succeeds. To do so with your code, it is up to you to avoid APIs or tools which introduce dependencies. Look at abstractions like system.file(package="boot") and the functions they use---you can easily abstract file-system "roots", and separators are already taken care of.

这篇关于R的某些功能是否与系统有关?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆