pf_access_history_files: List 'history' files from a PF algorithm

View source: R/pf_access.R

pf_access_history_filesR Documentation

List ‘history’ files from a PF algorithm

Description

This function creates an ordered vector (or list) of ‘history’ files derived from the particle filtering (PF) algorithm (pf). This is applicable if pf is implemented with the write_history argument specified.

Usage

pf_access_history_files(
  root,
  use_absolute_paths = FALSE,
  use_list = FALSE,
  ...
)

Arguments

root

A string that defines the directory in which files are located.

use_absolute_paths

A logical variable that defines whether to return relative paths (FALSE) or absolute paths (TRUE) (see file_path_as_absolute).

use_list

A logical variable that defines whether or not return a vector (use_list = FALSE) or a list (use_list = TRUE).

...

Additional arguments passed to list.files (excluding full.names).

Details

This function requires the stringr package.

Value

The function returns an ordered list of file paths.

Author(s)

Edward Lavender

See Also

This function is designed to list outputs from pf (see the write_history argument).

Examples

#### Example (1): Example with default arguments
# Define a directory in which to save files from PF
root <- paste0(tempdir(), "/pf/")
dir.create(root)
# Implement the PF algorithm with write_history specified
# ... For speed, we will implement the algorithm using pre-defined data
pf_args <- dat_dcpf_histories$args
pf_args$calc_distance_euclid_fast <- TRUE
pf_args$write_history <- list(file = root)
do.call(pf, pf_args)
# List the files
files <- pf_access_history_files(root)
utils::head(files)


edwardlavender/flapper documentation built on Jan. 22, 2025, 2:44 p.m.