0

I am working on data cleaning techniques in R

I have a data.frame as shown below:

    names marks
1  dinesh    20
2            30
3 achyuth    40
4            NA
5  mourya    50
6            NA
7    hima    50

Here in the above result,

  1. I need to replace the "empty space (or) white space" in the names column with "null".
  2. And I need to replace the NA in the marks column with "0".

Could any one suggest how to get this done?

Dinesh
  • 239
  • 2
  • 12
  • 1
    NULL is not a value that can live as an element of a vector in a data frame. So do you mean the text string "NULL", or maybe ""? – Mike Wise Jun 10 '15 at 06:45
  • yes I want to replace with text string "NULL" – Dinesh Jun 11 '15 at 05:19
  • Check out the related question: https://stackoverflow.com/questions/18144427/how-to-replace-missing-white-space-with-na-in-r – Aaron C Aug 01 '23 at 03:53
  • or if you want to do it to many columns: https://stackoverflow.com/questions/76815200/r-dplyr-replace-strings-with-only-spaces-for-all-columns – Aaron C Aug 02 '23 at 03:31

0 Answers0