impute_xifti: Impute '"xifti"' data

View source: R/impute_xifti.R

impute_xiftiR Documentation

Impute "xifti" data

Description

Impute locations using the values of neighboring locations.

Usage

impute_xifti(
  xifti,
  mask = NULL,
  impute_FUN = function(x) {
     mean(x, na.rm = TRUE)
 },
  ...
)

Arguments

xifti

A "xifti" object. The corresponding surface must be included for each cortex with data. add_surf can be used to add HCP S1200 surfaces.

mask

A logical vector whose length matches the number of rows in xifti, indicating which locations in xifti to impute. (Locations that are TRUE will be imputed.)

If NULL (default), will use the mask of locations with at least one NA and NaN value across the columns of xifti. The NA and NaN locations will be replaced with numeric values (except in the case of any voxels with no immediate neighbors).

On the other hand, if mask is provided, the NA and NaN values originally in xifti, and not in mask, will be left alone. Only locations in mask will be imputed.

impute_FUN

The function to use to impute the values. It should accept a vector of numeric values (the values of neighboring locations) and return a single numeric value (the value to assign). Default: mean(..., na.rm=TRUE).

...

Additional arguments to impute_FUN.

Details

Cortex vertices will be imputed using the five or six other vertices which share a face. Subcortex voxels will be imputed using the up to six immediate neighbors.

Note that during imputation, locations in mask, as well as the medial wall for the cortex, are temporarily set to NA.

Note that handling of NA values and the mask slightly differs from the cortex and subcortex. impute_FUN like mean will behave similarly, but functions which change depending on the amount of neighbor locations with NA values may differ. impute_FUN should handle NA values accordingly. For most use cases, it will make sense to pass na.rm=TRUE to ... if impute_FUN is a summary function like mean.

Value

The input xifti with imputed data values.

See Also

Other manipulating xifti: add_surf(), apply_parc(), apply_xifti(), combine_xifti(), convert_xifti(), merge_xifti(), move_to_mwall(), move_to_submask(), newdata_xifti(), remap_cifti(), remove_xifti(), resample_cifti(), resample_cifti_from_template(), scale_xifti(), select_xifti(), set_names_xifti(), smooth_cifti(), transform_xifti()


ciftiTools documentation built on April 4, 2025, 1:09 a.m.