I'm trying to reverse and invert to see if the digits to see if they are the same when the numbers are upside down

I got up to this far and im confused...

```
revdigits = 
function(n) {
    sapply(lapply(strsplit(as.character(n),""),rev),paste,collapse="")  
}
    for(i in 1:length(n)){
        n[i]=
        if(n[i]==0) 0
        else if(n[i] == 1) 1
        else if(n[i] == 6) 9
        else if(n[i] == 8) 8
        else if(n[i] == 9) 6
        else -1 
    }

invertible=
function(n)

n[1] == revdigits(n[1])

```

is there anyway to put them together (or relate them) to produce

```
invertible(c(99, 123, 1691))

[1] FALSE FALSE TRUE

```

this outcome??