When and where dummy.data.frame would be used?
The original df looks like:
     title salary
1 engineer  51000
2  manager  33700
3    sales  26800
4 engineer  53700
5    sales  36800

Using dummy.data.frame(df), the character column &quot;title&quot; is recoded as &quot;one-hot&quot; (aka as dummy variable). Each column =1 if title=TRUE (or zero otherwise).
  titleengineer titlemanager titlesales salary
1             1            0          0  51000
2             0            1          0  33700
3             0            0          1  26800
4             1            0          0  53700
5             0            0          1  36800

An alternative encoding would be to use &quot;title&quot; as a factor with three levels
df$title = as.factor(df$title).
However, in many cases &quot;one hot&quot; can be digested better by ML algorithms.
Simple example:
title &lt;- c('engineer','manager','sales','engineer','sales')
salary &lt;- c(51000, 33700, 26800, 53700, 36800)
df = data.frame(title, salary)
df

library(dummies)
df2 = dummy.data.frame(df)
df2

OLS model with &quot;factor&quot;:
df$title = as.factor(df$title)
ols = lm(salary~., data=df)
summary(ols)

Output:
Call:
lm(formula = salary ~ ., data = df)

Residuals:
         1          2          3          4          5 
-1.350e+03  5.684e-14 -5.000e+03  1.350e+03  5.000e+03 

Coefficients:
             Estimate Std. Error t value Pr(&gt;|t|)   
(Intercept)     52350       3662  14.295  0.00486 **
titlemanager   -18650       6343  -2.940  0.09882 . 
titlesales     -20550       5179  -3.968  0.05804 . 
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

Residual standard error: 5179 on 2 degrees of freedom
Multiple R-squared:  0.8992,    Adjusted R-squared:  0.7983 
F-statistic: 8.918 on 2 and 2 DF,  p-value: 0.1008

OLS model with &quot;dummies&quot;:
ols2 = lm(salary~titlemanager+titlesales, data=df2)
summary(ols2)

Output:
Call:
lm(formula = salary ~ titlemanager + titlesales, data = df2)

Residuals:
         1          2          3          4          5 
-1.350e+03  5.684e-14 -5.000e+03  1.350e+03  5.000e+03 

Coefficients:
             Estimate Std. Error t value Pr(&gt;|t|)   
(Intercept)     52350       3662  14.295  0.00486 **
titlemanager   -18650       6343  -2.940  0.09882 . 
titlesales     -20550       5179  -3.968  0.05804 . 
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

Residual standard error: 5179 on 2 degrees of freedom
Multiple R-squared:  0.8992,    Adjusted R-squared:  0.7983 
F-statistic: 8.918 on 2 and 2 DF,  p-value: 0.1008

Summary:
Results are the same. Dummies are a different representation of R's factors. Sometimes you need to pass content explicity as dummies. In this case model.matrix() often is useful. (docs)