r - 检测 R 中的操作系统(例如,对于自适应 .Rprofile 文件)

标签 r operating-system

我想知道如何在 R 中自动检测操作系统,例如将内容放入 .Rprofile 中。

最佳答案

switch(Sys.info()[['sysname']],
Windows= {print("I'm a Windows PC.")},
Linux  = {print("I'm a penguin.")},
Darwin = {print("I'm a Mac.")})

由于我花了很多时间来解决这个问题,我认为其他人也会受益。

问候,

  • 布莱恩

关于r - 检测 R 中的操作系统(例如,对于自适应 .Rprofile 文件),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4463087/

相关文章:

python - 如何返回最大深度的子目录路径?

r - 计算不同行的列之间的时间差(difftime)

r - 如何使用任何部分匹配的字符串 gsub 字符串

mysql - MySQL Workbench 不支持的操作系统 - Windows 7

Windows 冗余交换?

c - C 中未使用的返回状态代码

r - 在模拟中计算并绘制每一代的自举置信区间

r - 带有 ggvis : how to plot multiple groups with different shape markers and corresponding fitted regression lines 的 R 中的散点图

r - UseMethod 调用的方法范围

operating-system - 使用信号量实现 N 进程屏障