Search and load the object (dataset/toc/DSD) from cache
get_eurostat_cache(oname, cache_dir = NULL, verbose = FALSE)
a character string with the name of the object (toc, dataset id, DSD id)
a path to a cache directory to search in. The default is NULL
,
in this case the object is searched in the memory (in the .restatapi_env
). Otherwise
if the cache_dir
directory does not exist it searches the 'restatapi' directory
in the temporary directory from tempdir()
. Directory can also be set with options(restatapi_cache_dir=...)
.
a logical value with default FALSE
, so detailed messages (for debugging) will not printed.
Can be set also with options(restatapi_verbose=TRUE)
.
the requested object if exists in the '.restatapi_env' or in the cache_dir
, otherwise it returns the NULL
value.
If the given name or the beginning of the name (for datasets) found in the cache then it returns the value of the object otherwise it returns NULL
.
dt<-data.frame(txt=c("a","b","c"),nr=c(1,2,3))
put_eurostat_cache(dt,"teszt")
#> [1] "in memory ('teszt' in '.restatapi_env')"
get_eurostat_cache("teszt",verbose=TRUE)
#>
#> get_eurostat_cache - The 'teszt' was loaded from 'teszt' in '.restatapi_env'.
#> txt nr
#> 1 a 1
#> 2 b 2
#> 3 c 3