Skip to content

Allow custom na.action in bart2() and dbartsData() #61

@ngreifer

Description

@ngreifer

bart2() calls dbartData() to handle the inputs. When a formula and data.frame are supplied, dbartsData() calls model.frame() using similar infrastructure to lm(), which is very common in packages that allow a formula interface. However, dbartsData() assigns stats::na.omit to na.action, which drops any observations with missingness. This guarantees missing values do not enter the dataset and cause errors, but omitting missing observations is not the only way to handle them. For example, one might write a custom function that imputes the missing values (e.g., with the mean). I request that dbartsData() and bart2() accept an na.action argument that allows users to supply their own function for processing missing values. This should also be followed by a check to make sure no missing values remain in the dataset after running model.frame(). The default can be na.omit, which is currently what is hard-coded in. Thank you.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions