Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in R Programming by (50.2k points)

I have this line working:

access$`Reading Score` <- gsub('NA', '', access$`Reading Score`)

And from that, I want to apply the same thing to 20+ more columns. Without having to explicitly write out all 20 column changes, is there a way to do this when the cell's contents exactly match 'NA'? 

1 Answer

0 votes
by (107k points)

I think it is better not to introduce the "NA" values into the data in the first place. Say, for instance, you can call:

library(readxl)

readxl::read_excel(path, na = "NA") 

and it will convert all the "NA" to NA. 

If you want to more about R then do refer to the R programming tutorial.

31k questions

32.8k answers

501 comments

693 users

Browse Categories

...