Skip to contents

Get key project parameters that determine the folder used for storing project files

Usage

cas_get_options(
  project = NULL,
  website = NULL,
  use_db = NULL,
  base_folder = NULL,
  db_type = NULL,
  db_folder = NULL,
  ...
)

Arguments

project

Defaults to NULL. Project name, can be set once per session with cas_set_options(). This will be used as first level folder and may be used elsewhere to describe the dataset.

website

Defaults to NULL. Website name, can be set once per session with cas_set_options(). This will be used as a second level folder and may be used elsewhere to describe the dataset.

use_db

Defaults to TRUE. If TRUE, stores information about the download process and extracted text in a local database.

base_folder

Defaults to NULL, can be set once per session with cas_set_options(). A path to a location used for storing html and other project files. If the folder does not exist, it will be created. If not given, and not previously set as environment variable, defaults to castarter_data.

db_folder

Defaults to NULL. can be set once per session with cas_set_options() or cas_set_db_folder(). A path to a location used for storing the database. If not given, and not previously set as environment variable, defaults to castarter_data.

Value

A list object with the given or previously set options.

See also

Other settings: cas_set_options()

Examples

# it is possible to set only a few options, and let others be added when calling functions
cas_set_options(base_folder = fs::path(fs::path_temp(), "castarter_data"))
cas_options_list <- cas_get_options()
cas_options_list
#> $project
#> [1] "european_union"
#> 
#> $website
#> [1] "european_parliament_dates"
#> 
#> $use_db
#> [1] TRUE
#> 
#> $base_folder
#> [1] "/tmp/RtmpKZFKM9/castarter_data"
#> 
#> $db_type
#> [1] "SQLite"
#> 
#> $db_folder
#> [1] "/tmp/RtmpKZFKM9"
#> 

cas_options_list2 <- cas_get_options(project = "test_project")
cas_options_list2
#> $project
#> [1] "test_project"
#> 
#> $website
#> [1] "european_parliament_dates"
#> 
#> $use_db
#> [1] TRUE
#> 
#> $base_folder
#> [1] "/tmp/RtmpKZFKM9/castarter_data"
#> 
#> $db_type
#> [1] "SQLite"
#> 
#> $db_folder
#> [1] "/tmp/RtmpKZFKM9"
#> 

cas_set_options(
  base_folder = fs::path(fs::path_temp(), "castarter_data"),
  project = "test_project",
  website = "test_website"
)

cas_options_list3 <- cas_get_options()
cas_options_list3
#> $project
#> [1] "test_project"
#> 
#> $website
#> [1] "test_website"
#> 
#> $use_db
#> [1] TRUE
#> 
#> $base_folder
#> [1] "/tmp/RtmpKZFKM9/castarter_data"
#> 
#> $db_type
#> [1] "SQLite"
#> 
#> $db_folder
#> [1] "/tmp/RtmpKZFKM9"
#> 

# Passing an argument overwrites the arguments set with options
cas_options_list4 <- cas_get_options(website = "test_website4")
cas_options_list4
#> $project
#> [1] "test_project"
#> 
#> $website
#> [1] "test_website4"
#> 
#> $use_db
#> [1] TRUE
#> 
#> $base_folder
#> [1] "/tmp/RtmpKZFKM9/castarter_data"
#> 
#> $db_type
#> [1] "SQLite"
#> 
#> $db_folder
#> [1] "/tmp/RtmpKZFKM9"
#>