This function may be used to tag features in CTD data. It works by launching an R/Shiny app, providing it with information gleaned from the function parameters. It may be used to work with a single data file (specified with file) or with all the .cnv files in a directory (specified with dir). The user interface is meant to be reasonably self-explanatory. The information provided via the user's mouse clicks and keyboard actions is recorded in an SQLite database named (by default) ~/ctdTag_USERNAME.db, where USERNAME is the user's login name on the computer. This files must not be edited or modified by the user, unless that user has a high degree of expertise in SQL and in the functioning of this package. Since ctdTag() is still in development, sensible users will make frequent backups of their ~/ctdTag_USERNAME.db file.

ctdTag(
  file,
  dir,
  dbname = getDatabaseName("ctdTag"),
  tagScheme = NULL,
  height = 550,
  clickDistanceCriterion = 0.02,
  debug = 0L
)

Arguments

file

character value specifying the name of a file containing CTD data. This file must be in a format that is handled by oce::read.oce(). You may not supply dir if file is supplied.

dir

character value specifying the name of a directory containing files that hold CTD data. You may not supply file if dir is supplied.

dbname

optional character value specifying the name of a sqlite database used to hold tagging information. If not provided, a file name is constructed with getDatabaseName(). If this file does not exist, it is created, and a table named tagScheme is constructed in it, according to the tagScheme parameter. However, if the file already exists, then its tagScheme table is not altered.

tagScheme

optional data.frame containing items tagCode (integer) and tagLabel (character). If not given, the labels default to c("iTop", "iTop?", "iBot", "iBot?", "WS", "WS?", "CF", "CF?") and the codes default to 1:8.

height

height of the plot in pixels.

clickDistanceCriterion

numeric value controlling whether a mouse click selects, or deselects a point. If the ratio of the distance from the mouse location to the nearest point exceeds clickDistanceCriterion times the span of the current view, then that nearest point is selected. Otherwise, any existing selected point is deselected.

debug

integer indicating whether to print some informative information to the R console. Use 0 for mainly silent processing, 1 for more information, etc.

Value

ctdTag() returns either an empty string, if the procedure worked, or a description of the problem, otherwise.

Author

Dan Kelley

Examples

if (FALSE) {
library(ctd)
file <- "~/data/arctic/beaufort/2012/d201211_0047.cnv"
ctdTag(file=file)
dir <- "~/data/arctic/beaufort/2012"
ctdTag(dir=dir)
}