So factors can be created with the factor function, and

the input into the factor function is a character vector.

So here, I'm just creating a simple factor with the which has what, two levels, and

the levels are yes and no.

And so x is a factor, you can see what,

it prints out a little bit differently from a character vector,

in the sense that it prints up the value, yes, yes, no, yes, no.

And then it has a separate attribute which is called the levels.

And so the levels of this factor are no and yes, okay.

So there's only two levels.

I can, I can call table on this factor and

it will give me a frequency count of how many of each level there are.

So for example, it'll tell me there are two nodes.

And there's three yeses.

Now, the un-class function strips out the class for fa, for a vector.

So for example, I can, if I call un-class on x it'll,

it'll kind of bring it down to an integer vector, and you can see that underlying.

The factors represent as 22121 so, yes, it's coded as two and

no, it's coded as one.

Now it's not really essential for you to know this because you can

just treat the factor as being a vector of yeses and nos but it's used sometimes it's

it's useful just to know under, underneath kind of how factors are represented by R.

And so you see, it's really an integer vector with the attribute,

the levels attribute of no and yes.