【发布时间】:2021-01-03 23:13:49
【问题描述】:
我在 R 中定义了以下函数。
#!/usr/bin/Rscript
fahr_to_kelvin <- function(temp) {
kelvin <- ((temp - 32) * (5 / 9)) + 273.15
print("Hello World")
return(kelvin)
}
当我在 R 控制台中输入fahr_to_kelvin(32) 时,它返回 273.15(没有打印“Hello World”!我不知道为什么!)无论如何,我尝试在下面编写代码:
chmod +x ~/tuning1/Fun1.R
~/tuning1/Fun1.R
但是,终端中没有出现任何内容(没有错误)。请你帮我看看为什么它不起作用?
【问题讨论】:
标签: r linux function terminal output