ID EN
Miscellaneous

octmode

R Base 3.6.2 🇮🇩 Bahasa Indonesia

Konversikan atau cetak bilangan bulat dalam format oktal, dengan digit sebanyak yang diperlukan untuk menampilkan bilangan terbesar, gunakan angka nol di depan seperlunya.

Syntax

R
as.octmode(x)<p></p><p># S3 method for octmode
as.character(x, &#8230;)</p><p># S3 method for octmode
format(x, width = NULL, &#8230;)</p><p># S3 method for octmode
print(x, &#8230;)</p>

Arguments

Parameter Deskripsi
x An object, for the methods inheriting from class "octmode".
width NULL or a positive integer specifying the minimum field width to be used, with padding by leading zeroes.
&#8230; further arguments passed to or from other methods.

Details

Kelas "octmode" terdiri dari vektor bilangan bulat dengan atribut kelas tersebut, digunakan hanya untuk memastikan bahwa vektor tersebut dicetak dalam notasi oktal, khususnya untuk izin file mirip Unix seperti 755. Subsetting ([) juga berfungsi. Jika lebar = NULL (default), output diisi dengan angka nol di depan hingga lebar terkecil yang diperlukan untuk semua elemen yang tidak hilang. as.octmode dapat mengonversi bilangan bulat (bertipe "integer" atau "double") dan vektor karakter yang elemennya hanya berisi angka 0-7 (atau NA) ke kelas "octmode". Ada! metode dan metode untuk | dan &: ini mendaur ulang argumennya menjadi lebih panjang dan kemudian menerapkan operator secara bitwise ke setiap elemen.

Contoh

Example
R
# NOT RUN {
(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"
# }
# NOT RUN {
umask <- Sys.umask(NA) # depends on platform
c(fmode, "666", "755") & !umask
# }

See Also

These are auxiliary functions for file.info. hexmode sprintf for other options in converting integers to octal strtoi to convert octal strings to integers.