I am trying to create a summary for calculating mean,median average but somewhere getting NaN values in my summary , now i want to replace NaN with "0.0"
average
Mean
Median
total
NaN
NaN
NaN
0
I am trying like below
but when i am checking class of tabl is data.frame
Tabl[2, ](is.nan(Tabl[2, ])) <- "0.0"
Error in is.nan(`*tmp*`) : default method not implemented for type 'list'
Hi,
I think you want to use is.na() rather than is.nan(). They do for some reason behave differently, is it maybe because of the different forms a missing value can have?
And if you want to replace only the NAs in row 2 (that's how I understand your code example), you need to wrap the is.na(...) in squared brackets and not in normal ones (it's just a second indexing).