
Get the path(s) to the target data file(s) in the hub directory.
Source:R/utils-target_data.R
get_target_path.Rd
Get the path(s) to the target data file(s) in the hub directory.
Usage
get_target_path(hub_path, target_type = c("time-series", "oracle-output"))
Arguments
- hub_path
Either a character string path to a local Modeling Hub directory or an object of class
<SubTreeFileSystem>
created using functionss3_bucket()
orgs_bucket()
by providing a string S3 or GCS bucket name or path to a Modeling Hub directory stored in the cloud. For more details consult the Using cloud storage (S3, GCS) in thearrow
package. The hub must be fully configured with validadmin.json
andtasks.json
files within thehub-config
directory.- target_type
Type of target data to retrieve matching files. One of "time-series" or "oracle-output". Defaults to "time-series".
Value
a character vector of path(s) to target data file(s) (in the target-data
directory) that make the
target_type
requested.
Examples
hub_path <- withr::local_tempdir()
example_hub <- "https://github.com/hubverse-org/example-complex-forecast-hub.git"
gert::git_clone(url = example_hub, path = hub_path)
get_target_path(hub_path)
#> /tmp/RtmpLd7lLV/file1e0453c1c714/target-data/time-series.csv
get_target_path(hub_path, "time-series")
#> /tmp/RtmpLd7lLV/file1e0453c1c714/target-data/time-series.csv
get_target_path(hub_path, "oracle-output")
#> /tmp/RtmpLd7lLV/file1e0453c1c714/target-data/oracle-output.csv
# Access cloud data
s3_bucket_name <- get_s3_bucket_name(hub_path)
s3_hub_path <- s3_bucket(s3_bucket_name)
get_target_path(s3_hub_path)
#> target-data/time-series.csv
get_target_path(s3_hub_path, "oracle-output")
#> target-data/oracle-output.csv