I want to replace all the NaN is ds with 0, and after searching past posts I found I can hardcode it like this:
ds$adj.r.squared=replace(ds$adj.r.squared,is.nan(ds$adj.r.squared),0)
ds$fstatistic=replace(ds$fstatistic,is.nan(ds$fstatistic),0)
...
ds$tstatistic=replace(ds$tstatistic,is.nan(ds$tstatistic),0)

But, there has to be a more elegant/general solution. I've tried messing around with lapply but can't seem to get it to work.