RStudio控制台(console)中出现少量中文乱码的解决方法

一般出现在英文Windows操作系统中,且Control Panel——Region——Administrative——Language for non-Unicode programs中的设置为Chinese(Simplified, China)。

乱码症状如下:

> glm.probs=predict(glm.fit,type="survived") Error in match.arg(type) : arg should be one of 搇ink? 搑esponse? 搕erms?>

====================================

解决方法:

1、在控制台中输入Sys.setlocale("LC_ALL","Chinese")就可以解决问题。

2、或者把Language for non-Unicode programs改为English也可以解决。但这样一来其他中文程序就会显示乱码了。。。

一般出现在英文Windows操作系统中,且Control Panel——Region——Administrative——Language for non-Unicode programs中的设置为Chinese(Simplified, China)。 乱码症状如下: > glm.probs=predict(glm.fit,type="survived") Error in match.arg(type) : arg should be one of 搇ink? 搑esponse? 搕erms?> ==================================== 解决方法: 1、在控制台中输入Sys.setlocale("LC_ALL","Chinese")就可以解决问题。 2、或者把Language for non-Unicode programs改为English也可以解决。但这样一来其他中文程序就会显示乱码了。。。
经验分享 程序员 微信小程序 职场和发展