Trying out the Reggression model with a selected dataset..it doesnot work but wiError in `contrasts<-`(`*tmp*`, value = contr.funs[1 + isOF[nn]]) : contrasts can be applied only to factors with 2 or more levels Using the th the original dataset it work

mdr.logistic ← glm(formula= mdr_ecoli ~ THERPYN,

  •                  data = DMUg_MDR, 
    
  •                  family = binomial)
    

What steps have you already taken to find an answer?

Provide an example of your R code

Follow-up

  • Thank the volunteers who try to help you
  • Mark one reply as the “Solution” if appropriate

Hello,

It’s hard to diagnose what is going wrong without access to the data or some fake data that replicates the issue.

I would guess that THERPYN is either not a factor/integer or has zero-variance, i.e., every record in the dataset has the same value for this variable.

All the best,

Tim

@ibrahimm_mugerwa Thanks for posting!
Here is an info page and video tutorial on how to post an R code question in a way that makes it easy for us to help you.

1 Like

I appreciate, Issue was some how sorted
Rgds

1 Like

Another Issue, been trying to work with Figtree phylogenetics but I cant install package ggtree even when I update my packages, I get a warning message below: I visited stackoverflow and trouble shot but in vain. How do i get out of this?

Warning in install.packages : package ‘ggtree’ is not available for this version of R
A version of this package for your version of R might be available elsewhere, I

1 Like

Hi,

It sounds like you either need to upgrade your version of R on your computer to one that is compatible with the current version of ggtree or install an old version of the ggtree package that is compatible with your current version of R.

All the best,

Tim