How to encode a column to the same type

28 Views Asked by At

I want to ceate a dummy variable so I creaed the following command: dummyset$Jakr <- ifelse(dummyset$Landkreis == "Jagstkreis", 1, 0) Everything works but I have a few rows where Landkreis == Jagstkreis and still there is no 1 appearing in the dummycolumn. I tried removing blank spaces and all stuff and came to the point where I saw the encoding of one row is "unknown" whereas the other wa "UTF-8". The thing is the command works on every row that is "unkown" but on no where it is "UTF-8". Next I tried: dummyset$Landkreis <- iconv(dummyset$Landkreis, from = "UTF-8", to = "unknown") dummyset$Landkreis <- stri_enc_toutf8(dummyset$Landkreis) dummyset$Landkreis <- gsub("[^[:print:]]", "", dummyset$Landkreis)

But no matter what i try the encoding wont change...

Does anyone has a idea on how to approach this problem? Thanks!

I tried to convert two rows into the same encoding as a command was only working on one row but not on the other

0

There are 0 best solutions below