Replace NA with Zero in dplyr without using list()

后端 未结 4 1348
Happy的楠姐
Happy的楠姐 2020-12-09 18:07

In dplyr I can replace NA with 0 using the following code. The issue is this inserts a list into my data frame which screws up further analysis down the line. I don\'t even

4条回答
  •  挽巷
    挽巷 (楼主)
    2020-12-09 18:23

    To replace all NAs in a dataframe use

    df %>% replace(is.na(.), 0)

提交回复
热议问题