Quantcast
Channel: Active questions tagged r - Stack Overflow
Viewing all articles
Browse latest Browse all 201839

as.factor with levels 0, 1 instead of 1, 2

$
0
0

My variable (poor) is a factor with 2 levels: Poor and Non-Poor.

I need it to be 1 if it's Poor and 0 if it's Non-Poor, so i converted it to numeric (with as.numeric, and then changed it to factor again, with as.factor, but the levels now are 1 and 2 instead of 1 and 0.

How do i change it?


Viewing all articles
Browse latest Browse all 201839

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>