# Toy example with iris data
# We first create a hdd dataset with approx. 100KB
hdd_path = tempfile() # => folder where the data will be saved
write_hdd(iris, hdd_path)
for(i in 1:10) write_hdd(iris, hdd_path, add = TRUE)
base_hdd = hdd(hdd_path)
summary(base_hdd) # => 11 files
# we can extract the data from the 11 files with '$':
pl = base_hdd$Sepal.Length
#
# Illustration of the protection mechanism:
#
# By default when extracting a variable with '$'
# and the size exceeds the cap (default is greater than 3GB)
# a confirmation is needed.
# You can set the cap with setHdd_extract.cap.
# Following code asks a confirmation:
setHdd_extract.cap(sizeMB = 0.005) # new cap of 5KB
try(pl <- base_hdd$Sepal.Length)
# To extract the variable without changing the cap:
pl = base_hdd[, Sepal.Length] # => no size control is performed
# Resetting the default cap
setHdd_extract.cap()
Run the code above in your browser using DataLab