Using Only Categorical Variables to Predict a Continuous Variable Data: The dataset that looks like this (fabricated but similar to real data):

Goal: Use 70 (categorical) variables to predict each household's electricity usage (numerical).
Independent Variables:
"id": each household's ID. 
"sex": 2 categories. (1 for men, 2 for women.)
"age": 4 categories. (1 for 18-25 years old, etc.)
"occupation": 5 categories.
"heat_home": 2 categories (1 for yes, 0 for no.)
"education": 5 categories.
"income": 5 catogories. (1 for less than 15k, 2 for between 15k-20k, etc.)
Dependent Variable: "usage": numerical, measured in kwh.
Question:
I coded the categorical variables as factors in R, but it gave me errors.
How would you deal with these categorical variables? Is it better to code them as dummies instead of factors? You're also welcome to give me advice on how to run 5-fold cross-validation using lasso and double machine learning.
Sample code:
 Here's my sample R code using forward selection method: 
train <- read.csv("train.csv")

# Make the 70 categorical variables factors 
names <- c(1:70)
train[, names] <- lapply(train[, names], factor)

# forward selection
forward <- trainControl(method = "cv", number = 5)
forward_train <- train(usage ~., data = train,
                       
                       # or "leapBackward" or "leapSeq" 
                       method = "leapForward", 
                       
                       # "nvmax" = max number of variables 
                       tuneGrid = data.frame(nvmax = 1:2),   
                  
                       # specify: 5-fold CV 
                       trControl = forward                     
)

However, it gives me error like this:

 A: I would not use lasso. The state of the art in machine learning are ensemble/boosting methods (lightgbm, RF, HistGradientClassifier (and Regressor but also works with trees)), especially in kaggle competitions, thus if it is possible I would always try to use a method relying on trees, even if it is no ensemble. We can do so in your case.
The rpart package from r is able to handle regression trees also known as CART with a target as yours (I suppose you do not want to discretize your target outcome). Although this tend a little to overfit, as it has no aggregated trees which can make a decision on the final outcome, it would still be better than Lasso imho. If you still want to use lasso, I can look for a notebook with elastic_net in my repo, which contains a fluent intervall between lasso and ridge.
To have a first look into rpart look here: https://www.geeksforgeeks.org/decision-tree-for-regression-in-r-programming/
You are also cordially invited to use a notebook from me:
The keywords are method="anova" thus rpart know its time for a regression not a classifier task. The notebook should still function, if not come back to me. This notebook also includes a 10-fold cv, as you can see with multifolds
If you are feeling fine with ML in R. You should change to mlr3 the pendant to scikit in R.
#'repeated K_Fold Model check
splits <- createMultiFolds(df_mush$target, k = 10, times = 10)

scores <- c()
for (split in splits) {  
    
    train <- df_mush[split, ]
    test <- df_mush[-split, ]
        
    model_tree <- rpart(target~ ., 
                     data = train, 
                     parms = list(split ="information"),
                     method = "anova",
                     control = rpart.control(minsplit = 1,
                                             xval = 1,
                                             cp = 0.01))
    
    print(model_tree)
    print(prp(model_tree))

    test_predict_cv <- predict(model_tree, test)
    
    accuracy <- confusionMatrix(table(test_predict_cv, test$class))
    accuracy <- accuracy$overall["Accuracy"] %>% 
      as.numeric()
    
    scores <- append(scores, accuracy)
}
print(mean(scores))

If you have any questions doesn't matter the subject, feel free to write me here or send me a message! I'm always eager to help.
*Update do not forget to install the packages rpart, rpart.plot, caret, magrittr and e1071 I believe is also a good option
