setHdd_extract.cap: Sets/gets the size cap when extracting hdd data

Description Usage Arguments Value Examples

View source: R/misc.R

Description

Sets/gets the default size cap when extracting HDD variables with cash-.hdd or when importing full HDD data sets with readfst.. If the size exceeds the cap, then an error is raised, which can be bypassed by using the argument confirm.

Usage

1
2
3

Arguments

sizeMB

Size cap in MB. Default to 1000.

Value

The size cap, a numeric scalar.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# 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 you cannot extract a variable with '$'
# when its size would be too large (default is greater than 1000MB)
# You can set the cap with setHdd_extract.cap.

# Following code raises an error:
setHdd_extract.cap(sizeMB = 0.005) # new cap of 5KB
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()

hdd documentation built on Nov. 6, 2019, 5:07 p.m.