编织器和UTF8编码 [英] knitr and UTF8 encoding

查看:52
本文介绍了编织器和UTF8编码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

几天前,我开始用德语R-Script写作.不幸的是,当我knit()文档时,以下代码块不起作用:

A few days ago, I started writing on a german R-Script. Unfortunately, the following code chunk doesn't work when I knit() the document:

@    
<<>>=
äö <- ordered(c(1,3,2,2))
@

有人可以帮我解决这个问题吗?

Can anyone help me solve this problem?

PS:我正在使用Linux.

PS: I'm working with Linux.

推荐答案

由于您使用的是Linux,因此操作应该很容易.这可能只是LaTeX问题.最重要的是,您是否指定了文档的编码?例如\usepackage[utf8]{inputenc}.这在Ubuntu下对我有效.

Since you are using Linux, things should be easy. It is probably just a LaTeX problem; most importantly, did you specify the encoding of your document? e.g. \usepackage[utf8]{inputenc}. This works for me under Ubuntu.

\documentclass[ngerman]{article}
\usepackage[utf8]{inputenc}
\begin{document}

<<>>=
äö <- ordered(c(1,3,2,2))
@

\end{document}

顺便说一句,在R对象名称中使用非ASCII字符也许不是一个好主意,尽管它们也可以使用.

BTW, perhaps it is not a good idea to use non-ASCII characters in R object names, although they also work.

这篇关于编织器和UTF8编码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆