Skip to contents

A notebook's column as a field of the cells: categorical (codes into its categories) or continuous; a later push of the same name replaces it.

Usage

cellucid_field_push(viewer, key, kind, categories, n_obs, cells, values)

Arguments

viewer

A viewer cellucid_view() or cellucid_serve() returned.

key

The column's name. Text (at least 1 character). Required.

kind

One of "categorical", "continuous". Required.

categories

A categorical column's categories (its values are codes into them; the largest code is "no category"); null for a continuous one. A vector or list of text or NULL. Required.

n_obs

The cells of the dataset the column belongs to. A whole number (at least 0). Required.

cells

Cells: 1-based positions, TRUE/FALSE for every cell, or the cell names of the object the viewer shows, each once (sent as original positions). Required.

values

One value per cell named: a code (categorical) or a number (continuous). A column, one value per cell named: numbers (NA: no value), or a factor (its codes; NA: no category). Required.

Value

A cellucid_action_request, at once and invisibly: the action is sent now, or when the viewer's channel opens. cellucid_action_result(request) returns its outcome (what it did, as names, counts and ids), or NULL when it had nothing to report; request$step is the history step it made.

Details

The viewer's action field.push (Fields). It changes the viewer's state: one step of the viewer's history, labelled as R's, undone like any other. The state it can change: field-overlays, active-field, filters, colors.

See also

cellucid_act() sends any action by its type, and cellucid_action_result() collects its answer.

Examples

if (interactive() && requireNamespace("SeuratObject", quietly = TRUE)) {
  data("pbmc_small", package = "SeuratObject")
  viewer <- cellucid_view(SeuratObject::UpdateSeuratObject(pbmc_small))
  request <- cellucid_field_push(viewer, categories = list(),
      cells = integer(0), key = "x", kind = "categorical",
      n_obs = 0, values = numeric(0))
  print(request)
  # cellucid_action_result(request) waits for its outcome.
  cellucid_stop(viewer)
}