Encoding in data.table in R

by FlyingPickle   Last Updated August 13, 2019 22:26 PM

I have an R data.table like below:

Date         Notes
12/2/2018   Car Serviced
12/4/2018   Purchased grocery
12/5/2018   Purchase fuel

I want to change the encoding of the Notes column. I have the Notes column in a variable name. So far have tried


Error in `Encoding<-`(`*tmp*`, value = "UTF-8") : 
  a character vector argument expected

dt[, (colname):=enc2utf8(dt[,(colname)])]

Which unfortunately did not work either.

Also noticed that


Is a factor...

Any thoughts on how I can achieve this? Thanks!

Tags : r data.table

Related Questions

Updated June 11, 2017 00:26 AM

Updated November 19, 2017 04:26 AM

Updated July 19, 2015 17:11 PM

Updated March 29, 2015 07:08 AM

Updated March 29, 2018 19:26 PM