I'm new to R and trying to learn how to make a simple function. Could anyone advise me how to replicate this same python addition function in R please?
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