Displaying 1 result from an estimated 1 matches for "condconv".
Did you mean:
condcode
2008 Sep 07
1
Request for advice on character set conversions (those damn Excel files, again ...)
...nction(d, from="latin1",to="UTF-8"){
# Semi-smart conversion of a dataframe between charsets.
# Needed to ease use of those [@!] Excel files
# that have survived the Win3.1 --> Win95 --> NT transition,
# usually in poor shape..
conv1<-function(v,from,to) {
condconv<-function(v,from,to) {
cnv<-is.na(iconv(v,to,to))
v[cnv]<-iconv(v[cnv],from,to)
return(v)
}
if (is.factor(v)) {
l<-condconv(levels(v),from,to)
levels(v)<-l
return(v)
}
else if (is.character(v)) return(condconv(v,from,to))
else r...