Adds a new variable to the objects feature data.

addFeatures(
  object,
  feature_names,
  feature_df,
  key_variable = "barcodes",
  of_sample = "",
  overwrite = FALSE
)

Arguments

object

A valid spata-object.

feature_df

A data.frame that contains the feature and the key-variables.

key_variable

Character value. Either 'barcodes' or 'coordinates'. If set to 'coordinates' the feature_df-input must contain numeric x- and y- variables.

Key variables are variables in a data.frame that uniquely identify each observation - in this case each barcode-spot. In SPATA the barcode-variable is a key-variable on its own, x- and y-coordinates work as key-variables if they are used combined.

overwrite

Logical. If the specified feature name already exists in the current spata-object this argument must be set to TRUE in order to overwrite it.

Value

An updated spata-object.

Details

Eventually the new feature will be joined via dplyr::left_join() over the key-variables barcodes or x and y. Additional steps secure the joining process.