hapus dan rm dapat digunakan untuk menghapus objek. Ini dapat ditentukan secara berturut-turut sebagai string karakter, atau dalam daftar vektor karakter, atau melalui kombinasi keduanya. Semua objek yang ditentukan akan dihapus. Jika envir adalah NULL maka lingkungan yang sedang aktif dicari terlebih dahulu. Jika mewarisi adalah BENAR maka orang tua dari direktori yang disediakan akan dicari sampai variabel dengan nama yang diberikan ditemukan. Peringatan dicetak untuk setiap variabel yang tidak ditemukan.
remove(…, list = character(), pos = -1,
envir = as.environment(pos), inherits = FALSE)<p></p><p>rm (…, list = character(), pos = -1,
envir = as.environment(pos), inherits = FALSE)</p>
| Parameter | Deskripsi |
|---|---|
… |
the objects to be removed, as names (unquoted) or character strings (quoted). |
list |
a character vector naming objects to be removed. |
pos |
where to do the removal. By default, uses the current environment. See ‘details’ for other possibilities. |
envir |
the environment to use. See ‘details’. |
inherits |
should the enclosing frames of the environment be inspected? |
# NOT RUN {
tmp <- 1:4
## work with tmp and cleanup
rm(tmp)
# }
# NOT RUN {
## remove (almost) everything in the working environment.
## You will get no warning, so don't do this unless you are really sure.
rm(list = ls())
# }