Learn R Programming

Dark (version 0.9.4)

Declutter: Declutter

Description

A function to remove multiple button presses, i.e. data that has multiple values for the same threshold.

Usage

Declutter(tmp, delta)

Arguments

tmp
a 'dark' object with at least two elements; tmp$time and tmp$thrs.
delta
The minimum time in seconds between responses. Thresholds set within two seconds of each other are discarded apart from the first threshold.

Value

  • Returns an object with the same elements as 'tmp' but with object$time and object$thrs altered.

Details

In early data collected with analogue equipment it was psossible for a subject to return multiple button presses when setting just one threshold. This data is characterised by clusters of points within a very short time. This function removes the exptra presses. It is rarely need for data collected from digital equipment.

Examples

Run this code
set.seed(123)
Time  <-c(0, 0.02, 1, 2,  3, 3.02,  5, 6, 6.02, 7, 9, 9.02, 11, 
12, 12.02, 13, 15, 15.02, 16, 18, 18.02, 20) 
# with duplicated times
set.seed(1234)
tmp <- TestData(Time, sse=0.05) 
plot(tmp$time, tmp$thrs, ylim=c(-4,0))
tmp <- Declutter(tmp)
points(tmp$time, tmp$thrs, col='red', pch=16)

Run the code above in your browser using DataLab