0

I'm getting an error while working with a deletion/substitution/addition(DSA) algorithm on my data.

The package I'm using is: DSA

The error is:

Error in get.forced.terms(formula, data, Xlearn, expand.forced.term.factors) : 

WARNING: Incorrect formula for forcedterms. 

I ran it step by step and the error is in the last line (mod = mclapply...)

Thanks for the help!

Here is my code:

dsa_algorithm = function(data.long,outcome,expo,covar,CV,n.cores){
  confounders = paste(covar,collapse=" + ") 
  data = data.long[!is.na(data.long[,outcome]),c("ID",outcome,expo,covar)]
  form = paste(outcome,"~",confounders) %>% formula
  mod = mclapply(1:CV, 
                 function(x) DSA(form,
                                 data=data,
                                 maxsize=50, 
                                 maxorderint=1, 
                                 maxsumofpow=1, 
                                 id=data$ID,),
                 mc.cores = n.cores)
 

I checked data, variables and everything seems to be in order.

Gio
  • 1
  • It's . asier to help you if you 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. What exactly are you passing to this function? – MrFlick Nov 02 '22 at 15:21

0 Answers0