问题描述
编辑:
对邮件列表中的建议Thx意识到我得到的问题与Sweave或Latex无关。这是一些与Mac OS X相关的问题。当我运行我的脚本选择全部并将它发送给R时,它就可以工作。
当我使用
<$ p $ (myplainRcode.R)
我收到错误消息如下所示
最后,我在Mac OS X上与ggplot2一起工作。我用R / p>
Sweave(myfile.Rnw)
它可以创建所需的胶乳输出。现在基本测试工作了,我尝试获取我的真实世界文件,并在以下行崩溃:
gl_bybranch = ddply (new_wans,。(period,Branchen),
function(X)data.frame(Geschäftslage= mean(X $ sentiment)))
我想这与。(period ...)或ä有关。不幸的是,我不能更改这些标签,因为它们也用于传说中。所以,在我的代码中,这些丑陋的变音符号会出现。有没有办法在Sweave中逃脱他们?我不能相信这是问题,因为Sweave是德国人写的,可能是第二大元音字符(在土耳其后面)。
我得到的错误信息是:第195行解析器中的无效多字节字符
Thx对于任何想法提前!
YAY!我知道了。对不起大家的噪音。我将所有三个文件(.Rnw,mysource.R,invokeSweave.R)切换为UTF-8,它终于奏效了。因此,所有在Mac上与Komodo一起工作的人都一定要将默认编码更改为UTF-8!
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!
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 !
这篇关于脚本从源代码加载时,无效的多字节字符崩溃(变音符/特殊字符)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!