Skip to content

Any possibility of adding na.rm=FALSE argument to the genDataDensity and addDataDensity functions? #237

@vlulla

Description

@vlulla

The below example demonstrates a small issue i ran into when i was trying to generate data from an arbitrary distribution using the genDataDensity function:

R> library("NHANES")
R> library("simstudy")
R> x <- NHANES$Height
R> d <- genDataDensity(n=500L,x,varname="ht")
Error in density.default(dataDist, n = 10000) :
  'x' contains missing values
R> d <- genDataDensity(n=500L,x[!is.na(x)],varname="ht") ## workaround
R> ## d <- genDataDensity(n=500L,x,varname="ht",na.rm=TRUE) ## would be nice...

Since na.rm=FALSE is also the default for stats::density, I understand why you do not include na.rm argument for these functions. Can I please make a request to add na.rm argument to the genDataDensity and addDataDensity functions? I will benefit from having this pass-through argument as a part of these function calls. And, since i know a workaround I can definitely generate the data without this argument. Therefore, whatever you decide is fine with me.

Thanks for a great package! I love using simstudy!

Metadata

Metadata

Assignees

Labels

featurefeature request or enhancement

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions