Several questions on stackoverflow have dealt with the "invalid multibyte string" error in R, which is triggered when certain string-handling functions receive strings that do not have string Encoding set correctly. See stackoverflow.com/questions/14363085/invalid-multibyte-string-in-read-csv or stackoverflow.com/questions/4993837/r-invalid-multibyte-string for answers that deal with how to set Encoding.
My question is: How do I detect where the problem is? This is needed because it may not be possible to know by visual inspection when the bad Encoding is only in a few elements of a long vector, or in columns of a large dataframe.