invalid multibyte character crashes when script is loaded from source (umlauts / special characters)

微笑、不失礼 提交于 2019-12-22 12:39:20

问题


EDIT:

Thx to suggestions from the mailing list I realized that the problem I got has nothing to do with Sweave or Latex. It´s some Mac OS X related issue. Whenever I run my script by selecting all and sending it to R it works.

When I use

source("myplainRcode.R") 

i get the error message stated below


finally I got sweave working together with ggplot2 on my Mac OS X. I invoke Sweave inside R with

Sweave("myfile.Rnw")

which creates the desired latex output. Now that the basic tests work, I try to source my real world file and it crashes at the following line:

 gl_bybranch = ddply(new_wans,.(period,Branchen),
 function(X)data.frame(Geschäftslage=mean(X$sentiment)))

I guess it has either to do with the ".(period...)" or the "ä" . Unfortunately I can't change these labels because they are also used in legends. So, somewhere in my code these ugly umlauts will appear. Is there a way to escape them in Sweave? I can't believe that this is problem since Sweave is written by a German who probably have second most umlaut characters (behind Turkey).

The error message I get is: invalid multibyte character in Parser on line 195

Thx for any ideas in advance!


回答1:


YAY ! i got it. Sorry for the noise everybody. I switched all three files (.Rnw, mysource.R , invokeSweave.R) to UTF-8 it finally worked. So everybody who works with Komodo on a Mac make sure to change your default encoding to UTF-8 !



来源:https://stackoverflow.com/questions/3307544/invalid-multibyte-character-crashes-when-script-is-loaded-from-source-umlauts

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!