ID EN
I/O & Files

load

R Base 3.6.2 🇮🇩 Bahasa Indonesia

Muat ulang kumpulan data yang ditulis dengan fungsi simpan.

Syntax

R
load(file, envir = parent.frame(), verbose = FALSE)

Arguments

Parameter Deskripsi
file a (readable binary-mode) connection or a character string giving the name of the file to load (when tilde expansion is done).
envir the environment where the data should be loaded.
verbose should item names be printed during loading?

Return Value

Vektor karakter dari nama objek yang dibuat, tanpa terlihat.

Details

load dapat memuat objek R yang disimpan dalam format saat ini atau format sebelumnya. Itu dapat membaca file terkompresi (lihat simpan) langsung dari file atau dari koneksi yang sesuai (termasuk panggilan ke url). Koneksi yang tidak terbuka akan dibuka dalam mode "rb" dan ditutup setelah digunakan. Koneksi apa pun selain koneksi gzfile atau gzcon akan dibungkus dalam gzcon untuk memungkinkan penanganan penyimpanan terkompresi: perhatikan bahwa ini membuat koneksi dalam keadaan berubah (khususnya, hanya biner), dan harus ditutup secara eksplisit (tidak akan dikumpulkan sampah). Hanya objek R yang disimpan dalam format saat ini (digunakan sejak R 1.4.0) yang dapat dibaca dari koneksi. Jika tidak ada masukan yang tersedia pada sambungan, peringatan akan diberikan, namun masukan apa pun yang tidak dalam format saat ini akan mengakibatkan kesalahan. Memuat dari versi sebelumnya

Contoh

Example
R
# NOT RUN {
## save all data
xx <- pi # to ensure there is some data
save(list = ls(all = TRUE), file= "all.rda")
rm(xx)

## restore the saved values to the current environment
local({
   load("all.rda")
   ls()
})

xx <- exp(1:3)
## restore the saved values to the user's workspace
load("all.rda") ## which is here *equivalent* to
## load("all.rda", .GlobalEnv)
## This however annihilates all objects in .GlobalEnv with the same names !
xx # no longer exp(1:3)
rm(xx)
attach("all.rda") # safer and will warn about masked objects w/ same name in .GlobalEnv
ls(pos = 2)
##  also typically need to cleanup the search path:
detach("file:all.rda")

## clean up (the example):
unlink("all.rda")
# }
# NOT RUN {
# }
# NOT RUN {
con <- url("http://some.where.net/R/data/example.rda")
## print the value to see what objects were created.
print(load(con))
close(con) # url() always opens the connection
# }

See Also

save download.file; further attach as wrapper for load(). For other interfaces to the underlying serialization format see unserialize and readRDS.