【发布时间】:2017-07-14 14:40:41
【问题描述】:
我是 R 新手,正在尝试学习如何制作一个简单的函数。 谁能告诉我如何在 R 中复制这个相同的 python 添加函数?
def add(self,x,y):
number_types = (int, long, float, complex)
if isinstance(x, number_types) and isinstance(y, number_types):
return x+y
else:
raise ValueError
【问题讨论】:
-
你应该尝试从语法开始学习R
标签: python r function code-conversion