0

I am trying to go through an entire dataframe and replace null values with zero. There are a large amount of columns so this would be cumbersome to do column by column. I was thinking of something on the lines of

for (Var in names(housing.test.df)) {
  for (row in housing.test.df[,Var]) {
    if(is.na(housing.test.df[row,Var]))
    {housing.test.df[row,Var] <- 0}
         }
  }

Where housing.test.df is the dataframe

B Bow
  • 9

0 Answers0