How do I replace NA values with zeros in an R dataframe?

后端 未结 20 2297
说谎
说谎 2020-11-21 23:41

I have a data frame and some columns have NA values.

How do I replace these NA values with zeroes?

20条回答
  •  失恋的感觉
    2020-11-22 00:19

    if you want to assign a new name after changing the NAs in a specific column in this case column V3, use you can do also like this

    my.data.frame$the.new.column.name <- ifelse(is.na(my.data.frame$V3),0,1)
    

提交回复
热议问题