I have a dataset with several variables that are lists (var\_1 and var\_2). My goal is to convert these variables to factor variables.

The dataset looks like this:

```
var_1    |   var_2
Value_1  |   Value_A
Value_2  |   Value_C
Value_3  |   Value_A
Value_43 |   Value_Z
Value_3  |   Value_A
Value_24 |   Value_Y

```

Here is what I have with a typeof() function:

```
typeof(mydataset$var_1)
[1] "list"

typeof(mydataset$var_2)
[1] "list"

```

Here is what I get with a str() function

```
str(mydataset)
Classes ‘data.table’ and 'data.frame':  83 obs. of  6 variables:
$ var_1 :List of 83
..$ : chr "Value_1"
..$ : chr "Value_2"
..$ : chr "Value_3"
..$ : chr "Value_43"
..$ : chr "Value_3"
..$ : chr "Value_24"
 etc...
$ var_2 :List of 83
..$ : chr "Value_A"
..$ : chr "Value_C"
..$ : chr "Value_A"
..$ : chr "Value_Z"
..$ : chr "Value_A"
..$ : chr "Value_Y"
 etc...

```

How can I turn these variable into factor variable?