I have a dependent variable which has values of 1 and 2. How can i convert it to 0 and 1?

I have another query w.r.t to the independent variables i.e.
Q: While running a logistic regression, is is mandatory to convert all the independent variables into dummies? Sa for eg: I have a variables X which has values ranging from 1 to 10. Do i need to create dummies for this variable X before running the regression?

Could you please try to use a self-contained reprex (short for reproducible example)? It will help us help you if we can be sure we're all working with/looking at the same stuff.

If you run into problems with access to your clipboard, you can specify an outfile for the reprex, and then copy and paste the contents into the forum.

Logistic regressions may accept continuous, discrete, dichotomous, or a mix of any of these as explanatory variables.

I personally like the UCLA Institute for Digital Research and Education R resource pages, which has a handy guide to applying logit-model in R. LOGIT REGRESSION | R DATA ANALYSIS EXAMPLES.