addFeatures | R Documentation |
Adds new externally generated features
to the SPATA2
object's meta data.
addFeatures(
object,
feature_df,
feature_names = NULL,
key_variable = "barcodes",
overwrite = FALSE,
verbose = NULL,
...
)
object |
An object of class |
feature_df |
A data.frame that contains a variable called barcodes as well as the variables that are to be joined. |
feature_names |
Character vector or |
overwrite |
Logical value. Must be |
verbose |
Logical. If (Warning messages will always be printed.) |
... |
Used to absorb deprecated arguments or functions. |
If you are only interested in adding specific features to the SPATA2
object
you can specify those with the feature_names
-argument. If no variables
are specified this way all variables found in feature_df
for argument
feature_df
are taken. (Apart from variables called barcodes, sample, x and y).
Eventually the new features are joined via dplyr::left_join()
over the
key-variables barcodes or x and y. Additional steps secure
the joining process.
The updated input object, containing the added, removed or computed results.
library(SPATA2)
library(tidyverse)
data("example_data")
object <- example_data$object_UKF275T_diet
meta_df <- getMetaDf(object)
names(meta_df)
new_meta_df <-
dplyr::transmute(
.data = meta_df,
barcodes = barcodes,
new_feat = sample(letters[1:5], size = nrow(meta_df), replace = T) %>% as.factor()
)
object <- addFeatures(object, feature_df = new_meta_df)
plotSurface(object, color_by = "new_feat")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.