R/nest_in_list.R

Defines functions nest_in_list

nest_in_list <-
  function(
    x,
    nestIn = "instruction"
  ) {

  if (is.list(x) && (length(x) == 1) && (names(x) == nestIn)) {
    return(x);
  } else {
    return(
      stats::setNames(
        list(x),
        nm = nestIn
      )
    );
  }
}

Try the psyverse package in your browser

Any scripts or data that you put into this service are public.

psyverse documentation built on March 7, 2023, 8:31 p.m.