I have the following data:

Rank    Platforms        Technology

high    Windows||Linux   Unity
high    Linux             
low     Windows          Unreal 
low     Linux||MacOs     GameMakerStudio||Unity||Unreal
low                      GameMakerStudio

Both Platforms and Technology are categorical variables and each row can have one, or multiple, or Empty value.

How do I go about building a logistic regression model that predict the Rank as high or low in R?

I am thinking to separate the variable into multiple Boolean variables: like is_windows = [true, false], is_mac = [true, false],etc... However, for Technology, there are about 21 unique values.


1 Answer 1


Use One Hot Encoding. Here a link to tutorial. It's in python, but you should get the idea. It's pretty basic stuff, so I guess it should be available in some R package.

  • $\begingroup$ Hi @Piotr Rarus, that works for variable that has one value a time. Not multiple values $\endgroup$
    – hydradon
    Commented Nov 18, 2019 at 23:23
  • $\begingroup$ Not really. Consider technologies: GameMakerStudio, Unity, Unreal. Our record has all these values, so you just code it as [1, 1, 1]. You must be mistaking it for label encoding. $\endgroup$ Commented Nov 19, 2019 at 8:19
  • $\begingroup$ could you post a full working example? Thank you $\endgroup$
    – hydradon
    Commented Nov 19, 2019 at 14:13
  • $\begingroup$ Check this $\endgroup$ Commented Nov 19, 2019 at 14:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.