(on <- as.octmode(c(16, 32, 127:129))) # "020" "040" "177" "200" "201"
unclass(on[3:4]) # subsetting
## manipulate file modes
fmode <- as.octmode("170")
(fmode | "644") & "755"
umask <- Sys.umask(NA) # depends on platform
c(fmode, "666", "755") & !umask
Run the code above in your browser using DataLab