peak_pick: Pick peaks in datasets interactively

Description Usage Arguments Value Examples

Description

'peak_pick()' is an interactive tool (a shinyGadget) for finding peaks in datasets (e.g. a spectrum). After loading the dataset and specifying the columns, you can easily select peaks by clicking on the dataset. The gadget will automatically try to determine the nearest peak to the click and select it. Peaks can be deselected by clicking again.

When you are finished press "Done". The gadget will place a piece of code in your clipboard that you should paste into your script for reproducibility.

Usage

1
peak_pick(data, x, y, find = "max")

Arguments

data

A tibble containing the data to pick peaks in

x

Column containing the x-values

y

Column containing the y-values

find

Can be either "max" or "min". Defines what is selected when highlighting peaks. Defaults to "max".

Value

The original dataset with an additional column "peak", which indicates TRUE/FALSE if the given row is a peak.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
library(tibble)
library(dplyr)
set.seed(123)
df <- tibble(x = seq(0.001, 10, 0.01), y = sin(10*x)^4/(x)) %>%
  mutate(y = y + rnorm(n(), mean = 0.01, sd = 0.1))

## Not run: 
peakr::peak_pick(df, x, y)

## End(Not run)

df <- df %>% peakr::add_pick(c(14,48,80,112,143))

# After adding peaks, the plot from the gadget can be reproduced using plot_pick()
df %>% peakr::plot_pick(x, y)

emiltb/peakr documentation built on May 28, 2019, 8:36 p.m.