I am learning R for the first time. not sure how I can assign a "0" or 1 to the data I have. I have a list of states and home prices info data frame. how can I assign 0 or 1 to the states?
states HOMEPRICE
CA 200000
AZ 1000000
SD 230000
IL 30000
For this data ,CA should show as 1 and everything else as 0
states HOMEPRICE newcolumn
CA 200000 1
AZ 1000000 0
SD 230000 0
IL 30000 0
appreciate any help