-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpf_setup_record.Rd
69 lines (64 loc) · 2.61 KB
/
pf_setup_record.Rd
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/pf_setup.R
\name{pf_setup_record}
\alias{pf_setup_record}
\title{List `record' files from an AC/DC algorithm for PF}
\usage{
pf_setup_record(root, type = c("acs", "dc"), use_absolute_paths = FALSE, ...)
}
\arguments{
\item{root}{A string that defines the directory in which files are loaded.}
\item{type}{A character that defines the source of the files (\code{type = "acs"} refers to an AC* algorithm and \code{type = "dc"} refers to the DC algorithm).}
\item{use_absolute_paths}{A logical variable that defines whether to return relative paths (\code{FALSE}) or absolute paths (\code{TRUE}) (see \code{\link[tools]{file_path_as_absolute}}).}
\item{...}{Additional arguments passed to \code{\link[base]{list.files}} (excluding \code{full.names}).}
}
\value{
The function returns an ordered list of file paths.
}
\description{
This function creates an ordered list of `record' files derived from the AC/DC/ACDC algorithm (\code{\link[flapper]{ac}}, \code{\link[flapper]{dc}} or \code{\link[flapper]{acdc}}) for particle filtering (PF) via \code{\link[flapper]{pf}}.
}
\details{
This function requires the \code{\link[stringr]{stringr}} package.
}
\examples{
#### Example (1): Example with the AC algorithm
# Define a directory in which to save files
root <- paste0(tempdir(), "/ac/")
dir.create(root)
# Implement the AC algorithm for some example time series
acc <- dat_acoustics[dat_acoustics$individual_id == 25, ][1:5, ]
out_ac <- ac(
acoustics = acc,
step = 120,
bathy = dat_gebco,
detection_containers = dat_containers,
mobility = 250,
write_record_spatial_for_pf = list(filename = root)
)
# List the files for pf()
files <- pf_setup_record(root, type = "acs", pattern = "*.grd")
utils::head(files)
# Implement pf() using files (not shown).
#### Example (2): Example with the DC algorithm
# Define a directory in which to save files
root <- paste0(tempdir(), "/dc/")
dir.create(root)
# Implement the DC algorithm for some example time series
depth <- dat_archival[dat_archival$individual_id == 25, ][1:5, ]
out_dc <- dc(
archival = depth,
bathy = dat_gebco,
write_record_spatial_for_pf = list(filename = root)
)
# List the files for pf()
files <- pf_setup_record(root, type = "dc", pattern = "*.grd")
utils::head(files)
# Implement pf() using files (not shown).
}
\seealso{
This function is designed to list outputs from \code{\link[flapper]{ac}}, \code{\link[flapper]{dc}} or \code{\link[flapper]{acdc}} (see the \code{write_record_spatial_for_pf} argument) as required by \code{\link[flapper]{pf}} (see the \code{record} argument).
}
\author{
Edward Lavender
}