当从源(umlauts /特殊字符)加载脚本时,无效的多字节字符崩溃

时间:2022-07-27 15:26:47

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.

Thx从邮件列表中得知我的问题与Sweave或Latex没有关系。它´s一些Mac OS X相关的问题。每当我运行我的脚本时,选择所有并发送到R它工作。

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

最后,我和ggplot2在我的Mac OS x上一起工作,我在R里面调用了sweave。

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).

我想这可能与“(期间……)”或“a”有关。不幸的是,我不能更改这些标签,因为它们也在传说中使用。所以,在我的代码中,这些丑陋的umlauts将会出现。有没有办法让他们逃过一劫?我不敢相信这是一个问题,因为瑞典人是由一个德国人写的,他可能有第二大部分的字母(在土耳其后面)。

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

我得到的错误消息是:第195行中的解析器中的多字节字符无效。

Thx for any ideas in advance!

任何预先的想法都可以!

1 个解决方案

#1


4  

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 !

耶!我得到了它。很抱歉大家都这么吵。我把三个文件都换了。Rnw mysource。R)到UTF-8,它终于成功了。所以每个在Mac电脑上工作的人一定要把你的默认编码改成UTF-8 !

#1


4  

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 !

耶!我得到了它。很抱歉大家都这么吵。我把三个文件都换了。Rnw mysource。R)到UTF-8,它终于成功了。所以每个在Mac电脑上工作的人一定要把你的默认编码改成UTF-8 !