Learn R Programming

tripEstimation (version 0.0-46)

pick: Choose twilight segments interactively from light data.

Description

pick plots up series of light data agains record ID, allowing the user to click on the beginnings and ends of twilight in sequence. picksegs generates a vector of segment IDs for each record.

Usage

pick(id, val, nsee = 10000)

picksegs(twind, n)

Value

pick returns a vector where each value (obtained using locator

is the x coordinate for the begin or end of a twilight.

picksegs uses these paired indexes to return a vector of segment IDs, with NAs for non-twilight periods.

Arguments

id

index vector to identify records

val

sequence of data (light levels) to choose segments from

nsee

number of points to plot per screen

twind

vector of index pairs generated by pick

n

Number of segments values required - length of record

Author

Michael D. Sumner

Warning

Segments are expected to be chosen as non-overlapping.

Examples

Run this code
 d <- sin(seq(0, 10, by = 0.01))
 id <- 1:length(d)
 ## choose a series of start-begin pairs
 if (interactive()) {
 pk <- pick(id, d, 1000)
 ## your start/ends should be marked as blue versus red
 plot(id, d, col = c("red", "blue")[is.na(picksegs(pk, 1000))+1])
 }

Run the code above in your browser using DataLab