I have a dataset that I want to use for building a Decision Tree in R studio. I have quite a few factors which are empty. I want to change all Factors that are empty in the dataset to "No Data", I have over 100 of these so I don't want to do them one by one, I'd rather be able to change all of them at once.
Example of data (Please note that these are all factors, I know that when it's put into R they are numerics but I don't know how to show factors in a replicated way as I read in the data from a csv):
Outcome=c(1,1,1,0,0,0)
VarA=c(1,1,NA,0,0,NA)
VarB=c(0,NA,1,1,NA,0)
VarC=c(0,NA,1,1,NA,0)
VarD=c(0,1,NA,0,0,0)
VarE=c(0,NA,1,1,NA,NA)
VarF=c(NA,NA,0,1,0,0)
VarG=c(0,NA,1,1,NA,0)
df=as.data.frame(cbind(Outcome, VarA, VarB,VarC,VarD,VarE,VarF,VarG))