as_stimlist: Convert list to stimlist

View source: R/stimlist.R

as_stimlistR Documentation

Convert list to stimlist

Description

Checks if an object is a stimulus or list of stimuli and repairs common problems.

Usage

as_stimlist(x)

Arguments

x

The object

Details

Some webmorphR functions, like plot() and print() require objects to have a "stimlist" class. If you've processed a list of stimuli with iterator functions like lapply() or purrr::map() and the resulting object prints or plots oddly, it is probably unclassed, and this function will fix that.

Value

A stimlist

See Also

Stimulus creating functions animate(), blank(), new_stimlist(), new_stim(), read_img(), read_stim(), read_tem(), write_stim()

Examples

stimuli <- demo_stim() |>
  lapply(function(stim) {
    # remove template lines
    stim$lines <- NULL
    return(stim)
  })
  
class(stimuli)

## Not run: 
plot(stimuli) # error

## End(Not run)

s <- as_stimlist(stimuli)
class(s)
plot(s)


webmorphR documentation built on June 2, 2022, 5:07 p.m.