letable: Returns an epoch-table with information about epochs, masks...

View source: R/luna.R

letableR Documentation

Returns an epoch-table with information about epochs, masks and annotations

Description

Returns an epoch-level data frame with time, mask and annotation information

Usage

letable(annots = character(0))

Arguments

annots

an optional vector of annotation class names, as returned by lannots()

Value

a data frame with at least six columns:

  • E epoch number of the current unmasked dataset

  • SEC elapsed seconds for the current unmasked dataset

  • E1 epoch number for the original dataset

  • SEC1 elapsed seconds based on the original data

  • HMS clock-time for epoch start

  • M flag to indicate whether this epoch is masked (1) or not (0)

  • any additional columns will be labeled based on the specified annotations, with a flag (1 or 0) to indicate whether or not that epoch contains at least one of that annotation class

See Also

RESTRUCTURE

Examples

## Not run: 
> d <- letable( annots=c("wake" , "NREM1" , "NREM2" ) )
> dim(d)
[1] 1195    9

> head(d)
  E SEC E1 SEC1      HMS M NREM1 NREM2 wake
1 1   0  1    0 21:18:06 0     0     0    1
2 2  30  2   30 21:18:36 0     0     0    1
3 3  60  3   60 21:19:06 0     0     0    1
4 4  90  4   90 21:19:36 0     0     0    1
5 5 120  5  120 21:20:06 0     0     0    1
6 6 150  6  150 21:20:36 0     0     0    1

## using leval() to set a mask, for example, to mask everything except epochs 2 to 5
> leval("MASK epoch=2-5")
evaluating...
nsrr02 : 14 signals, 10 annotations, of 09:57:30 duration, 4 unmasked 30-sec epochs, and 1191 masked

## the M column indicates which epochs are masked
> head(letable())
   E SEC E0 SEC0      HMS M
1 NA  NA  1    0 21:18:06 1
2  1   0  2   30 21:18:36 0
3  2  30  3   60 21:19:06 0
4  3  60  4   90 21:19:36 0
5  4  90  5  120 21:20:06 0
6 NA  NA  6  150 21:20:36 1

## restructure the dataset, i.e. to actually remove masked epochs
> leval("RESTRUCTURE")
evaluating...
nsrr02 : 15 signals, 10 annotations, of 00:02:00 duration, 4 unmasked 30-sec epochs, and 0 masked

## now the entire in-memory dataset is only four epochs:
> letable()
  E SEC E0 SEC0      HMS M
1 1   0  2   30 21:18:36 0
2 2  30  3   60 21:19:06 0
3 3  60  4   90 21:19:36 0
4 4  90  5  120 21:20:06 0

## reset the epochs
> lepoch()
evaluating...
nsrr02 : 14 signals, 10 annotations, of 09:57:30 duration, 1195 unmasked 30-sec epochs, and 0 masked

> head(letable())
  E SEC E1 SEC1      HMS M NREM1 NREM2 wake
1 1   0  1    0 21:18:06 0     0     0    1
2 2  30  2   30 21:18:36 0     0     0    1
3 3  60  3   60 21:19:06 0     0     0    1
4 4  90  4   90 21:19:36 0     0     0    1
5 5 120  5  120 21:20:06 0     0     0    1
6 6 150  6  150 21:20:36 0     0     0    1


## End(Not run)

remnrem/luna documentation built on June 1, 2025, 2:14 p.m.