Learn R Programming

Dark (version 0.9.9)

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)

Value

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

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.

Author

Jeremiah MF Kelly

Mumac Ltd, SK7 6NR, GB

Details

In early data collected with analogue equipment it was possible 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 extra presses. It is rarely needed 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) 
if (FALSE) plot(tmp$time, tmp$thrs, ylim=c(-4,0))
tmp <- Declutter(tmp)
if (FALSE) points(tmp$time, tmp$thrs, col='red', pch=16)

Run the code above in your browser using DataLab