Standardize height values of a scan by centering/scaling by desired statistics and replacing missing values

comparison_standardizeHeights(
  heightValues,
  withRespectTo = "individualCell",
  centerBy = mean,
  scaleBy = sd
)

Arguments

heightValues

list/tibble column of x3p objects

withRespectTo

currently ignored

centerBy

statistic by which to center (i.e., subtract from) the height values

scaleBy

statistic by which to scale (i.e., divide) the height values

Value

A list of the same length as the input containing x3p objects with standardized surface matrices

Note

this function adds information to the metainformation of the x3p scan it is given that is required for calculating, for example, the pairwise-complete correlation using the comparison_cor function.

Examples


data(fadul1.1_processed,fadul1.2_processed)

cellTibble <- fadul1.1_processed %>%
comparison_cellDivision(numCells = c(8,8)) %>%
dplyr::mutate(regionHeightValues = comparison_getTargetRegions(cellHeightValues = cellHeightValues,
                                                               target = fadul1.2_processed)) %>%
dplyr::mutate(cellPropMissing = comparison_calcPropMissing(heightValues = cellHeightValues),
              regionPropMissing = comparison_calcPropMissing(heightValues = regionHeightValues)) %>%
dplyr::filter(cellPropMissing <= .85 & regionPropMissing <= .85) %>%
dplyr::mutate(cellHeightValues = comparison_standardizeHeights(heightValues = cellHeightValues),
             regionHeightValues = comparison_standardizeHeights(heightValues = regionHeightValues))

head(cellTibble)
#> # A tibble: 6 x 5
#>   cellIndex cellHeightValues regionHeightValues cellPropMissing regionPropMissi~
#>   <chr>     <named list>     <named list>                 <dbl>            <dbl>
#> 1 1, 6      <x3p>            <x3p>                        0.833            0.811
#> 2 2, 7      <x3p>            <x3p>                        0.657            0.700
#> 3 2, 8      <x3p>            <x3p>                        0.834            0.757
#> 4 3, 8      <x3p>            <x3p>                        0.353            0.638
#> 5 4, 8      <x3p>            <x3p>                        0.153            0.576
#> 6 5, 1      <x3p>            <x3p>                        0.117            0.771