Write a dataframe to csv file with value of NA as blank

后端 未结 2 1003
终归单人心
终归单人心 2020-12-16 10:35

There is a dataframe named cnbd, for example:

cnbd = data.frame(1,2,3,NA,NA,5)

Thus the expression:



        
2条回答
  •  粉色の甜心
    2020-12-16 11:09

    Try this:

    write.table(df, "cnbd.csv",
                na = "",
                row.names = FALSE,
                col.names = FALSE,
                append = TRUE,
                sep = ",")
    

提交回复
热议问题