问题
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: I'm working with Linux.
回答1:
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}
BTW, perhaps it is not a good idea to use non-ASCII characters in R object names, although they also work.
来源:https://stackoverflow.com/questions/11215808/knitr-and-utf8-encoding