R Create Function With Multiple Arguments Using If Statements