How to deal with NA data in R language
This article introduces the knowledge of "how to deal with NA data in R language". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!
Handle, replace or delete NA cases that exist in the data
Processing data with NA values
Dat sample1 sample2 sample2.1A 1 5 8B 2 NA NAC NA 7 10D 4 9 1
Replace all null values with zeros
> for (I in 1:ncol (dat)) {+ dat [is.na (dat [, I]), I] = 0 +} > dat sample1 sample2 sample2.1A 158B 200C 0 7 10D 4 9 1
Delete all NA data
> for (I in 1:ncol (dat)) {+ dat=dat [! is.na (dat [, I]),] +} > dat sample1 sample2 sample2.1A 158D 491 "how to process NA data in R language" ends here. Thank you for your reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!