I have a large data frame, with two specific rate% columns in R
response rate accept rate
1. 70%. 65%
2. 12% NA
3. NA 100%
4. 78% 20%
5. NA 7%
6. 51% NA
I want to fill out the NA with column means for each column.I want the result like this:
(70%+12%+78%+51)/4=52.75% (65%+100%+20+0%)/4=46%
begin rate end rate
1. 70%. 65%
2. 12% 46%
3. 52.75% 100%
4. 78% 20%
5. 52.75% 0%
6. 51% 46%
I do not know how to achieve this in R. Thanks in advance!!