powered by
This function takes a model string and counts the number of predictor variables.
count.mod.vars(model)
an integer specifying the count of predictor variables
model specified as a string in the form "y ~ x1 + x2 ..."
count <- count.mod.vars(model=formula('y ~ x1 + x2')) if(count == 2) { print('sane'); }else{ print('insane')}
Run the code above in your browser using DataLab