Guest User

Untitled

a guest
Jul 17th, 2018
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.51 KB | None | 0 0
  1. Index 2015 2016 2017
  2. 1 NA 6355698 10107023
  3. 2 13000000 NA NA
  4. 4 NA NA NA
  5. 5 NA NA 8000000
  6. 6 331000000 659000000 1040000000
  7. 7 NA NA 32032920
  8. 8 NA NA 20000000
  9. 9 2521880 5061370 7044288
  10. ...
  11.  
  12. ind <- which(is.na(df), arr.ind=TRUE)
  13. df[ind] <- rowMeans(df, na.rm = TRUE)[ind[,1]]
Add Comment
Please, Sign In to add comment