So I am suppose to Use && and/or || and reprogram the NthRoot function. The NthRoot Function code is this:
NthRoot<-function(m,n) {
if(!is.integer(n)!=1) {
stop("Error: N must have length 1. Go away.")
}
else if (!is.integer(n) | is.numeric(n)) {
return(m^1/n)
}
else
stop('Error: You must input an interger or vector of intergers.
Existing...\n\n')}
When I replace if and else if, with double & and double |, I receive an error message, Error: unexpected '&&' in: "NthRoot<-function(m,n) { &&". I am having a hard time understanding this part of R programming so I'm struggling a lot. Any help is greatly appreciated. Thank you