Standardizing qualitative variables in R to perform glm's, glm.nb's and lm's [closed]

I want to standardize the variables of a biological dataset. I need to run glm's, glm.nb's and lm's using different response variables but the same explanatory variables.

The dataset contains counts of a given tree species by plots (all the plots have the same size) and a series of categorical variables: vegetation type, soil type and presence/absence of cattle.

This is an example of the kind of dataset that I have:

DATA

set.seed(1234)
dat <- data.frame(Plot_ID = 1:80,
Ct_tree = sample(x = 1:400, replace = T),
Veg = as.factor(sample(x = c("Dry", "Wet", "Mixed"), size = 80, replace = T)),
Soil = as.factor(sample(x = c("Clay", "Sandy", "Rocky"), size = 80, replace = T)),
Cattle = as.factor(rep(x = c(0, 1), each = 5)))


PROBLEM

As all the explanatory variables are categorical, I'm not sure whether it is possible to produce standardized lm models with standardized coefficients and standard errors. I cannot standardize the explanatory variables above using scale() from base R because I get an error as they are non-numeric.

QUESTIONS

1) Is there a way to standardize explanatory categorical (factors) variables?

2) Can I standardize the response variables instead using scale() or the standardize R package?

3) If I standardize the response variables, how do I interpret the regression coefficients? In addition, When the response variable is abundance (absence/presence as 0/1 respectively), standardizing them will remove their binary values so I will not be able to apply a binomial family.

4) Is it statistically correct to recode the categorical variables as ordinal (e.g. Soil = 0 for clay, 1 for sandy, 2 for rocky), scale them and then apply the regression models to their rescaled values?

closed as too broad by user158565, kjetil b halvorsen, Peter Flom♦Dec 29 '18 at 12:08

Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

• Welcome to the site. You have asked 6 questions in one - that's why your question is "too broad". Some of those 6 are about R code and such questions are off topic here. But you also ask about standardizing qualitative variables - that would be on topic, if you edited your question to focus on that and removed stuff about R. – Peter Flom Dec 29 '18 at 12:09