0

Good morning, everyone, In the following R code, i want to change (NULL) value to zero. but instead it changes to NA value. Any ideas? Thank you. Dennis

Loss_df$os[Loss_df$os == "(Null)"] <- 0

dennis
  • 119
  • 1
  • 8
  • Is your data character or factor? – IceCreamToucan Feb 05 '18 at 18:35
  • When asking for help, you should include a simple [reproducible example](https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example) with sample input and desired output that can be used to test and verify possible solutions. Chances are your `os` column is a factor. Unclear whether you want it to be numeric or not. – MrFlick Feb 05 '18 at 18:35
  • 2
    Try `is.null(Loss_df$os)` in place of `Loss_df$os == "(Null)"` – CPak Feb 05 '18 at 18:44
  • thanks. the input value is just a value of : (Null). the value (Null) shows in the report. i want to change zero. – dennis Feb 05 '18 at 19:05
  • thanks, figured out by changing to ifelse: ifelse(Loss_df$os =="(Null)", 0, Loss_df$os) – dennis Feb 05 '18 at 21:20

0 Answers0