回复 第20楼 的 bigdatafan:
谢谢您。我又试了一下,还是有问题
以下是我的过程,请您帮忙分析下
首先我先从谢老师的主页下载了084-pandoc.Rmd,
创建084-pandoc.Rmd的具体方法是我从https://github.com/yihui/knitr-examples/blob/master/084-pandoc.Rmd
复制了内容,然后创建一个txt文件,保存,然后把文件后缀名改为Rmd。
接下来用以下命令:
knit("084-pandoc.Rmd")
pandoc("084-pandoc.md")
上面的可以生成网页形式,只是有些类似中文的好像乱码,html内容如下:
A bit introduction here.
Start with a cool section
You can use traditional Markdown syntax, such as links and code.
Followed by another section
Of course you can write lists:
apple
pear
banana
Or ordered lists:
items
will
be
ordered
nested
items
More sections
Hi
hi hi
Hello
hello hello
Howdy
howdy howdy
Okay, some R code
fit = lm(dist ~ speed, data = cars)
b = coef(fit) # coefficients
summary(fit)
##
## Call:
## lm(formula = dist ~ speed, data = cars)
##
## Residuals:
## Min 1Q Median 3Q Max
## -29.07 -9.53 -2.27 9.21 43.20
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) -17.579 6.758 -2.60 0.012 *
## speed 3.932 0.416 9.46 1.5e-12 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 15.4 on 48 degrees of freedom
## Multiple R-squared: 0.651, Adjusted R-squared: 0.644
## F-statistic: 89.6 on 1 and 48 DF, p-value: 1.49e-12
The code will be highlighted in all output formats.
And some pictures
par(mfrow = c(2, 2), pch = 20, mar = c(4, 4, 2, 0.1), bg = "white")
plot(fit)
Regression diagnostics
A little bit math
Our regression equation is Y鈥�=鈥勨€呪垝鈥�17.鈥�5791鈥�+鈥�3.鈥�9324x, and the model is:
Y鈥�=鈥�尾0鈥�+鈥�尾1x鈥�+鈥�蔚
Pandoc extension: definition lists
Programmer
A programmer is the one who turns coffee into code.
LaTeX
A simple tool which is nothing but a couple of backslashes.
Pandoc extension: examples
We have some examples.
Think what is 0.3 + 0.4 - 0.7. Zero. Easy.
Now think what is 0.3 - 0.7 + 0.4. Still zero?
People are often surprised by (2).
Pandoc extension: tables
A table here.
Demonstration of simple table syntax.
Right Left Center Default
12 12 12 12
123 123 123 123
1 1 1 1
Pandoc extension: footnotes
We can also write footnotes1.
Or write some inline footnotes2.
Pandoc extension: citations
We compile the R Markdown file to Markdown through knitr [@xie2013] in R [@R-base]. For more about @xie2013, see http://yihui.name/knitr.
References
hi, I'm a footnote鈫�
as you can see here鈫�
但是用下面命令生成的pdf:
pandoc("084-pandoc.md", format='latex')
提示如下错误:
> pandoc("084-pandoc.md", format='latex')
executing pandoc -f markdown -t latex -o 084-pandoc.pdf "084-pandoc.md"
pandoc.exe: Error producing PDF from TeX source.
This is pdfTeX, Version 3.1415926-2.3-1.40.12 (MiKTeX 2.9)
(Fatal format file error; I'm stymied)
Error in pandoc("084-pandoc.md", format = "latex") : conversion failed
In addition: Warning message:
running command 'pandoc -f markdown -t latex -o 084-pandoc.pdf "084-pandoc.md"' had status 43
您看可能哪里出现问题?