I have a data frame (df) that I initially read in from xlsx document. I am trying to create a new df with all the missing values replaced by 999999. When I run the following command:  
LPAv0.4.2 <- LPAv0.3 %>% mutate_all(funs(replace(., is.na(.), 999999)))
I get the following error:
13. stop(structure(list(message = "Evaluation error: 'origin' must be supplied.", call = mutate_impl(.data, dots), cppstack = NULL), .Names = c("message", "call", "cppstack"), class = c("Rcpp::eval_error", "C++Error", "error", "condition")))
12. mutate_impl(.data, dots)
11. mutate.tbl_df(.tbl, !(!(!funs)))
10. mutate(.tbl, !(!(!funs)))
9. mutate_all(., funs(replace(., is.na(.), 999999)))
8. function_list[[k]](value)
7. withVisible(function_list[[k]](value))
6. freduce(value, `_function_list`)
5. `_fseq`(`_lhs`)
4. eval(expr, envir, enclos)
3. eval(quote(`_fseq`(`_lhs`)), env, env)
2. withVisible(eval(quote(`_fseq`(`_lhs`)), env, env))
1. LPAv0.3 %>% mutate_all(funs(replace(., is.na(.), 999999)))
The weird thing is that if I write LPAv0.3 to a csv , then read it back in, the LPAv0.4.2 <- LPAv0.3 %>% mutate_all(funs(replace(., is.na(.), 999999))) command works as expected. However, if I write out to an xlsx file, then read back in, it fails again with the error above.
Any idea why this is happening? Also, any idea how I can replace all the missing values without having to print out of R then import it back in? 
Thanks in advance.
error message
Error in as.POSIXct.numeric(value) : 'origin' must be supplied
    16. stop("'origin' must be supplied")
    15. as.POSIXct.numeric(value)
    14. as.POSIXct(value)
    13. `[<-.POSIXct`(`*tmp*`, thisvar, value = 99999)
    12. `[<-`(`*tmp*`, thisvar, value = 99999)
    11. `[<-.data.frame`(`*tmp*`, list, value = 99999)
    10. `[<-`(`*tmp*`, list, value = 99999)
    9. replace(., is.na(.), 99999)
    8. function_list[[k]](value)
    7. withVisible(function_list[[k]](value))
    6. freduce(value, `_function_list`)
    5. `_fseq`(`_lhs`)
    4. eval(expr, envir, enclos)
    3. eval(quote(`_fseq`(`_lhs`)), env, env)
    2. withVisible(eval(quote(`_fseq`(`_lhs`)), env, env))
    1. LPAv0.3 %>% replace(., is.na(.), 99999)
 
     
     
    