在R中生成PDF报告

时间:2020-03-31 20:47:03

标签: r report

如何运行下面的代码并提供PDF格式的报告?我想在每个图之前显示一个内容丰富的文本,而不显示所编写的代码。

内容丰富的文字

第一个图-考虑K = 6的树状图

第二个图-考虑K = 6的散点图。

#database

df<-structure(list(Latitude = c(-23.8, -23.8, -23.9, -23.9, -23.9,  -23.9, -23.9, -23.9, -23.9, -23.9, -23.9, -23.9, -23.9, -23.9, 
+ -23.9, -23.9, -23.9, -23.9, -23.9), Longitude = c(-49.6, -49.6, -49.6, -49.6, -49.6, -49.6, -49.6, -49.6, -49.6, -49.6, -49.7, 
+ -49.7, -49.7, -49.7, -49.7, -49.6, -49.6, -49.6, -49.6), Production = c(526, 350, 526, 469, 285, 175, 175, 350, 350, 175, 350, 175, 175, 364, 
+ 175, 175, 350, 45.5, 54.6)), class = "data.frame", row.names = c(NA, -19L))
d<-dist(df)
fit.average<-hclust(d,method="average")
clusters<-cutree(fit.average, k=6) 
plot(fit.average) #first plot
rect.hclust(fit.average,k=6) 

#scatterplot
library(factoextra)
fviz_cluster(list(data = df, cluster = clusters)) #second plot

谢谢!

ERRO 错误:LaTeX无法编译teste.tex。有关调试提示,请参见https://yihui.org/tinytex/r/#debugging。 Alémdisso:警告消息: 1:在system2(...,stdout = if(use_file_stdout())f1 else FALSE,stderr = f2)中: 'CreateProcess'无法运行'C:\ Users \ Jose Souza \ AppData \ Local \ Programs \ MiKTeX 2.9 \ miktex \ bin \ x64 \ xelatex.exe-错误停止-interaction = batchmode“ teste.tex”' 2:在system2(“ tlmgr”,args,...)中: 'CreateProcess'无法运行'C:\ Users \ Jose Souza \ AppData \ Roaming \ TinyTeX \ bin \ win32 \ tlmgr.bat update --all --self 蠕虫病毒

0 个答案:

没有答案