diff --git a/DESCRIPTION b/DESCRIPTION
index c503026c..0abaacd5 100644
--- a/DESCRIPTION
+++ b/DESCRIPTION
@@ -7,7 +7,8 @@ Date: 2024-01-04
Depends: R (>= 3.5.0)
Imports:
av,
- data.table,
+ data.table,
+ dplyr,
fasterize,
fasttime,
gdalUtilities,
@@ -20,7 +21,6 @@ Imports:
magrittr,
methods,
plotrix,
- plyr,
purrr,
raster,
readxl,
@@ -52,4 +52,4 @@ RoxygenNote: 7.2.3
VignetteBuilder: knitr
Encoding: UTF-8
Roxygen: list(markdown = TRUE)
-Config/testthat/edition: 3
\ No newline at end of file
+Config/testthat/edition: 3
diff --git a/man/REI.Rd b/man/REI.Rd
index 16f31a17..77c5bd22 100644
--- a/man/REI.Rd
+++ b/man/REI.Rd
@@ -42,16 +42,17 @@ REI = (Tr/Ta) x (Sr/Sa) x (DDr/DDa) x (Da/Dr)
}
\examples{
det_file <- system.file("extdata", "hfx_detections.csv",
-package = "glatos")
+ package = "glatos"
+)
dep_file <- system.file("extdata", "hfx_deployments.csv",
- package = "glatos")
+ package = "glatos"
+)
hfx_deployments <- glatos::read_otn_deployments(dep_file)
dets <- glatos::read_otn_detections(det_file)
-hfx_receiver_efficiency_index <- glatos::REI(dets,hfx_deployments)
-
+hfx_receiver_efficiency_index <- glatos::REI(dets, hfx_deployments)
}
\author{
diff --git a/man/abacus_plot.Rd b/man/abacus_plot.Rd
index cfb38e6d..2f362898 100644
--- a/man/abacus_plot.Rd
+++ b/man/abacus_plot.Rd
@@ -117,63 +117,77 @@ optional graphical parameters
to "points" (see ?points).
}
\examples{
-#get path to example detection file
+# get path to example detection file
det_file <- system.file("extdata", "walleye_detections.csv",
- package = "glatos")
+ package = "glatos"
+)
det <- read_glatos_detections(det_file)
-#subset one transmitter
+# subset one transmitter
det2 <- det[det$animal_id == 153, ]
-#plot without control table and main tile and change color to red
-abacus_plot(det2, locations=NULL,
- main = "TagID: 32054", col = "red")
+# plot without control table and main tile and change color to red
+abacus_plot(det2,
+ locations = NULL,
+ main = "TagID: 32054", col = "red"
+)
-#example with locations specified
-abacus_plot(det2, locations=c("DRF", "DRL", "FMP", "MAU", "PRS", "RAR",
- "DRM", "FDT"), main = "TagID: 32054", col = "red")
+# example with locations specified
+abacus_plot(det2, locations = c(
+ "DRF", "DRL", "FMP", "MAU", "PRS", "RAR",
+ "DRM", "FDT"
+), main = "TagID: 32054", col = "red")
-#plot with custom y-axis label and lines connecting symbols
-abacus_plot(det2, main = "TagID: 32054", type = "o", pch = 20, col = "red")
+# plot with custom y-axis label and lines connecting symbols
+abacus_plot(det2, main = "TagID: 32054", type = "o", pch = 20, col = "red")
-#plot with custom x-axis resolution - 10 bins
+# plot with custom x-axis resolution - 10 bins
abacus_plot(det2, main = "TagID: 32054", x_res = 10)
-#plot with custom x-axis resolution - monthly bins
+# plot with custom x-axis resolution - monthly bins
abacus_plot(det2, main = "TagID: 32054", x_res = "month")
-#plot with custom x-axis resolution - 8-week bins
+# plot with custom x-axis resolution - 8-week bins
abacus_plot(det2, main = "TagID: 32054", x_res = "8 weeks")
-#plot with custom x-axis format
+# plot with custom x-axis format
abacus_plot(det2, main = "TagID: 32054", x_res = "months", x_format = "\%b-\%y")
-#plot with custom x axis limits
+# plot with custom x axis limits
xLim <- as.POSIXct(c("2012-01-01", "2014-01-01"), tz = "UTC")
abacus_plot(det2, main = "TagID: 32054", xlim = xLim)
-#example with receiver locations
+# example with receiver locations
# get example receiver location data
rec_file <- system.file("extdata", "sample_receivers2.csv",
- package = "glatos")
+ package = "glatos"
+)
rec <- read_glatos_receivers(rec_file)
-abacus_plot(det2, locations=c("DRF", "DRL", "FMP", "MAU", "PRS", "RAR",
- "DRM", "FDT"), receiver_history = rec,
- main = "TagID: 32054", col = "red")
-
-#example with grey box plotted in background (using panel.first)
+abacus_plot(det2,
+ locations = c(
+ "DRF", "DRL", "FMP", "MAU", "PRS", "RAR",
+ "DRM", "FDT"
+ ), receiver_history = rec,
+ main = "TagID: 32054", col = "red"
+)
+
+# example with grey box plotted in background (using panel.first)
-#set time range covered by rectangle
+# set time range covered by rectangle
rect_x_rng <- as.POSIXct(c("2012-07-31", "2013-04-15"), tz = "UTC")
-#get number of unique locations (y-axis)
+# get number of unique locations (y-axis)
n_locs <- length(unique(det2$glatos_array))
-#plot as grey box in background
-abacus_plot(det2, locations=NULL,
- main = "TagID: 32054", col = "red",
- panel.first = rect(rect_x_rng[1], 1, rect_x_rng[2], n_locs, col = "grey",
- border = NA))
+# plot as grey box in background
+abacus_plot(det2,
+ locations = NULL,
+ main = "TagID: 32054", col = "red",
+ panel.first = rect(rect_x_rng[1], 1, rect_x_rng[2], n_locs,
+ col = "grey",
+ border = NA
+ )
+)
}
\author{
diff --git a/man/adjust_playback_time.Rd b/man/adjust_playback_time.Rd
index 476048bf..50fddd73 100644
--- a/man/adjust_playback_time.Rd
+++ b/man/adjust_playback_time.Rd
@@ -50,7 +50,6 @@ specifying a different file extension in \code{output}.
Input argument 'ffmpeg' was removed in glatos version 0.7.0.
}
\examples{
-
\dontrun{
# load example frames
@@ -58,34 +57,42 @@ frames <- system.file("extdata", "frames", package = "glatos")
# make video animation
out_file <- file.path(tempdir(), "animation_av.mp4")
-make_video(input_dir = frames,
- input_ext = ".png",
- output = out_file)
+make_video(
+ input_dir = frames,
+ input_ext = ".png",
+ output = out_file
+)
# slow video down by a factor of 10
path <- file.path(tempdir(), "animation_av.mp4")
-adjust_playback_time(scale_factor = 10,
- input = path,
- output_dir = tempdir(),
- output = "animation_av_slow.mp4",
- diagnostic_mode = FALSE,
- overwrite = TRUE)
+adjust_playback_time(
+ scale_factor = 10,
+ input = path,
+ output_dir = tempdir(),
+ output = "animation_av_slow.mp4",
+ diagnostic_mode = FALSE,
+ overwrite = TRUE
+)
# slow video down by a factor of 10 and change format of output video
-adjust_playback_time(scale_factor = 10,
- input = path,
- output_dir = tempdir(),
- output = "animation_av_slow.wmv",
- diagnostic_mode = FALSE,
- overwrite = TRUE)
+adjust_playback_time(
+ scale_factor = 10,
+ input = path,
+ output_dir = tempdir(),
+ output = "animation_av_slow.wmv",
+ diagnostic_mode = FALSE,
+ overwrite = TRUE
+)
# speed up video
-adjust_playback_time(scale_factor = 0.5,
- input = path,
- output_dir = tempdir(),
- output = "animation_av_fast.mp4",
- diagnostic_mode = FALSE,
- overwrite = TRUE)
+adjust_playback_time(
+ scale_factor = 0.5,
+ input = path,
+ output_dir = tempdir(),
+ output = "animation_av_fast.mp4",
+ diagnostic_mode = FALSE,
+ overwrite = TRUE
+)
}
}
diff --git a/man/check_vdat.Rd b/man/check_vdat.Rd
index 48e07607..3f7c6a4c 100644
--- a/man/check_vdat.Rd
+++ b/man/check_vdat.Rd
@@ -19,21 +19,18 @@ Character string with command for calling VDAT.exe via
Check path to Innovasea program VDAT.exe
}
\examples{
-
\dontrun{
-#use Windows system PATH variable
+# use Windows system PATH variable
check_vdat()
-#use path to directory containing VDAT.exe
+# use path to directory containing VDAT.exe
check_vdat(vdat_exe_path = "C:/Program Files/Innovasea/Fathom")
-#use full path to VDAT.exe
+# use full path to VDAT.exe
check_vdat(vdat_exe_path = "C:/Program Files/Innovasea/Fathom/VDAT.exe")
-
-
}
}
diff --git a/man/check_vue.Rd b/man/check_vue.Rd
index 2c9ee41b..dc254ceb 100644
--- a/man/check_vue.Rd
+++ b/man/check_vue.Rd
@@ -19,20 +19,18 @@ Character string with command for calling VUE.exe via
Check path to Innovasea program VUE.exe
}
\examples{
-
\dontrun{
-#use Windows system PATH variable
+# use Windows system PATH variable
check_vue()
-#use path to directory containing VUE.exe
+# use path to directory containing VUE.exe
check_vue(vue_exe_path = "C:/Program Files (x86)/VEMCO/VUE")
-#use full path to VUE.exe
+# use full path to VUE.exe
check_vue(vue_exe_path = "C:/Program Files (x86)/VEMCO/VUE/VUE.exe")
-
}
}
diff --git a/man/convert_glatos_to_att.Rd b/man/convert_glatos_to_att.Rd
index 27d91834..b745720b 100644
--- a/man/convert_glatos_to_att.Rd
+++ b/man/convert_glatos_to_att.Rd
@@ -40,11 +40,13 @@ in a comment by Ryan Gosse.
library(glatos)
wal_det_file <- system.file("extdata", "walleye_detections.csv",
- package = "glatos")
+ package = "glatos"
+)
walleye_detections <- read_glatos_detections(wal_det_file) # load walleye data
rec_file <- system.file("extdata", "sample_receivers.csv",
- package = "glatos")
+ package = "glatos"
+)
rcv <- read_glatos_receivers(rec_file) # load receiver data
ATTdata <- convert_glatos_to_att(walleye_detections, rcv)
diff --git a/man/convert_otn_erddap_to_att.Rd b/man/convert_otn_erddap_to_att.Rd
index 48158ed9..ba0d3b46 100644
--- a/man/convert_otn_erddap_to_att.Rd
+++ b/man/convert_otn_erddap_to_att.Rd
@@ -54,31 +54,37 @@ that this only contains public data.
library(glatos)
-#get path to example files from OTN ERDDAP
+# get path to example files from OTN ERDDAP
ani_erd_file <- system.file("extdata", "otn_aat_animals.csv",
- package = "glatos")
+ package = "glatos"
+)
animals <- read.csv(ani_erd_file) # load the CSVs from ERDDAP
tags_erd_file <- system.file("extdata", "otn_aat_tag_releases.csv",
- package = "glatos")
+ package = "glatos"
+)
tags <- read.csv(tags_erd_file)
rcv_erd_file <- system.file("extdata", "otn_aat_receivers.csv",
- package = "glatos")
+ package = "glatos"
+)
stations <- read.csv(rcv_erd_file)
-#Remove first row; (blank or metadata about the column)
-animals <- animals[-1,]
-tags <- tags[-1,]
-stations <- stations[-1,]
+# Remove first row; (blank or metadata about the column)
+animals <- animals[-1, ]
+tags <- tags[-1, ]
+stations <- stations[-1, ]
-#get blue shark example data
+# get blue shark example data
shrk_det_file <- system.file("extdata", "blue_shark_detections.csv",
- package = "glatos")
+ package = "glatos"
+)
blue_shark_detections <- read_otn_detections(shrk_det_file) # load shark data
-ATTdata <- convert_otn_erddap_to_att(blue_shark_detections,
- tags, stations, animals)
+ATTdata <- convert_otn_erddap_to_att(
+ blue_shark_detections,
+ tags, stations, animals
+)
}
\author{
Ryan Gosse
diff --git a/man/convert_otn_to_att.Rd b/man/convert_otn_to_att.Rd
index c3360aa8..0d3a0bf8 100644
--- a/man/convert_otn_to_att.Rd
+++ b/man/convert_otn_to_att.Rd
@@ -59,11 +59,14 @@ in a comment by Ryan Gosse.
library(glatos)
dets_path <- system.file("extdata", "blue_shark_detections.csv",
- package = "glatos")
+ package = "glatos"
+)
deploy_path <- system.file("extdata", "hfx_deployments.csv",
- package = "glatos")
+ package = "glatos"
+)
tag_path <- system.file("extdata", "otn_nsbs_tag_metadata.xls",
- package = "glatos")
+ package = "glatos"
+)
dets <- read_otn_detections(dets_path)
tags <- prepare_tag_sheet(tag_path, 5, 2)
@@ -77,11 +80,14 @@ ATTdata <- convert_otn_to_att(dets, tags, deploymentObj = deploy)
library(glatos)
dets_path <- system.file("extdata", "blue_shark_detections.csv",
- package = "glatos")
+ package = "glatos"
+)
deploy_path <- system.file("extdata", "hfx_deploy_simplified.xlsx",
- package = "glatos")
+ package = "glatos"
+)
tag_path <- system.file("extdata", "otn_nsbs_tag_metadata.xls",
- package = "glatos")
+ package = "glatos"
+)
dets <- read_otn_detections(dets_path)
tags <- prepare_tag_sheet(tag_path, 5, 2)
diff --git a/man/crw.Rd b/man/crw.Rd
index 04f6836c..c5c822a2 100644
--- a/man/crw.Rd
+++ b/man/crw.Rd
@@ -44,9 +44,11 @@ to obtain the simualted path.
Adapted from code provided by Tom Binder.
}
\examples{
-foo <- crw(theta=c(0,5), stepLen=10, initPos=c(0,0), initHeading=0,
- nsteps=10)
-plot(foo,type="o",pch=20,asp=c(1,1))
+foo <- crw(
+ theta = c(0, 5), stepLen = 10, initPos = c(0, 0), initHeading = 0,
+ nsteps = 10
+)
+plot(foo, type = "o", pch = 20, asp = c(1, 1))
}
\author{
diff --git a/man/crw_in_polygon.Rd b/man/crw_in_polygon.Rd
index 77bd4c5b..fca0b6ec 100644
--- a/man/crw_in_polygon.Rd
+++ b/man/crw_in_polygon.Rd
@@ -93,84 +93,104 @@ River system.
\examples{
# Example 1 - data.frame input
-mypolygon <- data.frame(x = c(-50,-50, 50, 50), y = c(-50,50,50,-50))
+mypolygon <- data.frame(x = c(-50, -50, 50, 50), y = c(-50, 50, 50, -50))
-path_df <- crw_in_polygon(mypolygon, theta = c(0, 20), stepLen = 10,
- initPos=c(0,0), initHeading=0, nsteps=50, sp_out = FALSE)
+path_df <- crw_in_polygon(mypolygon,
+ theta = c(0, 20), stepLen = 10,
+ initPos = c(0, 0), initHeading = 0, nsteps = 50, sp_out = FALSE
+)
-class(path_df) #note object is data.frame
+class(path_df) # note object is data.frame
-plot(path_df, type = "o", pch = 20, asp = c(1,1),
- xlim = range(mypolygon$x), ylim = range(mypolygon$y))
+plot(path_df,
+ type = "o", pch = 20, asp = c(1, 1),
+ xlim = range(mypolygon$x), ylim = range(mypolygon$y)
+)
polygon(mypolygon, border = "red")
# Example 2 - data.frame input; input CRS specified
-mypolygon <- data.frame(x = c(-84,-85, -85, -84),
- y = c(45, 44, 45, 45))
-path_df <- crw_in_polygon(mypolygon,
- theta = c(0, 20),
- stepLen = 1000,
- initPos = c(-84.75, 44.75),
- initHeading = 0,
- nsteps = 50,
- inputCRS = 4326,
- cartesianCRS = 3175,
- sp_out = FALSE)
-plot(path_df, type = "o", pch = 20, asp = c(1,1),
- xlim = range(mypolygon$x), ylim = range(mypolygon$y))
-class(path_df) #note object is data.frame
+mypolygon <- data.frame(
+ x = c(-84, -85, -85, -84),
+ y = c(45, 44, 45, 45)
+)
+path_df <- crw_in_polygon(mypolygon,
+ theta = c(0, 20),
+ stepLen = 1000,
+ initPos = c(-84.75, 44.75),
+ initHeading = 0,
+ nsteps = 50,
+ inputCRS = 4326,
+ cartesianCRS = 3175,
+ sp_out = FALSE
+)
+plot(path_df,
+ type = "o", pch = 20, asp = c(1, 1),
+ xlim = range(mypolygon$x), ylim = range(mypolygon$y)
+)
+class(path_df) # note object is data.frame
polygon(mypolygon, border = "red")
# Example 3 - sf POLYGON input
data(great_lakes_polygon)
-#simulate in great lakes polygon
+# simulate in great lakes polygon
path_sf <- crw_in_polygon(great_lakes_polygon,
- theta = c(0, 25),
- stepLen = 10000,
- initHeading = 0,
- nsteps = 100,
- cartesianCRS = 3175)
+ theta = c(0, 25),
+ stepLen = 10000,
+ initHeading = 0,
+ nsteps = 100,
+ cartesianCRS = 3175
+)
-#plot
+# plot
plot(sf::st_geometry(great_lakes_polygon),
- col = "lightgrey",
- border = "grey")
+ col = "lightgrey",
+ border = "grey"
+)
points(sf::st_coordinates(path_sf), type = "o", pch = 20, col = "red")
-#zoom in
-plot(sf::st_geometry(great_lakes_polygon), col = "lightgrey",
- xlim = sf::st_bbox(path_sf)[c("xmin", "xmax")],
- ylim = sf::st_bbox(path_sf)[c("ymin", "ymax")])
-points(sf::st_coordinates(path_sf),type="o", pch = 20, col = "red")
+# zoom in
+plot(sf::st_geometry(great_lakes_polygon),
+ col = "lightgrey",
+ xlim = sf::st_bbox(path_sf)[c("xmin", "xmax")],
+ ylim = sf::st_bbox(path_sf)[c("ymin", "ymax")]
+)
+points(sf::st_coordinates(path_sf), type = "o", pch = 20, col = "red")
# Example 4 - SpatialPolygonsDataFrame input
data(greatLakesPoly)
-#simulate in great lakes polygon
-path_sp <- crw_in_polygon(greatLakesPoly,
- theta = c(0, 25),
- stepLen = 10000,
- initHeading = 0,
- nsteps = 100,
- cartesianCRS = 3175,
- sp_out = TRUE)
+# simulate in great lakes polygon
+path_sp <- crw_in_polygon(greatLakesPoly,
+ theta = c(0, 25),
+ stepLen = 10000,
+ initHeading = 0,
+ nsteps = 100,
+ cartesianCRS = 3175,
+ sp_out = TRUE
+)
-#plot
+# plot
plot(sf::st_as_sfc(greatLakesPoly), col = "lightgrey", border = "grey")
-points(sf::st_coordinates(sf::st_as_sf(path_sp)), type = "o", pch = 20,
- col = "red")
-
-#zoom in
-plot(sf::st_as_sfc(greatLakesPoly), col = "lightgrey", border = "grey",
- xlim = sf::st_bbox(path_sp)[c("xmin", "xmax")],
- ylim = sf::st_bbox(path_sp)[c("ymin", "ymax")])
-points(sf::st_coordinates(sf::st_as_sf(path_sp)), type = "o", pch = 20,
- col = "red")
+points(sf::st_coordinates(sf::st_as_sf(path_sp)),
+ type = "o", pch = 20,
+ col = "red"
+)
+
+# zoom in
+plot(sf::st_as_sfc(greatLakesPoly),
+ col = "lightgrey", border = "grey",
+ xlim = sf::st_bbox(path_sp)[c("xmin", "xmax")],
+ ylim = sf::st_bbox(path_sp)[c("ymin", "ymax")]
+)
+points(sf::st_coordinates(sf::st_as_sf(path_sp)),
+ type = "o", pch = 20,
+ col = "red"
+)
}
\seealso{
diff --git a/man/detect_transmissions.Rd b/man/detect_transmissions.Rd
index e67be6e4..015ea514 100644
--- a/man/detect_transmissions.Rd
+++ b/man/detect_transmissions.Rd
@@ -98,105 +98,123 @@ This function was written to be used along with
}
\examples{
-#Example 1 - data.frame input (make a simple path in polygon)
+# Example 1 - data.frame input (make a simple path in polygon)
-mypoly <- data.frame(x = c(0, 0, 1000, 1000),
- y = c(0, 1000, 1000, 0))
+mypoly <- data.frame(
+ x = c(0, 0, 1000, 1000),
+ y = c(0, 1000, 1000, 0)
+)
+
+mypath <- crw_in_polygon(mypoly,
+ stepLen = 100,
+ nsteps = 50,
+ sp_out = FALSE
+)
-mypath <- crw_in_polygon(mypoly,
- stepLen = 100,
- nsteps = 50,
- sp_out = FALSE)
-
plot(mypath, type = "l", xlim = c(0, 1000), ylim = c(0, 1000))
-#add receivers
+# add receivers
recs <- expand.grid(x = c(250, 750), y = c(250, 750))
points(recs, pch = 15, col = "blue")
-#simulate tag transmissions
-mytrns <- transmit_along_path(mypath, vel = 2.0, delayRng = c(60, 180),
- burstDur = 5.0, sp_out = FALSE)
-points(mytrns, pch = 21) #add to plot
+# simulate tag transmissions
+mytrns <- transmit_along_path(mypath,
+ vel = 2.0, delayRng = c(60, 180),
+ burstDur = 5.0, sp_out = FALSE
+)
+points(mytrns, pch = 21) # add to plot
-#Define detection range function (to pass as detRngFun)
+# Define detection range function (to pass as detRngFun)
# that returns detection probability for given distance
# assume logistic form of detection range curve where
# dm = distance in meters
# b = intercept and slope
-pdrf <- function(dm, b=c(0.5, -1/120)){
- p <- 1/(1+exp(-(b[1]+b[2]*dm)))
+pdrf <- function(dm, b = c(0.5, -1 / 120)) {
+ p <- 1 / (1 + exp(-(b[1] + b[2] * dm)))
return(p)
}
-pdrf(c(100,200,300,400,500)) #view detection probs. at some distances
-
-#simulate detection
-mydtc <- detect_transmissions(trnsLoc = mytrns,
- recLoc = recs,
- detRngFun = pdrf,
- sp_out = FALSE)
-
+pdrf(c(100, 200, 300, 400, 500)) # view detection probs. at some distances
+
+# simulate detection
+mydtc <- detect_transmissions(
+ trnsLoc = mytrns,
+ recLoc = recs,
+ detRngFun = pdrf,
+ sp_out = FALSE
+)
+
points(mydtc[, c("trns_x", "trns_y")], pch = 21, bg = "red")
-#link transmitter and receiver locations for each detection\
-with(mydtc, segments(x0 = trns_x,
- y0 = trns_y,
- x1 = rec_x,
- y1 = rec_y,
- col = "red"))
-
-
-#Example 2 - spatial (sf) input
+# link transmitter and receiver locations for each detection\
+with(mydtc, segments(
+ x0 = trns_x,
+ y0 = trns_y,
+ x1 = rec_x,
+ y1 = rec_y,
+ col = "red"
+))
+
+
+# Example 2 - spatial (sf) input
data(great_lakes_polygon)
set.seed(610)
-mypath <- crw_in_polygon(great_lakes_polygon,
- stepLen = 100,
- initPos = c(-83.7, 43.8),
- initHeading = 0,
- nsteps = 50,
- cartesianCRS = 3175)
-
+mypath <- crw_in_polygon(great_lakes_polygon,
+ stepLen = 100,
+ initPos = c(-83.7, 43.8),
+ initHeading = 0,
+ nsteps = 50,
+ cartesianCRS = 3175
+)
+
plot(sf::st_geometry(mypath), type = "l")
-#add receivers
-recs <- expand.grid(x = c(-83.705, -83.70),
- y = c(43.810, 43.815))
+# add receivers
+recs <- expand.grid(
+ x = c(-83.705, -83.70),
+ y = c(43.810, 43.815)
+)
points(recs, pch = 15, col = "blue")
-#simulate tag transmissions
-mytrns <- transmit_along_path(mypath, vel = 2.0, delayRng = c(60, 180),
- burstDur = 5.0)
-points(sf::st_coordinates(mytrns), pch = 21) #add to plot
+# simulate tag transmissions
+mytrns <- transmit_along_path(mypath,
+ vel = 2.0, delayRng = c(60, 180),
+ burstDur = 5.0
+)
+points(sf::st_coordinates(mytrns), pch = 21) # add to plot
-#Define detection range function (to pass as detRngFun)
+# Define detection range function (to pass as detRngFun)
# that returns detection probability for given distance
# assume logistic form of detection range curve where
# dm = distance in meters
# b = intercept and slope
-pdrf <- function(dm, b=c(2, -1/120)){
- p <- 1/(1+exp(-(b[1]+b[2]*dm)))
+pdrf <- function(dm, b = c(2, -1 / 120)) {
+ p <- 1 / (1 + exp(-(b[1] + b[2] * dm)))
return(p)
}
-pdrf(c(100,200,300,400,500)) #view detection probs. at some distances
-
-#simulate detection
-mydtc <- detect_transmissions(trnsLoc = mytrns,
- recLoc = recs,
- detRngFun = pdrf)
-
-#view transmissions that were detected
+pdrf(c(100, 200, 300, 400, 500)) # view detection probs. at some distances
+
+# simulate detection
+mydtc <- detect_transmissions(
+ trnsLoc = mytrns,
+ recLoc = recs,
+ detRngFun = pdrf
+)
+
+# view transmissions that were detected
sf::st_geometry(mydtc) <- "trns_geometry"
points(sf::st_coordinates(mydtc$trns_geometry), pch = 21, bg = "red")
-#link transmitter and receiver locations for each detection
-segments(x0 = sf::st_coordinates(mydtc$trns_geometry)[,"X"],
- y0 = sf::st_coordinates(mydtc$trns_geometry)[,"Y"],
- x1 = sf::st_coordinates(mydtc$rec_geometry)[,"X"],
- y1 = sf::st_coordinates(mydtc$rec_geometry)[,"Y"],
- col = "red")
+# link transmitter and receiver locations for each detection
+segments(
+ x0 = sf::st_coordinates(mydtc$trns_geometry)[, "X"],
+ y0 = sf::st_coordinates(mydtc$trns_geometry)[, "Y"],
+ x1 = sf::st_coordinates(mydtc$rec_geometry)[, "X"],
+ y1 = sf::st_coordinates(mydtc$rec_geometry)[, "Y"],
+ col = "red"
+)
}
\seealso{
diff --git a/man/detection_bubble_plot.Rd b/man/detection_bubble_plot.Rd
index b859e3c5..4716f7bd 100644
--- a/man/detection_bubble_plot.Rd
+++ b/man/detection_bubble_plot.Rd
@@ -91,7 +91,7 @@ and upper right coordinates of the rectangle of colors
}
\value{
A data frame produced by
-\code{glatos::summarize_detections(det, location_col = location_col, receiver_locs = receiver_locs, summ_type = "location")}
+\code{glatos::summarize_detections(det, location_col = location_col, receiver_locs = receiver_locs, summ_type = "location")}
If not out_file is specified, then an image is printed to the
default plot device. If out_file is specified, then an image of
@@ -120,22 +120,24 @@ which will accept a vector containing any two colors return by
}
\examples{
-#get path to example detection file
+# get path to example detection file
det_file <- system.file("extdata", "walleye_detections.csv",
- package = "glatos")
+ package = "glatos"
+)
det <- read_glatos_detections(det_file)
-#call with defaults
+# call with defaults
detection_bubble_plot(det, map = great_lakes_polygon)
-#change symbol size and color
+# change symbol size and color
detection_bubble_plot(det, symbol_radius = 2, col_grad = c("grey90", "grey10"))
-#Add all receivers
+# Add all receivers
# get path to example receiver file
rec_file <- system.file("extdata", "sample_receivers.csv",
- package = "glatos")
+ package = "glatos"
+)
rec <- read_glatos_receivers(rec_file)
detection_bubble_plot(det, receiver_locs = rec)
@@ -146,7 +148,8 @@ detection_bubble_plot(det, receiver_locs = rec)
# get path to example receiver file
rec_file <- system.file("extdata", "sample_receivers.csv",
- package = "glatos")
+ package = "glatos"
+)
rec <- read_glatos_receivers(rec_file)
first <- min(det$detection_timestamp_utc) # time of first detection
@@ -155,9 +158,9 @@ last <- max(det$detection_timestamp_utc) # time of last detection
# Subset receiver deployments oustide the detection period.
# !is.na(rec$recover_date_time) eliminates receivers that have been
# deployed but not yet recovered.
-plot_rec <- rec[rec$deploy_date_time < last &
- rec$recover_date_time > first &
- !is.na(rec$recover_date_time),]
+plot_rec <- rec[rec$deploy_date_time < last &
+ rec$recover_date_time > first &
+ !is.na(rec$recover_date_time), ]
detection_bubble_plot(det, receiver_locs = plot_rec)
diff --git a/man/detection_events.Rd b/man/detection_events.Rd
index b70209a8..a687b63d 100644
--- a/man/detection_events.Rd
+++ b/man/detection_events.Rd
@@ -66,8 +66,10 @@ detection event.}
\item{res_time_sec}{The elapsed time in seconds between the first and last
detection in a given event.}
-If \code{condense = FALSE}, a data.frame, data.table, or tibble matching the
-input data frame \code{det} with the following columns added:
+\if{html}{\out{
}}\preformatted{If `condense = FALSE`, a data.frame, data.table, or tibble matching the
+input data frame `det` with the following columns added:
+}\if{html}{\out{
}}
+
\item{time_diff}{Lagged time difference in seconds between successive
detections of each animal_id.}
\item{arrive}{Flag (0 or 1) representing the first detection in each
@@ -93,18 +95,19 @@ detections that occurred on each station).
}
\examples{
-#get path to example detection file
+# get path to example detection file
det_file <- system.file("extdata", "walleye_detections.csv",
- package = "glatos")
+ package = "glatos"
+)
det <- read_glatos_detections(det_file)
-filt0 <- detection_events(det) #no time filter
+filt0 <- detection_events(det) # no time filter
-#7-day filter
-filt_7d <- detection_events(det , time_sep = 604800)
+# 7-day filter
+filt_7d <- detection_events(det, time_sep = 604800)
-#7-day filter but return do not condense result
-filt_7d <- detection_events(det , time_sep = 604800, condense = FALSE)
+# 7-day filter but return do not condense result
+filt_7d <- detection_events(det, time_sep = 604800, condense = FALSE)
}
\author{
diff --git a/man/false_detections.Rd b/man/false_detections.Rd
index 2b91317b..9b5ba8a5 100644
--- a/man/false_detections.Rd
+++ b/man/false_detections.Rd
@@ -72,15 +72,16 @@ sensitivity of the proportion of detections removed to the choice of
\code{tf}.
}
\examples{
-#get path to example detection file
+# get path to example detection file
det_file <- system.file("extdata", "walleye_detections.csv",
- package = "glatos")
+ package = "glatos"
+)
det <- read_glatos_detections(det_file)
det <- false_detections(det, 3600)
head(det)
-#plot sensitivity to tf
+# plot sensitivity to tf
det <- false_detections(det, 3600, show_plot = TRUE)
}
diff --git a/man/format_POSIXt.Rd b/man/format_POSIXt.Rd
index e26ea2f6..f2e60711 100644
--- a/man/format_POSIXt.Rd
+++ b/man/format_POSIXt.Rd
@@ -43,10 +43,14 @@ format(t2, digits = 6)
t3 <- format_POSIXt(t1, digits = 5)
format(t3, digits = 6)
-#Example 2
-t1 <- as.POSIXct(c("2011-03-08 23:59:58",
- "2011-03-08 23:59:58.828867"),
- tz = "UTC")
+# Example 2
+t1 <- as.POSIXct(
+ c(
+ "2011-03-08 23:59:58",
+ "2011-03-08 23:59:58.828867"
+ ),
+ tz = "UTC"
+)
format_POSIXt(t1, digits = 5, drop0trailing = FALSE)
format_POSIXt(t1, digits = 5, drop0trailing = TRUE)
diff --git a/man/get_local_vdat_schema.Rd b/man/get_local_vdat_schema.Rd
index fa9535aa..d4cef8aa 100644
--- a/man/get_local_vdat_schema.Rd
+++ b/man/get_local_vdat_schema.Rd
@@ -20,13 +20,14 @@ Get schema from local installation of Innovsea program VDAT.exe
\examples{
\dontrun{
-#use if VDAT.exe in Windows system PATH variable
+# use if VDAT.exe in Windows system PATH variable
get_local_vdat_schema()
-#or specify path to VDAT.exe
-get_local_vdat_schema(vdat_exe_path =
- "C:/Program Files/Innovasea/Fathom/VDAT.exe")
-
+# or specify path to VDAT.exe
+get_local_vdat_schema(
+ vdat_exe_path =
+ "C:/Program Files/Innovasea/Fathom/VDAT.exe"
+)
}
}
diff --git a/man/get_local_vdat_version.Rd b/man/get_local_vdat_version.Rd
index ca55a01f..82aa832d 100644
--- a/man/get_local_vdat_version.Rd
+++ b/man/get_local_vdat_version.Rd
@@ -19,15 +19,16 @@ string returned by VDAT.exe).
Get version of local installation of Innovasea program VDAT.exe
}
\examples{
-
\dontrun{
-#use if VDAT.exe in Windows system PATH variable
+# use if VDAT.exe in Windows system PATH variable
get_local_vdat_version()
-#or specify path to VDAT.exe
-get_local_vdat_version(vdat_exe_path =
- "C:/Program Files/Innovasea/Fathom/VDAT.exe")
+# or specify path to VDAT.exe
+get_local_vdat_version(
+ vdat_exe_path =
+ "C:/Program Files/Innovasea/Fathom/VDAT.exe"
+)
}
}
diff --git a/man/get_local_vue_version.Rd b/man/get_local_vue_version.Rd
index 3372165c..15321894 100644
--- a/man/get_local_vue_version.Rd
+++ b/man/get_local_vue_version.Rd
@@ -19,16 +19,16 @@ string returned by VUE.exe).
Get version of local installation of Innovasea program VUE.exe
}
\examples{
-
\dontrun{
-#use if VUE.exe in Windows system PATH variable
+# use if VUE.exe in Windows system PATH variable
get_local_vue_version()
-#or specify path to VUE.exe
-get_local_vue_version(vue_exe_path =
- "C:/Program Files (x86)/Vemco/VUE")
-
+# or specify path to VUE.exe
+get_local_vue_version(
+ vue_exe_path =
+ "C:/Program Files (x86)/Vemco/VUE"
+)
}
}
diff --git a/man/glatos_animals.Rd b/man/glatos_animals.Rd
index fbde1400..207f92eb 100644
--- a/man/glatos_animals.Rd
+++ b/man/glatos_animals.Rd
@@ -61,20 +61,28 @@ required column names and classes using \code{validate_glatos_animals()}.
\examples{
# glatos_animals
-x = data.frame(animal_id = c("120", "107", "109"),
- tag_id_code = c("32024", "32012", "32014"),
- tag_code_space = c("A69-9001", "A69-9001", "A69-9001"),
- utc_release_date_time = as.POSIXct(c("2011-03-28 00:00:00",
- "2011-03-28 00:01:00",
- "2011-03-28 00:05:00"),
- tz = "UTC"),
- release_latitude = c(41.56093, 41.56093, 41.56093),
- release_longitude = c(-83.645, -83.645, -83.645))
-
-ga_df1 <- glatos_animals(animal_id = x$animal_id,
- tag_id_code = x$tag_id_code,
- tag_code_space = x$tag_code_space,
- utc_release_date_time = x$utc_release_date_time)
+x <- data.frame(
+ animal_id = c("120", "107", "109"),
+ tag_id_code = c("32024", "32012", "32014"),
+ tag_code_space = c("A69-9001", "A69-9001", "A69-9001"),
+ utc_release_date_time = as.POSIXct(
+ c(
+ "2011-03-28 00:00:00",
+ "2011-03-28 00:01:00",
+ "2011-03-28 00:05:00"
+ ),
+ tz = "UTC"
+ ),
+ release_latitude = c(41.56093, 41.56093, 41.56093),
+ release_longitude = c(-83.645, -83.645, -83.645)
+)
+
+ga_df1 <- glatos_animals(
+ animal_id = x$animal_id,
+ tag_id_code = x$tag_id_code,
+ tag_code_space = x$tag_code_space,
+ utc_release_date_time = x$utc_release_date_time
+)
# as_glatos_animals
@@ -86,7 +94,8 @@ ga_df2 <- as_glatos_animals(x)
library(sf)
x_sf <- sf::st_as_sf(x,
- coords = c("release_longitude", "release_latitude"))
+ coords = c("release_longitude", "release_latitude")
+)
ga_sf <- as_glatos_animals(x_sf)
@@ -100,17 +109,20 @@ ga_tbl <- as_glatos_animals(x_tbl)
# data.frame input; missing column name
-library(dplyr) #for rename
+library(dplyr) # for rename
x2 <- rename(x,
- fish_name = animal_id,
- release_timestamp = utc_release_date_time)
+ fish_name = animal_id,
+ release_timestamp = utc_release_date_time
+)
ga2 <- as_glatos_animals(x2)
# data.grame input; wrong column class
-x3 <- mutate(x, animal_id = as.integer(animal_id),
- utc_release_date_time = as.character(utc_release_date_time))
+x3 <- mutate(x,
+ animal_id = as.integer(animal_id),
+ utc_release_date_time = as.character(utc_release_date_time)
+)
ga3 <- as_glatos_animals(x3)
@@ -119,7 +131,7 @@ ga3 <- as_glatos_animals(x3)
validate_glatos_animals(x)
-is_glatos_animals(x) #FALSE
+is_glatos_animals(x) # FALSE
-is_glatos_animals(ga_df1) #TRUE
+is_glatos_animals(ga_df1) # TRUE
}
diff --git a/man/glatos_detections.Rd b/man/glatos_detections.Rd
index 3360047a..edbf8d43 100644
--- a/man/glatos_detections.Rd
+++ b/man/glatos_detections.Rd
@@ -61,20 +61,28 @@ required column names and classes using \code{validate_glatos_detections()}.
\examples{
# glatos_detections
-x = data.frame(animal_id = c("153", "153", "153", "153"),
- detection_timestamp_utc = as.POSIXct(c("2012-04-29 01:48:37",
- "2012-04-29 01:52:55",
- "2012-04-29 01:55:12",
- "2012-04-29 01:56:42"),
- tz = "UTC"),
- deploy_lat =c(43.39165, 43.39165, 43.39165, 43.39165),
- deploy_long = c(-83.99264, -83.99264, -83.99264, -83.99264))
-
-gd_df1 <- glatos_detections(animal_id = x$animal_id,
- detection_timestamp_utc =
- x$detection_timestamp_utc,
- deploy_lat = x$deploy_lat,
- deploy_long = x$deploy_long)
+x <- data.frame(
+ animal_id = c("153", "153", "153", "153"),
+ detection_timestamp_utc = as.POSIXct(
+ c(
+ "2012-04-29 01:48:37",
+ "2012-04-29 01:52:55",
+ "2012-04-29 01:55:12",
+ "2012-04-29 01:56:42"
+ ),
+ tz = "UTC"
+ ),
+ deploy_lat = c(43.39165, 43.39165, 43.39165, 43.39165),
+ deploy_long = c(-83.99264, -83.99264, -83.99264, -83.99264)
+)
+
+gd_df1 <- glatos_detections(
+ animal_id = x$animal_id,
+ detection_timestamp_utc =
+ x$detection_timestamp_utc,
+ deploy_lat = x$deploy_lat,
+ deploy_long = x$deploy_long
+)
# as_glatos_detections
@@ -87,8 +95,9 @@ library(sf)
# use remove = FALSE to keep required columns
x_sf <- sf::st_as_sf(x,
- coords = c("deploy_long", "deploy_lat"),
- remove = FALSE)
+ coords = c("deploy_long", "deploy_lat"),
+ remove = FALSE
+)
gd_sf <- as_glatos_detections(x_sf)
@@ -102,18 +111,20 @@ gd_tbl <- as_glatos_detections(x_tbl)
# data.frame input; missing column name
-library(dplyr) #for rename
+library(dplyr) # for rename
x2 <- rename(x,
- fish_id = animal_id,
- det_date_time = detection_timestamp_utc)
+ fish_id = animal_id,
+ det_date_time = detection_timestamp_utc
+)
gd2 <- as_glatos_detections(x2)
# data.frame input; wrong column class
-x3 <- mutate(x,
- animal_id = as.integer(animal_id),
- detection_timestamp_utc = as.character(detection_timestamp_utc))
+x3 <- mutate(x,
+ animal_id = as.integer(animal_id),
+ detection_timestamp_utc = as.character(detection_timestamp_utc)
+)
gr3 <- as_glatos_detections(x3)
@@ -122,7 +133,7 @@ gr3 <- as_glatos_detections(x3)
validate_glatos_detections(x)
-is_glatos_detections(x) #FALSE
+is_glatos_detections(x) # FALSE
-is_glatos_detections(gd_df1) #TRUE
+is_glatos_detections(gd_df1) # TRUE
}
diff --git a/man/glatos_receivers.Rd b/man/glatos_receivers.Rd
index 854c890c..70cbe91e 100644
--- a/man/glatos_receivers.Rd
+++ b/man/glatos_receivers.Rd
@@ -64,27 +64,39 @@ required column names and classes using \code{validate_glatos_receivers()}.
\examples{
# glatos_receivers
-x = data.frame(station = c("WHT-009", "FDT-001", "FDT-004", "FDT-003"),
- deploy_lat = c(43.7, 45.9, 45.9, 45.9),
- deploy_long = c(-82.5, -83.5, -83.5, -83.5),
- deploy_date_time = as.POSIXct(c("2010-09-22 18:05:00",
- "2010-11-12 15:07:00",
- "2010-11-12 15:36:00",
- "2010-11-12 15:56:00"),
- tz = "UTC"),
- recover_date_time = as.POSIXct(c("2012-08-15 16:52:00",
- "2012-05-15 13:25:00",
- "2012-05-15 14:15:00",
- "2012-05-15 14:40:00"),
- tz = "UTC"),
- ins_serial_no = c("109450", "442", "441", "444"))
-
-gr_df1 <- glatos_receivers(station = x$station,
- deploy_lat = x$deploy_lat,
- deploy_long = x$deploy_long,
- deploy_date_time = x$deploy_date_time,
- recover_date_time = x$recover_date_time,
- ins_serial_no = x$ins_serial_no)
+x <- data.frame(
+ station = c("WHT-009", "FDT-001", "FDT-004", "FDT-003"),
+ deploy_lat = c(43.7, 45.9, 45.9, 45.9),
+ deploy_long = c(-82.5, -83.5, -83.5, -83.5),
+ deploy_date_time = as.POSIXct(
+ c(
+ "2010-09-22 18:05:00",
+ "2010-11-12 15:07:00",
+ "2010-11-12 15:36:00",
+ "2010-11-12 15:56:00"
+ ),
+ tz = "UTC"
+ ),
+ recover_date_time = as.POSIXct(
+ c(
+ "2012-08-15 16:52:00",
+ "2012-05-15 13:25:00",
+ "2012-05-15 14:15:00",
+ "2012-05-15 14:40:00"
+ ),
+ tz = "UTC"
+ ),
+ ins_serial_no = c("109450", "442", "441", "444")
+)
+
+gr_df1 <- glatos_receivers(
+ station = x$station,
+ deploy_lat = x$deploy_lat,
+ deploy_long = x$deploy_long,
+ deploy_date_time = x$deploy_date_time,
+ recover_date_time = x$recover_date_time,
+ ins_serial_no = x$ins_serial_no
+)
# as_glatos_receivers
@@ -97,8 +109,9 @@ library(sf)
# use remove = FALSE to keep required columns
x_sf <- sf::st_as_sf(x,
- coords = c("deploy_long", "deploy_lat"),
- remove = FALSE)
+ coords = c("deploy_long", "deploy_lat"),
+ remove = FALSE
+)
gr_sf <- as_glatos_receivers(x_sf)
@@ -112,17 +125,20 @@ gr_tbl <- as_glatos_receivers(x_tbl)
# data.frame input; missing column name
-library(dplyr) #for rename
+library(dplyr) # for rename
x2 <- rename(x,
- receiver_loc = station,
- deploy_timestamp = deploy_date_time)
+ receiver_loc = station,
+ deploy_timestamp = deploy_date_time
+)
gr2 <- as_glatos_receivers(x2)
# data.frame input; wrong column class
-x3 <- mutate(x, ins_serial_no = as.integer(ins_serial_no),
- deploy_date_time = as.character(deploy_date_time))
+x3 <- mutate(x,
+ ins_serial_no = as.integer(ins_serial_no),
+ deploy_date_time = as.character(deploy_date_time)
+)
gr3 <- as_glatos_receivers(x3)
@@ -131,7 +147,7 @@ gr3 <- as_glatos_receivers(x3)
validate_glatos_receivers(x)
-is_glatos_receivers(x) #FALSE
+is_glatos_receivers(x) # FALSE
-is_glatos_receivers(gr_df1) #TRUE
+is_glatos_receivers(gr_df1) # TRUE
}
diff --git a/man/kml_to_csv.Rd b/man/kml_to_csv.Rd
index f8d4eae8..b2f470aa 100644
--- a/man/kml_to_csv.Rd
+++ b/man/kml_to_csv.Rd
@@ -34,10 +34,11 @@ saved as kml. Or extract (unzip) kml from kmz.
}
\examples{
-#Get example kml with two polygons
+# Get example kml with two polygons
kml_file <- system.file("inst/extdata", "example_polygons.kml",
- package = "glatos")
-
+ package = "glatos"
+)
+
kml_to_csv(kml_file)
}
diff --git a/man/kml_workbook.Rd b/man/kml_workbook.Rd
index 4bd97b0a..90bfab84 100644
--- a/man/kml_workbook.Rd
+++ b/man/kml_workbook.Rd
@@ -74,23 +74,26 @@ timestamps at each location. Release locations will be displayed when the
display window includes the date of release.
}
\examples{
-
\dontrun{
-#get path to example GLATOS Data Workbook
-wb_file <- system.file("extdata",
-"walleye_workbook.xlsm", package = "glatos")
+# get path to example GLATOS Data Workbook
+wb_file <- system.file("extdata",
+ "walleye_workbook.xlsm",
+ package = "glatos"
+)
-#read workbook directly
+# read workbook directly
kml_workbook(wb_file = wb_file)
-#now with bigger label and point and out_file
-kml_workbook(wb_file = wb_file, labelSize = 20, iconSize = 1,
- out_file = "bigger.kml")
+# now with bigger label and point and out_file
+kml_workbook(
+ wb_file = wb_file, labelSize = 20, iconSize = 1,
+ out_file = "bigger.kml"
+)
-#read workbook directly; output kmz
+# read workbook directly; output kmz
kml_workbook(wb_file = wb_file, kmz = TRUE)
-#get path to example GLATOS Data Workbook
+# get path to example GLATOS Data Workbook
wb <- read_glatos_workbook(wb_file)
kml_workbook(wb = wb, kmz = TRUE, out_file = "bigger.kmz")
}
diff --git a/man/make_frames.Rd b/man/make_frames.Rd
index 196d4bb8..5414ab52 100644
--- a/man/make_frames.Rd
+++ b/man/make_frames.Rd
@@ -170,12 +170,12 @@ input argument \code{preview = TRUE} will be useful while exploring optional plo
arguments.
}
\examples{
-
\dontrun{
# load detection data
det_file <- system.file("extdata", "walleye_detections.csv",
- package = "glatos")
+ package = "glatos"
+)
dtc <- read_glatos_detections(det_file)
# take a look
@@ -183,37 +183,44 @@ head(dtc)
# load receiver location data
rec_file <- system.file("extdata",
- "sample_receivers.csv", package = "glatos")
+ "sample_receivers.csv",
+ package = "glatos"
+)
recs <- read_glatos_receivers(rec_file)
# call with defaults; linear interpolation
pos1 <- interpolate_path(dtc)
# make frames, preview the first frame
-myDir <- paste0(getwd(),"/frames1")
-make_frames(pos1, recs=recs, out_dir=myDir, preview = TRUE)
+myDir <- paste0(getwd(), "/frames1")
+make_frames(pos1, recs = recs, out_dir = myDir, preview = TRUE)
# make frames but not animation
-myDir <- paste0(getwd(),"/frames2")
-make_frames(pos1, recs=recs, out_dir=myDir, animate = FALSE)
+myDir <- paste0(getwd(), "/frames2")
+make_frames(pos1, recs = recs, out_dir = myDir, animate = FALSE)
# make sequential frames, and animate. Make animation and frames.
-#change default color of fish markers to red and change marker and size.
+# change default color of fish markers to red and change marker and size.
myDir <- paste0(getwd(), "/frames3")
-make_frames(pos1, recs=recs, out_dir=myDir, animate = TRUE,
- ani_name = "animation3.mp4", col="red", pch = 16, cex = 3)
+make_frames(pos1,
+ recs = recs, out_dir = myDir, animate = TRUE,
+ ani_name = "animation3.mp4", col = "red", pch = 16, cex = 3
+)
# make sequential frames, animate, add 5-day tail
myDir <- paste0(getwd(), "/frames4")
-make_frames(pos1, recs=recs, out_dir=myDir, animate = TRUE,
- ani_name = "animation4.mp4", tail_dur=5)
+make_frames(pos1,
+ recs = recs, out_dir = myDir, animate = TRUE,
+ ani_name = "animation4.mp4", tail_dur = 5
+)
# make animation, remove frames.
myDir <- paste0(getwd(), "/frames5")
-make_frames(pos1, recs=recs, out_dir=myDir, animate = TRUE,
- ani_name = "animation5.mp4", frame_delete = TRUE)
-
+make_frames(pos1,
+ recs = recs, out_dir = myDir, animate = TRUE,
+ ani_name = "animation5.mp4", frame_delete = TRUE
+)
}
}
diff --git a/man/make_transition.Rd b/man/make_transition.Rd
index 074321cb..c366dffc 100644
--- a/man/make_transition.Rd
+++ b/man/make_transition.Rd
@@ -81,14 +81,14 @@ next version of \code{glatos}. Use \code{\link{make_transition3}} instead.
\examples{
\dontrun{
-#Example 1 - read from sf polygon
+# Example 1 - read from sf polygon
# use example polygon for Great lakes
-library(sf) #for loading great_lakes_polygon
+library(sf) # for loading great_lakes_polygon
library(raster) # for plotting rasters
# Get polygon of the Great Lakes
-data(great_lakes_polygon) #glatos example data; an sf polygons object
+data(great_lakes_polygon) # glatos example data; an sf polygons object
# Make transition layer
tst <- make_transition(great_lakes_polygon, res = c(0.1, 0.1))
@@ -97,17 +97,17 @@ tst <- make_transition(great_lakes_polygon, res = c(0.1, 0.1))
# notice land = 1, water = 0
plot(tst$rast)
-#compare to polygon
+# compare to polygon
plot(sf::st_geometry(great_lakes_polygon), add = TRUE)
-#Example 2 - read from SpatialPolygonsDataFrame
+# Example 2 - read from SpatialPolygonsDataFrame
# use example polygon for Great lakes
library(raster) # for plotting rasters
-#get polygon of the Great Lakes
-data(greatLakesPoly) #glatos example data; a SpatialPolygonsDataFrame
+# get polygon of the Great Lakes
+data(greatLakesPoly) # glatos example data; a SpatialPolygonsDataFrame
# make_transition layer
tst <- make_transition(greatLakesPoly, res = c(0.1, 0.1))
@@ -116,13 +116,13 @@ tst <- make_transition(greatLakesPoly, res = c(0.1, 0.1))
# notice land = 1, water = 0
plot(tst$rast)
-#compare to polygon
+# compare to polygon
plot(greatLakesPoly, add = TRUE)
# increase resolution and repeat if needed
#------------------------------------------
-#Example 3 - read from ESRI Shapefile
+# Example 3 - read from ESRI Shapefile
# path to polygon shapefile
poly <- system.file("extdata", "shoreline.zip", package = "glatos")
poly <- unzip(poly, exdir = tempdir())
diff --git a/man/make_transition2.Rd b/man/make_transition2.Rd
index 3abfe548..f4f46416 100644
--- a/man/make_transition2.Rd
+++ b/man/make_transition2.Rd
@@ -63,7 +63,7 @@ next version of \code{glatos}. Use \code{\link{make_transition3}} instead.
library(raster) # for plotting rasters
# get polygon of the Great Lakes
-data(greatLakesPoly) #glatos example data; a SpatialPolygonsDataFrame
+data(greatLakesPoly) # glatos example data; a SpatialPolygonsDataFrame
# make_transition layer
tst <- make_transition2(greatLakesPoly, res = c(0.1, 0.1))
@@ -86,7 +86,6 @@ plot(tst1$rast)
plot(raster(tst1$transition))
}
-
}
\seealso{
\link{make_transition}
diff --git a/man/make_video.Rd b/man/make_video.Rd
index 4e6a1aed..40b5f1b3 100644
--- a/man/make_video.Rd
+++ b/man/make_video.Rd
@@ -97,69 +97,85 @@ duration may also be controlled by setting the \code{framerate} argument of
\link[=encoding]{av::av_encode_video}. See \code{...} above.
}
\examples{
-
\dontrun{
# load frames
frames <- system.file("extdata", "frames", package = "glatos")
# make .mp4 video
-make_video(input_dir = frames,
- input_ext = ".png",
- output = file.path(tempdir(), "animation1.mp4"))
+make_video(
+ input_dir = frames,
+ input_ext = ".png",
+ output = file.path(tempdir(), "animation1.mp4")
+)
# set duration to 10 seconds
-make_video(input_dir = frames,
- input_ext = ".png",
- output = file.path(tempdir(), "animation2.mp4"),
- duration = 10)
+make_video(
+ input_dir = frames,
+ input_ext = ".png",
+ output = file.path(tempdir(), "animation2.mp4"),
+ duration = 10
+)
# set size of ouput video
-make_video(input_dir = frames,
- input_ext = ".png",
- output = file.path(tempdir(), "animation3.mp4"),
- size = c(320, 240))
+make_video(
+ input_dir = frames,
+ input_ext = ".png",
+ output = file.path(tempdir(), "animation3.mp4"),
+ size = c(320, 240)
+)
# start animation on frame 10, end on frame 20
-make_video(input_dir = frames,
- input_ext = ".png",
- output = file.path(tempdir(), "animation_4.mp4"),
- start_frame = 10,
- end_frame = 20)
+make_video(
+ input_dir = frames,
+ input_ext = ".png",
+ output = file.path(tempdir(), "animation_4.mp4"),
+ start_frame = 10,
+ end_frame = 20
+)
# make move backwards- start animation of frame 20 and end on frame 10
-make_video(input_dir = frames,
- input_ext = ".png",
- output = file.path(tempdir(), "animation_5.mp4"),
- start_frame = 20,
- end_frame = 10)
+make_video(
+ input_dir = frames,
+ input_ext = ".png",
+ output = file.path(tempdir(), "animation_5.mp4"),
+ start_frame = 20,
+ end_frame = 10
+)
# make .wmv video
-make_video(input_dir = frames,
- input_ext = ".png",
- output = file.path(tempdir(), "animation1.wmv"))
+make_video(
+ input_dir = frames,
+ input_ext = ".png",
+ output = file.path(tempdir(), "animation1.wmv")
+)
#--- Examples using more advanced features of av_encode_video
# resize output video by specifying a scale filter
-make_video(input_dir = frames,
- input_ext = ".png",
- output = file.path(tempdir(), "animation_6.mp4"),
- vfilter = "scale=320:240")
+make_video(
+ input_dir = frames,
+ input_ext = ".png",
+ output = file.path(tempdir(), "animation_6.mp4"),
+ vfilter = "scale=320:240"
+)
# slow the video by 10 times
-make_video(input_dir = frames,
- input_ext = ".png",
- output = file.path(tempdir(), "animation_7.mp4"),
- vfilter = "setpts=10*PTS")
+make_video(
+ input_dir = frames,
+ input_ext = ".png",
+ output = file.path(tempdir(), "animation_7.mp4"),
+ vfilter = "setpts=10*PTS"
+)
# slow video by 10 times and scale to 320x240 resolution
-make_video(input_dir = frames,
- input_ext = ".png",
- output = file.path(tempdir(), "animation_8.mp4"),
- vfilter = "scale=320:240, setpts=10*PTS")
-
+make_video(
+ input_dir = frames,
+ input_ext = ".png",
+ output = file.path(tempdir(), "animation_8.mp4"),
+ vfilter = "scale=320:240, setpts=10*PTS"
+)
}
}
diff --git a/man/min_lag.Rd b/man/min_lag.Rd
index 4ec6b73c..b81ecde9 100644
--- a/man/min_lag.Rd
+++ b/man/min_lag.Rd
@@ -49,7 +49,8 @@ standard glatos export.
# load example detection file
det_file <- system.file("extdata", "walleye_detections.csv",
- package = "glatos")
+ package = "glatos"
+)
det <- read_glatos_detections(det_file)
# rename existing min_lag column
diff --git a/man/point_offset.Rd b/man/point_offset.Rd
index 3ae0ae24..de2ce249 100644
--- a/man/point_offset.Rd
+++ b/man/point_offset.Rd
@@ -36,11 +36,13 @@ great circle distances.
lat <- rep(44.0, 17)
lon <- rep(-83.0, 17)
-offsetDir <- c(NA,"N", "NNE", "NE", "ENE", "E", "ESE", "SE", "SSE", "S",
-"SSW", "SW", "WSW", "W", "WNW", "NW", "NNW")
+offsetDir <- c(
+ NA, "N", "NNE", "NE", "ENE", "E", "ESE", "SE", "SSE", "S",
+ "SSW", "SW", "WSW", "W", "WNW", "NW", "NNW"
+)
-offsetDist <- seq(100, 1700, by = 100)
-distUnit <- 'm'
+offsetDist <- seq(100, 1700, by = 100)
+distUnit <- "m"
point_offset(lon, lat, offsetDist, offsetDir, distUnit)
diff --git a/man/prepare_deploy_sheet.Rd b/man/prepare_deploy_sheet.Rd
index d1fa1f75..c3c1c160 100644
--- a/man/prepare_deploy_sheet.Rd
+++ b/man/prepare_deploy_sheet.Rd
@@ -40,11 +40,13 @@ to be used by \code{convert_otn_to_att}.
library(glatos)
deploy_path <- system.file("extdata", "hfx_deploy_simplified.xlsx",
- package = "glatos")
+ package = "glatos"
+)
-deploy <- prepare_deploy_sheet(deploy_path,
- header_line = 1,
- sheet_name = 1)
+deploy <- prepare_deploy_sheet(deploy_path,
+ header_line = 1,
+ sheet_name = 1
+)
}
\author{
diff --git a/man/prepare_tag_sheet.Rd b/man/prepare_tag_sheet.Rd
index b6ee55fa..9fc4e378 100644
--- a/man/prepare_tag_sheet.Rd
+++ b/man/prepare_tag_sheet.Rd
@@ -33,7 +33,8 @@ to be used by \code{convert_otn_to_att}.
library(glatos)
tag_path <- system.file("extdata", "otn_nsbs_tag_metadata.xls",
- package = "glatos")
+ package = "glatos"
+)
tags <- prepare_tag_sheet(tag_path, 5, 2)
diff --git a/man/read_glatos_detections.Rd b/man/read_glatos_detections.Rd
index 7acff2d5..3dd8270b 100644
--- a/man/read_glatos_detections.Rd
+++ b/man/read_glatos_detections.Rd
@@ -37,13 +37,14 @@ When created, it will be constructed from \code{transmitter_codespace} and
\code{transmitter_id}, separated by '-'.
}
\examples{
-#get path to example detection file
+# get path to example detection file
det_file <- system.file("extdata", "walleye_detections.csv",
- package = "glatos")
+ package = "glatos"
+)
-#note that code above is needed to find the example file
-#for real glatos data, use something like below
-#det_file <- "c:/path_to_file/HECWL_detectionsWithLocs_20150321_132242.csv"
+# note that code above is needed to find the example file
+# for real glatos data, use something like below
+# det_file <- "c:/path_to_file/HECWL_detectionsWithLocs_20150321_132242.csv"
det <- read_glatos_detections(det_file)
diff --git a/man/read_glatos_receivers.Rd b/man/read_glatos_receivers.Rd
index 89102e5d..7a442ddc 100644
--- a/man/read_glatos_receivers.Rd
+++ b/man/read_glatos_receivers.Rd
@@ -32,13 +32,15 @@ timestamps must be 'YYYY-MM-DD HH:MM' format and in UTC timezone per GLATOS
standard.
}
\examples{
-#get path to example receiver_locations file
+# get path to example receiver_locations file
rec_file <- system.file("extdata",
- "sample_receivers.csv", package = "glatos")
+ "sample_receivers.csv",
+ package = "glatos"
+)
-#note that code above is needed to find the example file
-#for real glatos data, use something like below
-#rec_file <- "c:/path_to_file/GLATOS_receiverLocations_20150321_132242.csv"
+# note that code above is needed to find the example file
+# for real glatos data, use something like below
+# rec_file <- "c:/path_to_file/GLATOS_receiverLocations_20150321_132242.csv"
rcv <- read_glatos_receivers(rec_file)
diff --git a/man/read_glatos_workbook.Rd b/man/read_glatos_workbook.Rd
index ca387a7c..654a709b 100644
--- a/man/read_glatos_workbook.Rd
+++ b/man/read_glatos_workbook.Rd
@@ -85,13 +85,15 @@ that need reformatting, (2) select 'Text-to-columns' in the 'Data' menu,
(5) choose 'Date: YMD' in the 'Column data format' box, and (6) 'Finish'.
}
\examples{
-#get path to example GLATOS Data Workbook
+# get path to example GLATOS Data Workbook
wb_file <- system.file("extdata",
- "walleye_workbook.xlsm", package = "glatos")
+ "walleye_workbook.xlsm",
+ package = "glatos"
+)
-#note that code above is needed to find the example file
-#for real glatos data, use something like below
-#wb_file <- "c:/path_to_file/HECWL_GLATOS_20150321.csv"
+# note that code above is needed to find the example file
+# for real glatos data, use something like below
+# wb_file <- "c:/path_to_file/HECWL_GLATOS_20150321.csv"
wb <- read_glatos_workbook(wb_file)
diff --git a/man/read_otn_deployments.Rd b/man/read_otn_deployments.Rd
index d9cf36c8..aa9c88b6 100644
--- a/man/read_otn_deployments.Rd
+++ b/man/read_otn_deployments.Rd
@@ -42,9 +42,10 @@ Column names are changed to match GLATOS standard columns when possible.
Otherwise, OTN columns and column names are retained.
}
\examples{
-#get path to example deployments file
+# get path to example deployments file
deployment_file <- system.file("extdata", "hfx_deployments.csv",
- package = "glatos")
+ package = "glatos"
+)
dep <- read_otn_deployments(deployment_file)
}
diff --git a/man/read_otn_detections.Rd b/man/read_otn_detections.Rd
index b976d327..85325692 100644
--- a/man/read_otn_detections.Rd
+++ b/man/read_otn_detections.Rd
@@ -28,9 +28,10 @@ Column names are changed to match GLATOS standard columns when possible.
Otherwise, OTN columns and column names are retained.
}
\examples{
-#get path to example detection file
+# get path to example detection file
det_file <- system.file("extdata", "blue_shark_detections.csv",
- package = "glatos")
+ package = "glatos"
+)
det <- read_otn_detections(det_file)
}
diff --git a/man/read_vemco_tag_specs.Rd b/man/read_vemco_tag_specs.Rd
index 50bd5914..a92b9080 100644
--- a/man/read_vemco_tag_specs.Rd
+++ b/man/read_vemco_tag_specs.Rd
@@ -72,9 +72,11 @@ purchasers by Vemco.
This function is not endorsed or supported by any transmitter manufacturer.
}
\examples{
-#get path to example Vemco tag spec file
-spec_file <- system.file("extdata",
- "lamprey_tag_specs.xls", package = "glatos")
+# get path to example Vemco tag spec file
+spec_file <- system.file("extdata",
+ "lamprey_tag_specs.xls",
+ package = "glatos"
+)
my_tags <- read_vemco_tag_specs(spec_file, file_format = "vemco_xls")
}
diff --git a/man/read_vue_detection_csv.Rd b/man/read_vue_detection_csv.Rd
index 2f9a7de7..676e172b 100644
--- a/man/read_vue_detection_csv.Rd
+++ b/man/read_vue_detection_csv.Rd
@@ -27,7 +27,9 @@ All timestamp columns are assumed to be in UTC.
}
\examples{
csv_file <- system.file("extdata",
- "VR2W_109924_20110718_1.csv", package="glatos")
+ "VR2W_109924_20110718_1.csv",
+ package = "glatos"
+)
vue_det <- read_vue_detection_csv(csv_file)
diff --git a/man/read_vue_event_csv.Rd b/man/read_vue_event_csv.Rd
index 57aa5575..3891df1d 100644
--- a/man/read_vue_event_csv.Rd
+++ b/man/read_vue_event_csv.Rd
@@ -28,7 +28,9 @@ All timestamp columns are assumed to be in UTC.
}
\examples{
csv_file <- system.file("extdata",
- "VR2W_receiverEvents_109924_20110718_1.csv", package="glatosDS")
+ "VR2W_receiverEvents_109924_20110718_1.csv",
+ package = "glatosDS"
+)
vue_evn <- read_vue_event_csv(csv_file)
diff --git a/man/real_sensor_values.Rd b/man/real_sensor_values.Rd
index b0f0b2ba..3590272e 100644
--- a/man/real_sensor_values.Rd
+++ b/man/real_sensor_values.Rd
@@ -93,23 +93,27 @@ ensure that the each combination of those columns occurs only once in
}
\examples{
-#get path to example detection file
-det_file <- system.file("extdata",
- "lamprey_detections.csv", package="glatos")
-
+# get path to example detection file
+det_file <- system.file("extdata",
+ "lamprey_detections.csv",
+ package = "glatos"
+)
+
lamprey_detections <- read_glatos_detections(det_file)
-#get path to example Vemco tag spec file
-spec_file <- system.file("extdata",
- "lamprey_tag_specs.xls", package="glatos")
-
+# get path to example Vemco tag spec file
+spec_file <- system.file("extdata",
+ "lamprey_tag_specs.xls",
+ package = "glatos"
+)
+
lamprey_tags <- read_vemco_tag_specs(spec_file, file_format = "vemco_xls")
-#note use of '$specs' in tag_specs argument
+# note use of '$specs' in tag_specs argument
dtc <- real_sensor_values(lamprey_detections, lamprey_tags$specs)
-#now view records with sensor measurements
-dtc[!is.na(dtc$sensor_value_real),]
+# now view records with sensor measurements
+dtc[!is.na(dtc$sensor_value_real), ]
}
\author{
diff --git a/man/receiver_line_det_sim.Rd b/man/receiver_line_det_sim.Rd
index a6c9a07a..70a4811c 100644
--- a/man/receiver_line_det_sim.Rd
+++ b/man/receiver_line_det_sim.Rd
@@ -77,98 +77,111 @@ Detection or non-detection on each receiver is determined by a draw from a
Bernoulli distribution with probability p.
}
\examples{
-#EXAMPLE 1 - simulate detection on line of ten receivers
-
- #Define detection range function (to pass as rngFun)
- # that returns detection probability for given distance
- # assume logistic form of detection range curve where
- # dm = distance in meters
- # b = intercept and slope
- pdrf <- function(dm, b=c(5.5, -1/120)){
- p <- 1/(1+exp(-(b[1]+b[2]*dm)))
- return(p)
- }
-
- #preview detection range curve
- plot(pdrf(0:2000),type="l",ylab="Probability of detecting each coded burst",
-xlab="Distance between receiver and transmitter")
-
- #Simulate detection using pdrf; default values otherwise
- dp <- receiver_line_det_sim(rngFun=pdrf)
- dp
-
- #Again with only 10 virtual fish and optional plot to see simulated data
- dp <- receiver_line_det_sim(rngFun=pdrf, nsim=10, showPlot=T) #w/ optional plot
- dp
-
- #Again but six receivers and allow fish to pass to left and right of line
- dp <- receiver_line_det_sim(rngFun=pdrf, recSpc=rep(1000,5),
- outerLim=c(1000, 1000), nsim=10, showPlot=T)
- dp
-
- #Again but four receivers with irregular spacing
- dp <- receiver_line_det_sim(rngFun=pdrf, recSpc=c(2000,4000,2000),
- outerLim=c(1000, 1000), nsim=10, showPlot=T)
- dp
-
-
-#EXAMPLE 2 - summarize detection probability vs. receiver spacing
-
- #two receivers only, spaced 'spc' m apart
- #define scenarios where two receiver are spaced
- spc <- seq(100,5000, 100) #two receivers spaced 100, 200, ... 5000 m
- #loop through scenarios, estimate detection probability for each
- for(i in 1:length(spc)){
- if(i==1) dp <- numeric(length(spc)) #pre-allocate
- dp[i] <- receiver_line_det_sim(recSpc=spc[i], rngFun=pdrf)
- }
- cbind(spc,dp) #view results
- #plot results
- plot(spc, dp, type="o",ylim=c(0,1),
- xlab="distance between receivers in meters",
- ylab="proportion of virtual fish detected")
- # e.g., >95\% virtual fish detected up to 1400 m spacing in this example
-
-
-#EXAMPLE 3 - summarize detection probability vs. fish swim speed
-
- #define scenarios of fish movement rate
- swim <- seq(0.1, 5.0, 0.1) #constant velocity
- for(i in 1:length(swim)){
- if(i==1) dp <- numeric(length(swim)) #pre-allocate
- dp[i] <- receiver_line_det_sim(vel=swim[i], rngFun=pdrf)
- }
- cbind(swim,dp) #view results
- #plot results
- plot(swim, dp, type="o", ylim=c(0,1), xlab="fish movement rate, m/s",
- ylab="proportion of virtual fish detected")
- # e.g., >95\% virtual fish detected up to 1.7 m/s rate in this example
- # e.g., declines linearly above 1.7 m/s
-
-
-#EXAMPLE 4 - empirical detection range curve instead of logistic
-
- #create data frame with observed det. efficiency (p) at each distance (x)
- edr <- data.frame(
- x=c(0,363,444,530,636,714,794,889,920), #tag-receiver distance
- p=c(1,1,0.96,0.71,0.67,0.75,0.88,0.21,0)) # detection prob
-
- #now create a function to return the detection probability
- # based on distance and linear interpolation within edr
- # i.e., estimate p at given x by "connecting the dots"
- edrf <- function(dm, my.edr=edr) {
- p <- approx(x=my.edr$x,y=my.edr$p,xout=dm, rule=2)$y
- return(p)
- }
-
- #preview empirical detection range curve
- plot(edrf(0:2000),type="l",
- ylab="probability of detecting each coded burst",
- xlab="distance between receiver and transmitter, meters")
-
- #use empirical curve (edrf) in simulation
- dp <- receiver_line_det_sim(rngFun=edrf, nsim=10, showPlot=T) #w/ optional plot
- dp
+# EXAMPLE 1 - simulate detection on line of ten receivers
+
+# Define detection range function (to pass as rngFun)
+# that returns detection probability for given distance
+# assume logistic form of detection range curve where
+# dm = distance in meters
+# b = intercept and slope
+pdrf <- function(dm, b = c(5.5, -1 / 120)) {
+ p <- 1 / (1 + exp(-(b[1] + b[2] * dm)))
+ return(p)
+}
+
+# preview detection range curve
+plot(pdrf(0:2000),
+ type = "l", ylab = "Probability of detecting each coded burst",
+ xlab = "Distance between receiver and transmitter"
+)
+
+# Simulate detection using pdrf; default values otherwise
+dp <- receiver_line_det_sim(rngFun = pdrf)
+dp
+
+# Again with only 10 virtual fish and optional plot to see simulated data
+dp <- receiver_line_det_sim(rngFun = pdrf, nsim = 10, showPlot = T) # w/ optional plot
+dp
+
+# Again but six receivers and allow fish to pass to left and right of line
+dp <- receiver_line_det_sim(
+ rngFun = pdrf, recSpc = rep(1000, 5),
+ outerLim = c(1000, 1000), nsim = 10, showPlot = T
+)
+dp
+
+# Again but four receivers with irregular spacing
+dp <- receiver_line_det_sim(
+ rngFun = pdrf, recSpc = c(2000, 4000, 2000),
+ outerLim = c(1000, 1000), nsim = 10, showPlot = T
+)
+dp
+
+
+# EXAMPLE 2 - summarize detection probability vs. receiver spacing
+
+# two receivers only, spaced 'spc' m apart
+# define scenarios where two receiver are spaced
+spc <- seq(100, 5000, 100) # two receivers spaced 100, 200, ... 5000 m
+# loop through scenarios, estimate detection probability for each
+for (i in 1:length(spc)) {
+ if (i == 1) dp <- numeric(length(spc)) # pre-allocate
+ dp[i] <- receiver_line_det_sim(recSpc = spc[i], rngFun = pdrf)
+}
+cbind(spc, dp) # view results
+# plot results
+plot(spc, dp,
+ type = "o", ylim = c(0, 1),
+ xlab = "distance between receivers in meters",
+ ylab = "proportion of virtual fish detected"
+)
+# e.g., >95\% virtual fish detected up to 1400 m spacing in this example
+
+
+# EXAMPLE 3 - summarize detection probability vs. fish swim speed
+
+# define scenarios of fish movement rate
+swim <- seq(0.1, 5.0, 0.1) # constant velocity
+for (i in 1:length(swim)) {
+ if (i == 1) dp <- numeric(length(swim)) # pre-allocate
+ dp[i] <- receiver_line_det_sim(vel = swim[i], rngFun = pdrf)
+}
+cbind(swim, dp) # view results
+# plot results
+plot(swim, dp,
+ type = "o", ylim = c(0, 1), xlab = "fish movement rate, m/s",
+ ylab = "proportion of virtual fish detected"
+)
+# e.g., >95\% virtual fish detected up to 1.7 m/s rate in this example
+# e.g., declines linearly above 1.7 m/s
+
+
+# EXAMPLE 4 - empirical detection range curve instead of logistic
+
+# create data frame with observed det. efficiency (p) at each distance (x)
+edr <- data.frame(
+ x = c(0, 363, 444, 530, 636, 714, 794, 889, 920), # tag-receiver distance
+ p = c(1, 1, 0.96, 0.71, 0.67, 0.75, 0.88, 0.21, 0)
+) # detection prob
+
+# now create a function to return the detection probability
+# based on distance and linear interpolation within edr
+# i.e., estimate p at given x by "connecting the dots"
+edrf <- function(dm, my.edr = edr) {
+ p <- approx(x = my.edr$x, y = my.edr$p, xout = dm, rule = 2)$y
+ return(p)
+}
+
+# preview empirical detection range curve
+plot(edrf(0:2000),
+ type = "l",
+ ylab = "probability of detecting each coded burst",
+ xlab = "distance between receiver and transmitter, meters"
+)
+
+# use empirical curve (edrf) in simulation
+dp <- receiver_line_det_sim(rngFun = edrf, nsim = 10, showPlot = T) # w/ optional plot
+dp
}
\references{
diff --git a/man/residence_index.Rd b/man/residence_index.Rd
index d2ce5fee..b052f2a7 100644
--- a/man/residence_index.Rd
+++ b/man/residence_index.Rd
@@ -90,9 +90,9 @@ among all sites. For each location, residency index (RI) is calculated:
\deqn{ RI = L/T}
\deqn{ RI = Residence Index}
-\deqn{L = Distinct number of time intervals in which detection observed at
+\deqn{L = Distinct number of time intervals in which detection observed at
this location}
-\deqn{T = Distinct number of time intervals in which detection observed at
+\deqn{T = Distinct number of time intervals in which detection observed at
any location}
For consistency with other \code{calculation_method}s,
@@ -146,21 +146,27 @@ RI = AnOS/AnOT}
\deqn{AnOT = Sum of length of time of each detection among all locations, excluding any overlap}
}
\examples{
-#get path to example detection file
+# get path to example detection file
det_file <- system.file("extdata", "walleye_detections.csv",
- package = "glatos")
+ package = "glatos"
+)
det <- read_glatos_detections(det_file)
detection_events <- glatos::detection_events(det)
-rik_data <- glatos::residence_index(detection_events,
- calculation_method = 'kessel')
-rit_data <- glatos::residence_index(detection_events,
- calculation_method = 'time_interval')
-rit_data <- glatos::residence_index(detection_events,
- calculation_method = 'timedelta')
-riawo_data <- glatos::residence_index(detection_events,
- calculation_method = 'aggregate_with_overlap')
-riano_data <- glatos::residence_index(detection_events,
- calculation_method = 'aggregate_no_overlap')
+rik_data <- glatos::residence_index(detection_events,
+ calculation_method = "kessel"
+)
+rit_data <- glatos::residence_index(detection_events,
+ calculation_method = "time_interval"
+)
+rit_data <- glatos::residence_index(detection_events,
+ calculation_method = "timedelta"
+)
+riawo_data <- glatos::residence_index(detection_events,
+ calculation_method = "aggregate_with_overlap"
+)
+riano_data <- glatos::residence_index(detection_events,
+ calculation_method = "aggregate_no_overlap"
+)
}
\references{
diff --git a/man/rotate_points.Rd b/man/rotate_points.Rd
index a33a448d..868a606a 100644
--- a/man/rotate_points.Rd
+++ b/man/rotate_points.Rd
@@ -33,11 +33,11 @@ rotation matrix, then shifted back to original focus.
This function is called from \code{\link[=crw_in_polygon]{crw_in_polygon()}}
}
\examples{
-x <- runif(10,0,10)
-y <- runif(10,0,10)
-plot(x,y,type="b",pch=20)
+x <- runif(10, 0, 10)
+y <- runif(10, 0, 10)
+plot(x, y, type = "b", pch = 20)
foo <- rotate_points(x, y, 20, c(5, 5))
-points(foo$x,foo$y,type="b",pch=20,col="red")
+points(foo$x, foo$y, type = "b", pch = 20, col = "red")
}
\author{
diff --git a/man/summarize_detections.Rd b/man/summarize_detections.Rd
index e0cbde40..76bf76ea 100644
--- a/man/summarize_detections.Rd
+++ b/man/summarize_detections.Rd
@@ -137,60 +137,69 @@ the output summary.
}
\examples{
-#get path to example detection file
- det_file <- system.file("extdata", "walleye_detections.csv",
- package = "glatos")
- det <- read_glatos_detections(det_file)
-
- #Basic summaries
-
- # by animal
- ds <- summarize_detections(det)
-
- # by location
- ds <- summarize_detections(det, summ_type = "location")
-
- # by animal and location
- ds <- summarize_detections(det, summ_type = "both")
-
-
- #Include user-defined location_col
-
- # by animal
- det$some_place <- ifelse(grepl("^S", det$glatos_array), "s", "not_s")
-
- ds <- summarize_detections(det, location_col = "some_place")
-
- # by location
- ds <- summarize_detections(det, location_col = "some_place",
- summ_type = "location")
-
- # by animal and location
- ds <- summarize_detections(det, location_col = "some_place",
- summ_type = "both")
-
-
- #Include locations where no animals detected
-
- #get example receiver data
- rec_file <- system.file("extdata", "sample_receivers.csv",
- package = "glatos")
- rec <- read_glatos_receivers(rec_file)
-
- ds <- summarize_detections(det, receiver_locs = rec, summ_type = "location")
-
-
- #Include animals that were not detected
- #get example animal data from walleye workbook
- wb_file <- system.file("extdata", "walleye_workbook.xlsm",
- package = "glatos")
- wb <- read_glatos_workbook(wb_file)
-
- ds <- summarize_detections(det, animals = wb$animals, summ_type = "animal")
-
- #Include by animals and locations that were not detected
- ds <- summarize_detections(det, receiver_locs = rec, animals = wb$animals,
- summ_type = "both")
+# get path to example detection file
+det_file <- system.file("extdata", "walleye_detections.csv",
+ package = "glatos"
+)
+det <- read_glatos_detections(det_file)
+
+# Basic summaries
+
+# by animal
+ds <- summarize_detections(det)
+
+# by location
+ds <- summarize_detections(det, summ_type = "location")
+
+# by animal and location
+ds <- summarize_detections(det, summ_type = "both")
+
+
+# Include user-defined location_col
+
+# by animal
+det$some_place <- ifelse(grepl("^S", det$glatos_array), "s", "not_s")
+
+ds <- summarize_detections(det, location_col = "some_place")
+
+# by location
+ds <- summarize_detections(det,
+ location_col = "some_place",
+ summ_type = "location"
+)
+
+# by animal and location
+ds <- summarize_detections(det,
+ location_col = "some_place",
+ summ_type = "both"
+)
+
+
+# Include locations where no animals detected
+
+# get example receiver data
+rec_file <- system.file("extdata", "sample_receivers.csv",
+ package = "glatos"
+)
+rec <- read_glatos_receivers(rec_file)
+
+ds <- summarize_detections(det, receiver_locs = rec, summ_type = "location")
+
+
+# Include animals that were not detected
+# get example animal data from walleye workbook
+wb_file <- system.file("extdata", "walleye_workbook.xlsm",
+ package = "glatos"
+)
+wb <- read_glatos_workbook(wb_file)
+
+ds <- summarize_detections(det, animals = wb$animals, summ_type = "animal")
+
+# Include by animals and locations that were not detected
+ds <- summarize_detections(det,
+ receiver_locs = rec, animals = wb$animals,
+ summ_type = "both"
+)
}
\author{
diff --git a/man/transmit_along_path.Rd b/man/transmit_along_path.Rd
index dc43202b..cbc23e43 100644
--- a/man/transmit_along_path.Rd
+++ b/man/transmit_along_path.Rd
@@ -82,89 +82,108 @@ which was designed to accept the result as input (\code{trnsLoc}).
}
\examples{
-#Example 1 - data.frame input (default column names)
-
-mypath <- data.frame(x = seq(0, 1000, 100),
- y = seq(0, 1000, 100))
-
-mytrns <- transmit_along_path(mypath, vel = 0.5,
- delayRng = c(60, 180),
- burstDur = 5.0,
- sp_out = FALSE)
+# Example 1 - data.frame input (default column names)
+
+mypath <- data.frame(
+ x = seq(0, 1000, 100),
+ y = seq(0, 1000, 100)
+)
+
+mytrns <- transmit_along_path(mypath,
+ vel = 0.5,
+ delayRng = c(60, 180),
+ burstDur = 5.0,
+ sp_out = FALSE
+)
plot(mypath, type = "o")
points(mytrns, pch = 20, col = "red")
-#Example 2 - data.frame input (non-default column names)
+# Example 2 - data.frame input (non-default column names)
-mypath <- data.frame(Easting = seq(0, 1000, 100),
- Northing = seq(0, 1000, 100))
-
-mytrns <- transmit_along_path(mypath, vel = 0.5, delayRng = c(60, 180),
- burstDur = 5.0,
- colNames = list(x = "Easting",
- y = "Northing"),
- sp_out = FALSE)
+mypath <- data.frame(
+ Easting = seq(0, 1000, 100),
+ Northing = seq(0, 1000, 100)
+)
+
+mytrns <- transmit_along_path(mypath,
+ vel = 0.5, delayRng = c(60, 180),
+ burstDur = 5.0,
+ colNames = list(
+ x = "Easting",
+ y = "Northing"
+ ),
+ sp_out = FALSE
+)
plot(mypath, type = "o")
points(mytrns, pch = 20, col = "red")
-#Example 3 - data.frame input using pathCRS arg
+# Example 3 - data.frame input using pathCRS arg
-mypath <- data.frame(deploy_long = c(-87, -87.1, -87),
- deploy_lat = c(44, 44.1, 44.2))
+mypath <- data.frame(
+ deploy_long = c(-87, -87.1, -87),
+ deploy_lat = c(44, 44.1, 44.2)
+)
-mytrns <- transmit_along_path(mypath, vel = 0.5, delayRng = c(600, 1800),
- burstDur = 5.0,
- colNames = list(x = "deploy_long",
- y = "deploy_lat"),
- pathCRS = 4326,
- sp_out = FALSE)
+mytrns <- transmit_along_path(mypath,
+ vel = 0.5, delayRng = c(600, 1800),
+ burstDur = 5.0,
+ colNames = list(
+ x = "deploy_long",
+ y = "deploy_lat"
+ ),
+ pathCRS = 4326,
+ sp_out = FALSE
+)
plot(mypath, type = "o")
points(mytrns, pch = 20, col = "red")
-#Example 4 - sf POINT input
+# Example 4 - sf POINT input
-#simulate in great lakes polygon
+# simulate in great lakes polygon
data(great_lakes_polygon)
mypath_sf <- crw_in_polygon(great_lakes_polygon,
- theta = c(0, 25),
- stepLen = 100,
- initHeading = 0,
- nsteps = 10,
- cartesianCRS = 3175)
-
-mytrns_sf <- transmit_along_path(mypath_sf,
- vel = 0.5,
- delayRng = c(60, 180),
- burstDur = 5.0)
+ theta = c(0, 25),
+ stepLen = 100,
+ initHeading = 0,
+ nsteps = 10,
+ cartesianCRS = 3175
+)
+
+mytrns_sf <- transmit_along_path(mypath_sf,
+ vel = 0.5,
+ delayRng = c(60, 180),
+ burstDur = 5.0
+)
plot(mypath_sf, type = "o")
points(sf::st_coordinates(mytrns_sf), pch = 20, col = "red")
-#Example 5 - SpatialPointsDataFrame input
+# Example 5 - SpatialPointsDataFrame input
-#simulate in great lakes polygon
+# simulate in great lakes polygon
data(greatLakesPoly)
mypath_sp <- crw_in_polygon(greatLakesPoly,
- theta = c(0, 25),
- stepLen = 100,
- initHeading = 0,
- nsteps = 10,
- cartesianCRS = 3175)
+ theta = c(0, 25),
+ stepLen = 100,
+ initHeading = 0,
+ nsteps = 10,
+ cartesianCRS = 3175
+)
-mytrns_sp <- transmit_along_path(mypath_sp,
- vel = 0.5,
- delayRng = c(60, 180),
- burstDur = 5.0)
+mytrns_sp <- transmit_along_path(mypath_sp,
+ vel = 0.5,
+ delayRng = c(60, 180),
+ burstDur = 5.0
+)
plot(sf::st_coordinates(sf::st_as_sf(mypath_sp)), type = "o")
points(sf::st_coordinates(mytrns_sp), pch = 20, col = "red")
-
}
\author{
C. Holbrook \email{cholbrook@usgs.gov}
diff --git a/man/vdat_convert.Rd b/man/vdat_convert.Rd
index e713817f..da385a92 100644
--- a/man/vdat_convert.Rd
+++ b/man/vdat_convert.Rd
@@ -104,86 +104,91 @@ extension) as the source file (e.g.,
}
\examples{
-
\dontrun{
# Check vdat.exe
check_vdat()
-#all examples below assume path to VDAT.exe is in system PATH environment
+# all examples below assume path to VDAT.exe is in system PATH environment
# variable. If not (you get an error), add input argument 'vdat_exe_path'
# with path directory with VDAT.exe.
# e.g.,
-#vdat_convert(vrl_files,
+# vdat_convert(vrl_files,
# vdat_exe_path = "C:/Program Files/Innovasea/Fathom")
-#get path to example VRL files in glatos
+# get path to example VRL files in glatos
vrl_files <- system.file("extdata", "detection_files_raw",
- c("VR2W_109924_20110718_1.vrl",
- "VR2W180_302187_20180629_1.vrl",
- "VR2AR_546310_20190613_1.vrl",
- "VR2Tx_480022_20190613_1.vrl"),
- package = "glatos")
+ c(
+ "VR2W_109924_20110718_1.vrl",
+ "VR2W180_302187_20180629_1.vrl",
+ "VR2AR_546310_20190613_1.vrl",
+ "VR2Tx_480022_20190613_1.vrl"
+ ),
+ package = "glatos"
+)
-#copy to temp_dir
+# copy to temp_dir
temp_dir <- tempdir()
vrl_files2 <- file.path(temp_dir, basename(vrl_files))
file.copy(vrl_files, vrl_files2)
-#uncomment to open in file browser
-#utils::browseURL(temp_dir)
+# uncomment to open in file browser
+# utils::browseURL(temp_dir)
-#call VDAT.exe; default args
+# call VDAT.exe; default args
vdat_convert(vrl_files2)
-#run again and overwrite
+# run again and overwrite
vdat_convert(vrl_files2, overwrite = TRUE)
-#run again without progress bars
+# run again without progress bars
vdat_convert(vrl_files2, overwrite = TRUE, show_progress = FALSE)
-#use split output format
+# use split output format
vdat_convert(vrl_files2, output_format = "csv.fathom.split")
-#change output directory
+# change output directory
new_dir <- file.path(temp_dir, "testdir")
-if(!dir.exists(new_dir)) dir.create(new_dir)
+if (!dir.exists(new_dir)) dir.create(new_dir)
-#write to new directory
+# write to new directory
vdat_convert(vrl_files2, out_dir = new_dir)
-#multiple source folders
-#make new folder for each vrl file inside temp directory
-new_dir2 <- file.path(temp_dir,
- "testdir2",
- seq_along(vrl_files2))
-for(i in 1:length(new_dir2)){
- if(!dir.exists(new_dir2[i])) dir.create(new_dir2[i], recursive = TRUE)
+# multiple source folders
+# make new folder for each vrl file inside temp directory
+new_dir2 <- file.path(
+ temp_dir,
+ "testdir2",
+ seq_along(vrl_files2)
+)
+for (i in 1:length(new_dir2)) {
+ if (!dir.exists(new_dir2[i])) dir.create(new_dir2[i], recursive = TRUE)
}
-#redistribute files
+# redistribute files
vrl_files3 <- file.path(new_dir2, basename(vrl_files2))
file.copy(vrl_files2, vrl_files3)
-#write each CSV file to same location as corresponding VRL (full path input)
+# write each CSV file to same location as corresponding VRL (full path input)
vdat_convert(vrl_files3)
-#same but use input dir only and overwrite = TRUE
+# same but use input dir only and overwrite = TRUE
vdat_convert(dirname(vrl_files3), overwrite = TRUE)
-#same but write all CSV files to new location
+# same but write all CSV files to new location
new_dir3 <- file.path(temp_dir, "testdir3")
-if(!dir.exists(new_dir3)) dir.create(new_dir3)
+if (!dir.exists(new_dir3)) dir.create(new_dir3)
vdat_convert(vrl_files3, out_dir = new_dir3)
-#same but use input dir only and recursive = TRUE
-vdat_convert(src = file.path(temp_dir, "testdir2"),
- out_dir = new_dir3,
- overwrite = TRUE,
- recursive = TRUE)
-
+# same but use input dir only and recursive = TRUE
+vdat_convert(
+ src = file.path(temp_dir, "testdir2"),
+ out_dir = new_dir3,
+ overwrite = TRUE,
+ recursive = TRUE
+)
}
}
diff --git a/man/vector_heading.Rd b/man/vector_heading.Rd
index f21ed3a5..b5fea265 100644
--- a/man/vector_heading.Rd
+++ b/man/vector_heading.Rd
@@ -38,31 +38,37 @@ This function is called from within \code{\link[=crw_in_polygon]{crw_in_polygon(
}
\examples{
-#example using generic cartesian (regular grid) coordinates
-x=c(2,4)
-y=c(2,4)
+# example using generic cartesian (regular grid) coordinates
+x <- c(2, 4)
+y <- c(2, 4)
vector_heading(x, y)
-x2=c(2,4,2)
-y2=c(2,4,2)
+x2 <- c(2, 4, 2)
+y2 <- c(2, 4, 2)
vector_heading(x2, y2)
-#example using WGS84 lat-lon
-#e.g., from Duluth to Toronto to Detroit
+# example using WGS84 lat-lon
+# e.g., from Duluth to Toronto to Detroit
-path1 <- data.frame(city = c("Duluth", "Toronoto", "Detroit"),
- longitude = c(-92.1005, -79.3832, -83.0458),
- latitude = c(46.7867, 43.6532, 42.3314))
+path1 <- data.frame(
+ city = c("Duluth", "Toronoto", "Detroit"),
+ longitude = c(-92.1005, -79.3832, -83.0458),
+ latitude = c(46.7867, 43.6532, 42.3314)
+)
-#example using the x, y input method way
-vector_heading(x = c(-92.1005, -79.3832, -83.0458),
- y = c(46.7867, 43.6532, 42.3314),
- coord_sys = "longlat")
-
-#example using the x-only input method
-vector_heading(x = path1[ , c("longitude", "latitude")],
- coord_sys = "longlat")
+# example using the x, y input method way
+vector_heading(
+ x = c(-92.1005, -79.3832, -83.0458),
+ y = c(46.7867, 43.6532, 42.3314),
+ coord_sys = "longlat"
+)
+
+# example using the x-only input method
+vector_heading(
+ x = path1[, c("longitude", "latitude")],
+ coord_sys = "longlat"
+)
}
\author{
diff --git a/man/vrl2csv-deprecated.Rd b/man/vrl2csv-deprecated.Rd
index dc39e091..28f5e77a 100644
--- a/man/vrl2csv-deprecated.Rd
+++ b/man/vrl2csv-deprecated.Rd
@@ -54,18 +54,18 @@ warning message even if conversion was successful.
\examples{
\dontrun{
-#get path to example VRL in this package
-myVRL <- system.file("extdata", "detection_files_raw",
- "VR2W_109924_20110718_1.vrl",
- package = "glatos")
-
-vrl2csv(dirname(myVRL)) #directory input
-vrl2csv(myVRL) #file name input
+# get path to example VRL in this package
+myVRL <- system.file("extdata", "detection_files_raw",
+ "VR2W_109924_20110718_1.vrl",
+ package = "glatos"
+)
-#setting 'overwrite=FALSE' will make new file with '_n'added to name
-vrl2csv(myVRL, overwrite=F)
-}
+vrl2csv(dirname(myVRL)) # directory input
+vrl2csv(myVRL) # file name input
+# setting 'overwrite=FALSE' will make new file with '_n'added to name
+vrl2csv(myVRL, overwrite = F)
+}
}
\seealso{
diff --git a/man/vue_convert.Rd b/man/vue_convert.Rd
index 0b9fa2b1..347e1d7a 100644
--- a/man/vue_convert.Rd
+++ b/man/vue_convert.Rd
@@ -93,87 +93,91 @@ same (except for extension) as the source file (e.g.,
}
\examples{
-
\dontrun{
# Check vue.exe
check_vue()
-#all examples below assume path to VUE.exe is in system PATH environment
+# all examples below assume path to VUE.exe is in system PATH environment
# variable. If not (you get an error), add input argument 'vue_exe_path'
# with path directory with VUE.exe.
# e.g.,
-#vue_convert(vrl_files,
+# vue_convert(vrl_files,
# vue_exe_path = "C:/Program Files (x86)/Vemco/VUE")
-#get path to example VRL files in glatos
+# get path to example VRL files in glatos
vrl_files <- system.file("extdata", "detection_files_raw",
- c("VR2W_109924_20110718_1.vrl",
- "VR2W180_302187_20180629_1.vrl",
- "VR2AR_546310_20190613_1.vrl",
- "VR2Tx_480022_20190613_1.vrl"),
- package = "glatos")
+ c(
+ "VR2W_109924_20110718_1.vrl",
+ "VR2W180_302187_20180629_1.vrl",
+ "VR2AR_546310_20190613_1.vrl",
+ "VR2Tx_480022_20190613_1.vrl"
+ ),
+ package = "glatos"
+)
-#copy to temp_dir
+# copy to temp_dir
temp_dir <- tempdir()
vrl_files2 <- file.path(temp_dir, basename(vrl_files))
file.copy(vrl_files, vrl_files2)
-#uncomment to open in file browser
-#utils::browseURL(temp_dir)
+# uncomment to open in file browser
+# utils::browseURL(temp_dir)
-#call VUE.exe; default args
+# call VUE.exe; default args
vue_convert(vrl_files2)
-#run again and overwrite
+# run again and overwrite
vue_convert(vrl_files2, overwrite = TRUE)
-#run again without progress bars
+# run again without progress bars
vue_convert(vrl_files2, overwrite = TRUE, show_progress = FALSE)
-#change output directory
+# change output directory
new_dir <- file.path(temp_dir, "testdir")
-if(!dir.exists(new_dir)) dir.create(new_dir)
+if (!dir.exists(new_dir)) dir.create(new_dir)
-#write to new directory
+# write to new directory
vue_convert(vrl_files2, out_dir = new_dir)
-#multiple source folders
-#make new folder for each vrl file inside temp directory
-new_dir2 <- file.path(temp_dir,
- "testdir2",
- seq_along(vrl_files2))
-for(i in 1:length(new_dir2)){
- if(!dir.exists(new_dir2[i])) dir.create(new_dir2[i], recursive = TRUE)
+# multiple source folders
+# make new folder for each vrl file inside temp directory
+new_dir2 <- file.path(
+ temp_dir,
+ "testdir2",
+ seq_along(vrl_files2)
+)
+for (i in 1:length(new_dir2)) {
+ if (!dir.exists(new_dir2[i])) dir.create(new_dir2[i], recursive = TRUE)
}
-#redistribute files
+# redistribute files
vrl_files3 <- file.path(new_dir2, basename(vrl_files2))
file.copy(vrl_files2, vrl_files3)
-#write each CSV file to same location as corresponding VRL (full path input)
+# write each CSV file to same location as corresponding VRL (full path input)
vue_convert(vrl_files3)
-#same but use input dir only and overwrite = TRUE
+# same but use input dir only and overwrite = TRUE
vue_convert(dirname(vrl_files3), overwrite = TRUE)
-#same but write all CSV files to new location
+# same but write all CSV files to new location
new_dir3 <- file.path(temp_dir, "testdir3")
-if(!dir.exists(new_dir3)) dir.create(new_dir3)
+if (!dir.exists(new_dir3)) dir.create(new_dir3)
vue_convert(vrl_files3, out_dir = new_dir3)
-#same but use input dir only and recursive = TRUE
-vue_convert(src = file.path(temp_dir, "testdir2"),
- out_dir = new_dir3,
- overwrite = TRUE,
- recursive = TRUE)
-
+# same but use input dir only and recursive = TRUE
+vue_convert(
+ src = file.path(temp_dir, "testdir2"),
+ out_dir = new_dir3,
+ overwrite = TRUE,
+ recursive = TRUE
+)
}
-
}
\author{
C. Holbrook (cholbrook@usgs.gov)
diff --git a/man/write_vdat_csv.Rd b/man/write_vdat_csv.Rd
index 16c77846..fdf19361 100644
--- a/man/write_vdat_csv.Rd
+++ b/man/write_vdat_csv.Rd
@@ -62,24 +62,25 @@ Writing is done via \code{\link[data.table]{fwrite}}.
# Example 1. Read and write a single file
vrl_file <- system.file("extdata", "detection_files_raw",
- "VR2W_109924_20110718_1.vrl", package="glatos")
+ "VR2W_109924_20110718_1.vrl",
+ package = "glatos"
+)
temp_dir <- tempdir()
csv_file <- vdat_convert(vrl_file, out_dir = temp_dir)
-#utils::browseURL(temp_dir)
+# utils::browseURL(temp_dir)
-#read all record types
+# read all record types
vdat <- read_vdat_csv(csv_file)
-#write to single file (output_format = "csv.fathom")
+# write to single file (output_format = "csv.fathom")
write_vdat_csv(vdat)
-#write to multiple files
+# write to multiple files
write_vdat_csv(vdat, output_format = "csv.fathom.split")
-
}
\author{
C. Holbrook (cholbrook@usgs.gov)