BoolToInt | R Documentation |
Unlike most programming languages, R has three possible logical
(boolean) values: TRUE
, FALSE
, and NA
;
moreover, the NA
value has representations in other data types, such
as NA_integer_
, NA_real_
, and NA_character_
. Simply
writing out the logical values to an HDF5 file would cause issues when trying
to read the data in to another language, such as Python. To encode these three
logical values for other languages, we can encode the logicals as integers:
FALSE
becomes 0L
TRUE
becomes 1L
NA
becomes 2L
This encoding scheme allows other languages to handle NA
s in their own
manner while preserving all three logicals for R
BoolToInt(x)
x |
A logical vector |
An integer vector
integer logical NA
WriteH5Seurat
SeuratDisk:::BoolToInt(x = c(TRUE, FALSE, NA))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.