Waiting for answer This question has not been answered yet. You can hire a professional tutor to get the answer.
I need a R function called isBinary that accepts a single argument called x .
isBinaryxTRUExFALSE isBinary function to now have arguments (x, allow.NA = FALSE) that has the following behaviour:
- If allow.NA is TRUE, your function should return TRUE if the elements of x are 0, 1 or NA. It should return FALSE otherwise.
- If allow.NA is FALSE your function should behave exactly as in (a). i.e., the function should return TRUE if and only if the elements of x are 0 or 1.