→ chitaiwar: df$addr <- sapply(df$addr, function(x) iconv(x, 04/14 12:04
→ chitaiwar: 'UTF8', 'big5')) 小弟不才 嘗試解 有錯請指正 04/14 12:06
→ cywhale: 何不試試看抓資料回來時就讓它是正確的編碼?也許可行 04/14 12:16
→ cywhale: dbGetQuery(conn, "set client_encoding to 'Big5'") 04/14 12:16
→ cywhale: then dbReadTable(conn, "YourTableName") 04/14 12:17
→ Wush978: 用`[[`, ex: df[["addr"]] 04/14 13:30
→ joedenkidd: 這樣單欄可處理 df$addr,想請問要如何處理整個導進來 04/14 13:56
→ joedenkidd: 的table? 04/14 13:56
推 RogerHsieh99: for i in c(1:length(df)){ 04/14 14:15
→ RogerHsieh99: df[i] <- iconv(df[i], "UTF8", "big5")} 04/14 14:15
→ RogerHsieh99: 小弟也是新手,不曉得有沒有解決到你的問題 04/14 14:16
→ joedenkidd: for(x in c(1:16)){ res[[x]]=iconv(res[[x]],"UTF8" 04/14 14:37
→ joedenkidd: ,"CP950") } 04/14 14:37
→ celestialgod: data.table: DT[ , lapply(.SD, function(x){ 04/14 22:19
→ celestialgod: iconv(x,"UTF8", "BIG5")}] 04/14 22:20
→ celestialgod: dplyr: DF %>% mutate_each(funs(iconv(., "UTF8", 04/14 22:20
→ celestialgod: "BIG5"))) 04/14 22:21
→ celestialgod: 如果要限定character column可以使用 mutate_if 04/14 22:21
→ celestialgod: DF %>% mutate_if(is.character, funs(iconv(., 04/14 22:23
→ celestialgod: "UTF8", "BIG5"))) 04/14 22:23
→ celestialgod: 我應該回一篇文章的Orz 04/14 22:23