{"id":609,"date":"2017-07-05T14:16:02","date_gmt":"2017-07-05T06:16:02","guid":{"rendered":"https:\/\/www.beneplot.com\/?p=609"},"modified":"2020-07-23T15:17:35","modified_gmt":"2020-07-23T07:17:35","slug":"%e8%87%aa%e5%8a%a8%e5%8c%96%e6%8a%a5%e5%91%8a%e7%ae%97%e6%b3%95-r%e4%b8%8elatex","status":"publish","type":"post","link":"https:\/\/www.beneplot.com\/?p=609","title":{"rendered":"\u81ea\u52a8\u5316\u62a5\u544a\u7b97\u6cd5 (R\u4e0eLatex)"},"content":{"rendered":"<h3>\u4e3a\u63d0\u5347\u7814\u7a76\u7684\u4e25\u8c28\u6027\u548c\u53ef\u8ffd\u6eaf\u6027\uff0c\u6570\u636e\u5206\u6790\u62a5\u544a\u7684\u81ea\u52a8\u5316\u88ab\u8d8a\u6765\u8d8a\u591a\u7684\u7814\u7a76\u8005\u5173\u6ce8\u3002<\/h3>\n<h3>\u5728\u5b9e\u9645\u5e94\u7528\u4e2d\uff0c\u81ea\u52a8\u5316\u62a5\u544a\u7684\u597d\u5904\u5728\u4e8e\u8282\u7701\u5927\u91cf\u7c98\u8d34\u590d\u5236\u3001\u6392\u7248\u7684\u65f6\u95f4\uff0c\u8fd8\u80fd\u907f\u514d\u4eba\u5de5\u6574\u7406\u7684\u8bef\u5dee\uff0c\u5e94\u7528\u4e5f\u662f\u8d8a\u6765\u8d8a\u5e7f\u6cdb\u3002<\/h3>\n<h3>\u6709\u65f6\uff0c\u6570\u636e\u5206\u6790\u62a5\u544a\u5f3a\u8c03\u5373\u65f6\u6027\uff0c\u901a\u8fc7\u81ea\u52a8\u5316\u62a5\u544a\u7b97\u6cd5\u53ef\u4ee5\u8fbe\u6210\u8fd9\u4e00\u76ee\u7684\u3002<\/h3>\n<h3>\u672c\u6587\u5c06\u4ee5\u4e00\u9879\u7b80\u5355\u7684\u73b0\u573a\u8bc4\u5206\u5206\u6790\u4efb\u52a1\u4e3a\u4f8b\uff0c\u8bb2\u8ff0\u5982\u4f55\u8fd0\u7528R\u4e0eLatex\u7684\u7ed3\u5408\uff0c\u5feb\u901f\u81ea\u52a8\u5316\u6784\u5efaPDF\u62a5\u544a\u3002<\/h3>\n<h3>\u4efb\u52a1\uff1a\u8981\u6c42\u8bc4\u5206\u5458\u5bf945\u4efd(\u5df2\u63d0\u524d\u5206\u597d\u7c7b\uff0c\u597d\u4e2d\u5dee\u5404\u670915\u4efd)\u75316\u4e2aItem\u6784\u6210\u7684\u8bd5\u5377\u4f5c\u7b54\u8fdb\u884c\u8bc4\u5206\uff0c\u8bc4\u5206\u5b8c\u6210\u540e\u7acb\u5373\u8fdb\u884c\u76f4\u65b9\u56fe\u6bd4\u8f83\u5206\u6790\u62a5\u544a\u3002<\/h3>\n<div>\u00a0<\/div>\n<div>\u00a0<\/div>\n<div><code><span style=\"font-size: 16px; font-family: 'times new roman', times, serif;\">####\u6ce8\u610f\uff0c\u4e0b\u65b9\u8bed\u53e5\u4e2d\u7684## @knitr load_lib\u3001## @knitr getdata\u3001## @knitr plot\u5728R\u4e2d\u867d\u7136\u8868\u793a\u6ce8\u91ca\uff0c\u4f46\u4e0d\u53ef\u7701\u7565\uff0c\u56e0\u4e3a\u5176\u662fR\u4e0eLatex\u8054\u7cfb\u7684\u5173\u952e\u8bed\u53e5####<\/span><\/code><\/div>\n<div>\u00a0<\/div>\n<div><code><span style=\"font-size: 16px; font-family: 'times new roman', times, serif;\">#------------------------------------------------------------------<\/span><\/code><\/div>\n<div><code><span style=\"font-size: 16px; font-family: 'times new roman', times, serif;\">## @knitr load_lib<\/span><\/code><\/div>\n<div><code><span style=\"font-size: 16px; font-family: 'times new roman', times, serif;\">library(plyr) ##\u8f7d\u5165\u7528\u4e8e\u5904\u7406\u6570\u636e\u7684R\u5305###<\/span><\/code><\/div>\n<div><code><span style=\"font-size: 16px; font-family: 'times new roman', times, serif;\">library('ggplot2') ##\u8f7d\u5165\u7528\u4e8e\u753b\u56fe\u7684R\u5305###<\/span><\/code><\/div>\n<div>\u00a0<\/div>\n<div><code><span style=\"font-size: 16px; font-family: 'times new roman', times, serif;\">#-----------------------------------------------------------------------------<\/span><\/code><\/div>\n<div><code><span style=\"font-size: 16px; font-family: 'times new roman', times, serif;\">## @knitr getdata<\/span><\/code><\/div>\n<div>\u00a0<\/div>\n<div><code><span style=\"font-size: 16px; font-family: 'times new roman', times, serif;\">setwd(\"C:\/...\")\u00a0 ###\u8bbe\u7f6e\u5206\u6790\u76ee\u5f55###<\/span><\/code><\/div>\n<div><code><span style=\"font-size: 16px; font-family: 'times new roman', times, serif;\">data = read.csv(\"C:\/... .csv\", header=TRUE) ###\u8f7d\u5165\u6570\u636e###<\/span><\/code><\/div>\n<div>\u00a0<\/div>\n<div><code><span style=\"font-size: 16px; font-family: 'times new roman', times, serif;\">##\u8f7d\u5165\u7684\u6570\u636e\u51717\u5217,\u6bcf\u5217\u670945\u4e2a\u6570\u503c###<\/span><\/code><\/div>\n<div><code><span style=\"font-size: 16px; font-family: 'times new roman', times, serif;\">##\u7b2c1\u5217\u4e3a\u6570\u636e\u6807\u7b7e\uff0c\u5171\u67093\u7c7b\u6807\u7b7e\uff0c\u5206\u522b\u662f\"Low level\",\"Mid level\", \"High level\"\uff0c\u6bcf\u4e2a\u6807\u7b7e15\u884c###<\/span><\/code><\/div>\n<div><code><span style=\"font-size: 16px; font-family: 'times new roman', times, serif;\">##\u7b2c2-7\u5217\u4e3a6\u4e2aitem\u7684\u8bc4\u5206\u6570\u636e\uff0c\u6bcf\u5217\u5747\u670945\u4e2a\u6570\u503c###<\/span><\/code><\/div>\n<div>\u00a0<\/div>\n<div><code><span style=\"font-size: 16px; font-family: 'times new roman', times, serif;\">#-----------------------------------------------------------------------<\/span><\/code><\/div>\n<div><code><span style=\"font-size: 16px; font-family: 'times new roman', times, serif;\">## @knitr plot<\/span><\/code><\/div>\n<div>\u00a0<\/div>\n<div><code><span style=\"font-size: 16px; font-family: 'times new roman', times, serif;\">######\u4ee5\u4e0b\u4e3a\u753b\u56fe\u8bed\u53e5########<\/span><\/code><\/div>\n<div>\u00a0<\/div>\n<div><code><span style=\"font-size: 16px; font-family: 'times new roman', times, serif;\">for (i in 2:ncol(data)){<\/span><\/code><\/div>\n<div><code><span style=\"font-size: 16px; font-family: 'times new roman', times, serif;\">\u00a0\u00a0<\/span><\/code><\/div>\n<div><code><span style=\"font-size: 16px; font-family: 'times new roman', times, serif;\">mean = tapply(data[,i],data$level,mean)<\/span><\/code><\/div>\n<div><code><span style=\"font-size: 16px; font-family: 'times new roman', times, serif;\">sd = tapply(data[,i],data$level,sd)<\/span><\/code><\/div>\n<div>\u00a0<\/div>\n<div><code><span style=\"font-size: 16px; font-family: 'times new roman', times, serif;\">mm = as.data.frame(round(mean,1))<\/span><\/code><\/div>\n<div><code><span style=\"font-size: 16px; font-family: 'times new roman', times, serif;\">ss = as.data.frame(round(sd,1))<\/span><\/code><\/div>\n<div>\u00a0<\/div>\n<div><code><span style=\"font-size: 16px; font-family: 'times new roman', times, serif;\">DD = ddply(data[,c(1,i)],.(level),summarize,Volume=length(level))<\/span><\/code><\/div>\n<div><code><span style=\"font-size: 16px; font-family: 'times new roman', times, serif;\">xx = cbind(DD,mm[,1],ss[,1])<\/span><\/code><\/div>\n<div>\u00a0<\/div>\n<div><code><span style=\"font-size: 16px; font-family: 'times new roman', times, serif;\">data$level = factor(data$level , levels=c(\"Low level\",\"Mid level\", \"High level\"), ordered=TRUE)<\/span><\/code><\/div>\n<div><code><span style=\"font-size: 16px; font-family: 'times new roman', times, serif;\">xx$level = factor(xx$level , levels=c(\"Low level\",\"Mid level\", \"High level\"), ordered=TRUE)<\/span><\/code><\/div>\n<div>\u00a0<\/div>\n<div><code><span style=\"font-size: 16px; font-family: 'times new roman', times, serif;\">p = ggplot(data, aes(x = data[,i], fill = level)) +<\/span><\/code><\/div>\n<div><code><span style=\"font-size: 16px; font-family: 'times new roman', times, serif;\">\u00a0 geom_histogram(binwidth = 10, colour=\"black\") +<\/span><\/code><\/div>\n<div><code><span style=\"font-size: 16px; font-family: 'times new roman', times, serif;\">\u00a0 facet_grid(level~.,scales = \"free\") +<\/span><\/code><\/div>\n<div><code><span style=\"font-size: 16px; font-family: 'times new roman', times, serif;\">\u00a0 labs(y='Count', x=colnames(data)[i])+<\/span><\/code><\/div>\n<div><code><span style=\"font-size: 16px; font-family: 'times new roman', times, serif;\">\u00a0 scale_x_continuous(breaks=seq(0,100,10))\u00a0 +<\/span><\/code><\/div>\n<div><code><span style=\"font-size: 16px; font-family: 'times new roman', times, serif;\">\u00a0 scale_y_continuous(breaks=seq(0,20,2)) +<\/span><\/code><\/div>\n<div><code><span style=\"font-size: 16px; font-family: 'times new roman', times, serif;\">\u00a0 theme_bw() + theme(panel.grid.minor = element_blank(),<\/span><\/code><\/div>\n<div><code><span style=\"font-size: 16px; font-family: 'times new roman', times, serif;\">\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0legend.box.background = element_rect(),<\/span><\/code><\/div>\n<div><code><span style=\"font-size: 16px; font-family: 'times new roman', times, serif;\">\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0legend.box.margin = margin(6, 6, 6, 6),<\/span><\/code><\/div>\n<div><code><span style=\"font-size: 16px; font-family: 'times new roman', times, serif;\">\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0strip.background = element_rect(colour = \"black\", fill = \"white\"),<\/span><\/code><\/div>\n<div><code><span style=\"font-size: 16px; font-family: 'times new roman', times, serif;\">\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0strip.text.y = element_text(face = \"bold\",size = 12),<\/span><\/code><\/div>\n<div><code><span style=\"font-size: 16px; font-family: 'times new roman', times, serif;\">\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0axis.text.x = element_text(size = 14,color=\"black\"),<\/span><\/code><\/div>\n<div><code><span style=\"font-size: 16px; font-family: 'times new roman', times, serif;\">\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0axis.text.y = element_text(size = 15,color=\"black\"),<\/span><\/code><\/div>\n<div><code><span style=\"font-size: 16px; font-family: 'times new roman', times, serif;\">\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0axis.title.x = element_text(size=14)) +<\/span><\/code><\/div>\n<div><code><span style=\"font-size: 16px; font-family: 'times new roman', times, serif;\">\u00a0 guides(fill=F)+<\/span><\/code><\/div>\n<div><code><span style=\"font-size: 16px; font-family: 'times new roman', times, serif;\">\u00a0 geom_text(data=xx,aes(x=60,y=5,label = paste(\"Mean=\",mm[,1],\",\",\"SD=\",ss[,1])),<\/span><\/code><\/div>\n<div><code><span style=\"font-size: 16px; font-family: 'times new roman', times, serif;\">\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 check_overlap = TRUE,vjust = 2,size =8)+<\/span><\/code><\/div>\n<div><code><span style=\"font-size: 16px; font-family: 'times new roman', times, serif;\">\u00a0 scale_fill_manual(values=c(\"coral\", \"light blue\", \"light green\"))<\/span><\/code><\/div>\n<div>\u00a0<\/div>\n<div><code><span style=\"font-size: 16px; font-family: 'times new roman', times, serif;\">print(p)<\/span><\/code><\/div>\n<div>\u00a0<\/div>\n<div><code><span style=\"font-size: 16px; font-family: 'times new roman', times, serif;\">}<\/span><\/code><\/div>\n<div>\u00a0<\/div>\n<div><code><span style=\"font-size: 16px; font-family: 'times new roman', times, serif;\">#-----------------------------------------------------------------------<\/span><\/code><\/div>\n<div>\u00a0<\/div>\n<div><code><span style=\"font-size: 16px; font-family: 'times new roman', times, serif;\">########\u6700\u7ec8\u4f9d\u636e\u6bcf\u5217\u6570\u636e\u5171\u753b\u51fa6\u4e2a\u56fe\uff0c\u5176\u4e2d1\u4e2a\u56fe\u5982\u4e0b########<\/span><\/code><\/div>\n<div><code><span style=\"font-size: 16px; font-family: 'times new roman', times, serif;\">##\u56fe\u4e2d\u5c55\u793a\u4e86\u5404\u4e2a\u6c34\u5e73\u7684\u5f97\u5206\u5206\u5e03\u3001\u5e73\u5747\u503c\u548c\u6807\u51c6\u5dee######<\/span><\/code><\/div>\n<div>\u00a0<\/div>\n<div><code><span style=\"font-size: 16px; font-family: 'times new roman', times, serif;\"><img loading=\"lazy\" class=\"alignnone wp-image-610\" src=\"https:\/\/www.beneplot.com\/?attachment_id=610\" alt=\"\" width=\"329\" height=\"227\" \/><\/span><\/code><\/div>\n<div>\u00a0<\/div>\n<div>\u00a0<\/div>\n<div><code><span style=\"font-size: 16px; font-family: 'times new roman', times, serif;\">#################################################################################<\/span><\/code><\/div>\n<div>\u00a0<\/div>\n<div>\u00a0<\/div>\n<div><code><span style=\"font-size: 16px; font-family: 'times new roman', times, serif;\">#################\u4ee5\u4e0b\u4e3aLatex\u8bed\u53e5\uff0c\u7528\u4e8e\u5c06R\u753b\u51fa\u76846\u4e2a\u76f4\u65b9\u56fe\u5728\u6392\u597d\u7248\u540e\u81ea\u52a8\u5316\u751f\u62101\u4e2aPDF\u62a5\u544a\uff0c\u6587\u4ef6\u540e\u7f00\u540d\u4e3a.rnw###########################################<\/span><\/code><\/div>\n<div><code><span style=\"font-size: 16px; font-family: 'times new roman', times, serif;\">#####################################################################<\/span><\/code><\/div>\n<div>\u00a0<\/div>\n<div>\n<div>\u00a0<\/div>\n<div>\u00a0<\/div>\n<div><code><span style=\"font-size: 16px; font-family: 'times new roman', times, serif;\">%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%<\/span><\/code><\/div>\n<div><code><span style=\"font-size: 16px; font-family: 'times new roman', times, serif;\">\u00a0 % LATEX PACKAGES \u2013 MAY NEED .STY FILES IN THE PROJECT FOLDER<\/span><\/code><\/div>\n<div><code><span style=\"font-size: 16px; font-family: 'times new roman', times, serif;\">\u00a0 % \u4ee5\u4e0b\u4e3a\u8f7d\u5165\u7684latex\u5305<\/span><\/code><\/div>\n<div><code><span style=\"font-size: 16px; font-family: 'times new roman', times, serif;\">%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%<\/span><\/code><\/div>\n<div>\u00a0<\/div>\n<div><code><span style=\"font-size: 16px; font-family: 'times new roman', times, serif;\">\\documentclass[a4paper]{article}\u00a0<\/span><\/code><\/div>\n<div><code><span style=\"font-size: 16px; font-family: 'times new roman', times, serif;\">\\usepackage[british]{babel}<\/span><\/code><\/div>\n<div><code><span style=\"font-size: 16px; font-family: 'times new roman', times, serif;\">\\usepackage{float}<\/span><\/code><\/div>\n<div><code><span style=\"font-size: 16px; font-family: 'times new roman', times, serif;\">\\usepackage{longtable}<\/span><\/code><\/div>\n<div><code><span style=\"font-size: 16px; font-family: 'times new roman', times, serif;\">%%\\usepackage{numberedbib}<\/span><\/code><\/div>\n<div><code><span style=\"font-size: 16px; font-family: 'times new roman', times, serif;\">\\usepackage{rotating}<\/span><\/code><\/div>\n<div><code><span style=\"font-size: 16px; font-family: 'times new roman', times, serif;\">\\usepackage{fullpage}<\/span><\/code><\/div>\n<div><code><span style=\"font-size: 16px; font-family: 'times new roman', times, serif;\">\\usepackage{lscape}<\/span><\/code><\/div>\n<div><code><span style=\"font-size: 16px; font-family: 'times new roman', times, serif;\">\\usepackage{subcaption}\u00a0 % an alternative package for sub figures<\/span><\/code><\/div>\n<div><code><span style=\"font-size: 16px; font-family: 'times new roman', times, serif;\">\\usepackage{pdflscape}<\/span><\/code><\/div>\n<div><code><span style=\"font-size: 16px; font-family: 'times new roman', times, serif;\">\\usepackage{booktabs}<\/span><\/code><\/div>\n<div><code><span style=\"font-size: 16px; font-family: 'times new roman', times, serif;\">\\usepackage{colortbl, xcolor}<\/span><\/code><\/div>\n<div><code><span style=\"font-size: 16px; font-family: 'times new roman', times, serif;\">\\usepackage{appendix}<\/span><\/code><\/div>\n<div><code><span style=\"font-size: 16px; font-family: 'times new roman', times, serif;\">\\usepackage[sc]{mathpazo}<\/span><\/code><\/div>\n<div><code><span style=\"font-size: 16px; font-family: 'times new roman', times, serif;\">\\usepackage[T1]{fontenc}<\/span><\/code><\/div>\n<div><code><span style=\"font-size: 16px; font-family: 'times new roman', times, serif;\">\\usepackage{geometry}<\/span><\/code><\/div>\n<div><code><span style=\"font-size: 16px; font-family: 'times new roman', times, serif;\">\\geometry{verbose,tmargin=2.5cm,bmargin=2.5cm,lmargin=2.5cm,rmargin=2.5cm}<\/span><\/code><\/div>\n<div><code><span style=\"font-size: 16px; font-family: 'times new roman', times, serif;\">\\setcounter{secnumdepth}{2}<\/span><\/code><\/div>\n<div><code><span style=\"font-size: 16px; font-family: 'times new roman', times, serif;\">\\setcounter{tocdepth}{2}<\/span><\/code><\/div>\n<div><code><span style=\"font-size: 16px; font-family: 'times new roman', times, serif;\">\\usepackage{url}<\/span><\/code><\/div>\n<div><code><span style=\"font-size: 16px; font-family: 'times new roman', times, serif;\">\\usepackage[unicode=true,pdfusetitle,<\/span><\/code><\/div>\n<div><code><span style=\"font-size: 16px; font-family: 'times new roman', times, serif;\">\u00a0bookmarks=true,bookmarksnumbered=true,bookmarksopen=true,bookmarksopenlevel=2,<\/span><\/code><\/div>\n<div><code><span style=\"font-size: 16px; font-family: 'times new roman', times, serif;\">\u00a0breaklinks=false,pdfborder={0 0 1},backref=false,colorlinks=false]<\/span><\/code><\/div>\n<div><code><span style=\"font-size: 16px; font-family: 'times new roman', times, serif;\">\u00a0{hyperref}<\/span><\/code><\/div>\n<div><code><span style=\"font-size: 16px; font-family: 'times new roman', times, serif;\">\\hypersetup{<\/span><\/code><\/div>\n<div><code><span style=\"font-size: 16px; font-family: 'times new roman', times, serif;\">\u00a0pdfstartview={XYZ null null 1}}<\/span><\/code><\/div>\n<div><code><span style=\"font-size: 16px; font-family: 'times new roman', times, serif;\">\\usepackage{breakurl}<\/span><\/code><\/div>\n<div><code><span style=\"font-size: 16px; font-family: 'times new roman', times, serif;\">\\usepackage{supertabular}<\/span><\/code><\/div>\n<div>\u00a0<\/div>\n<div>\u00a0<\/div>\n<div><code><span style=\"font-size: 16px; font-family: 'times new roman', times, serif;\">%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%<\/span><\/code><\/div>\n<div><code><span style=\"font-size: 16px; font-family: 'times new roman', times, serif;\">\u00a0 % DOCUMENT HEADER &amp; FOOTER<\/span><\/code><\/div>\n<div><code><span style=\"font-size: 16px; font-family: 'times new roman', times, serif;\">\u00a0 \u00a0% \u9700\u5c06R\u5206\u6790\u8bed\u53e5\u5b58\u653e\u7684\u76ee\u5f55\u8f93\u5165read_chunk('C:\/\u2026\/\u2026 .R')<\/span><\/code><\/div>\n<div><code><span style=\"font-size: 16px; font-family: 'times new roman', times, serif;\">%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%<\/span><\/code><\/div>\n<div><code><span style=\"font-size: 16px; font-family: 'times new roman', times, serif;\">\u00a0\u00a0<\/span><\/code><\/div>\n<div><code><span style=\"font-size: 16px; font-family: 'times new roman', times, serif;\">\\usepackage{fancyhdr}<\/span><\/code><\/div>\n<div><code><span style=\"font-size: 16px; font-family: 'times new roman', times, serif;\">\\pagestyle{fancy}<\/span><\/code><\/div>\n<div><code><span style=\"font-size: 16px; font-family: 'times new roman', times, serif;\">\\fancyhf{}<\/span><\/code><\/div>\n<div><code><span style=\"font-size: 16px; font-family: 'times new roman', times, serif;\">%\\fancyhead[C]{DRAFT: Not for circulation}<\/span><\/code><\/div>\n<div><code><span style=\"font-size: 16px; font-family: 'times new roman', times, serif;\">\\fancyfoot[C]{Page \\thepage}<\/span><\/code><\/div>\n<div>\u00a0<\/div>\n<div><code><span style=\"font-size: 16px; font-family: 'times new roman', times, serif;\">%--------------- early read external R code ----------------------<\/span><\/code><\/div>\n<div><code><span style=\"font-size: 16px; font-family: 'times new roman', times, serif;\">\u00a0 &lt;&lt;external_code, echo=FALSE,warning=FALSE, cache=FALSE&gt;&gt;=<\/span><\/code><\/div>\n<div><code><span style=\"font-size: 16px; font-family: 'times new roman', times, serif;\">\u00a0 \u00a0 read_chunk('C:\/...\/... .R')<\/span><\/code><\/div>\n<div><code><span style=\"font-size: 16px; font-family: 'times new roman', times, serif;\">\u00a0 @<\/span><\/code><\/div>\n<div><code><span style=\"font-size: 16px; font-family: 'times new roman', times, serif;\">\u00a0 \u00a0\u00a0<\/span><\/code><\/div>\n<div><code><span style=\"font-size: 16px; font-family: 'times new roman', times, serif;\">\u00a0 \u00a0 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%<\/span><\/code><\/div>\n<div><code><span style=\"font-size: 16px; font-family: 'times new roman', times, serif;\">\u00a0 \u00a0 % TITLE PAGE<\/span><\/code><\/div>\n<div><code><span style=\"font-size: 16px; font-family: 'times new roman', times, serif;\">\u00a0 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%<\/span><\/code><\/div>\n<div><code><span style=\"font-size: 16px; font-family: 'times new roman', times, serif;\">\u00a0 \u00a0\u00a0<\/span><\/code><\/div>\n<div><code><span style=\"font-size: 16px; font-family: 'times new roman', times, serif;\">\u00a0 \u00a0 \\begin{document}<\/span><\/code><\/div>\n<div><code><span style=\"font-size: 16px; font-family: 'times new roman', times, serif;\">\u00a0\u00a0<\/span><\/code><\/div>\n<div><code><span style=\"font-size: 16px; font-family: 'times new roman', times, serif;\">\u00a0 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%<\/span><\/code><\/div>\n<div><code><span style=\"font-size: 16px; font-family: 'times new roman', times, serif;\">\u00a0 \u00a0 % LOAD R PACKAGES FOR THIS ANALYSIS<\/span><\/code><\/div>\n<div><code><span style=\"font-size: 16px; font-family: 'times new roman', times, serif;\">\u00a0 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%<\/span><\/code><\/div>\n<div><code><span style=\"font-size: 16px; font-family: 'times new roman', times, serif;\">\u00a0 \u00a0\u00a0<\/span><\/code><\/div>\n<div><code><span style=\"font-size: 16px; font-family: 'times new roman', times, serif;\">\u00a0 \u00a0 &lt;&lt;load_lib, echo=FALSE, results='hide', warning=FALSE, message=FALSE&gt;&gt;=<\/span><\/code><\/div>\n<div><code><span style=\"font-size: 16px; font-family: 'times new roman', times, serif;\">\u00a0 \u00a0 \u00a0 @<\/span><\/code><\/div>\n<div><code><span style=\"font-size: 16px; font-family: 'times new roman', times, serif;\">\u00a0 \u00a0 \u00a0\u00a0<\/span><\/code><\/div>\n<div><code><span style=\"font-size: 16px; font-family: 'times new roman', times, serif;\">\u00a0 \u00a0 \u00a0 &lt;&lt;getdata, eval=TRUE, echo=FALSE, message=FALSE,warning=FALSE, results='asis', cache=FALSE&gt;&gt;=<\/span><\/code><\/div>\n<div><code><span style=\"font-size: 16px; font-family: 'times new roman', times, serif;\">\u00a0 \u00a0 \u00a0 \u00a0 @<\/span><\/code><\/div>\n<div><code><span style=\"font-size: 16px; font-family: 'times new roman', times, serif;\">\u00a0 \u00a0 \u00a0 \u00a0\u00a0<\/span><\/code><\/div>\n<div>\u00a0<\/div>\n<div><code><span style=\"font-size: 16px; font-family: 'times new roman', times, serif;\">\u00a0 \u00a0 \u00a0 \u00a0 \u00a0\u00a0<\/span><\/code><\/div>\n<div><code><span style=\"font-size: 16px; font-family: 'times new roman', times, serif;\">\u00a0 \u00a0 \u00a0 \u00a0 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%<\/span><\/code><\/div>\n<div><code><span style=\"font-size: 16px; font-family: 'times new roman', times, serif;\">\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 % DATA ANALYSIS AND MODELLING<\/span><\/code><\/div>\n<div><code><span style=\"font-size: 16px; font-family: 'times new roman', times, serif;\">\u00a0 \u00a0 \u00a0 \u00a0 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%<\/span><\/code><\/div>\n<div><code><span style=\"font-size: 16px; font-family: 'times new roman', times, serif;\">\u00a0 \u00a0 \u00a0 \u00a0 \u00a0\u00a0<\/span><\/code><\/div>\n<div><code><span style=\"font-size: 16px; font-family: 'times new roman', times, serif;\">\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 &lt;&lt;analysis, eval=TRUE, echo=FALSE, message=FALSE, cache=FALSE, warning=FALSE, results='hide'&gt;&gt;=<\/span><\/code><\/div>\n<div><code><span style=\"font-size: 16px; font-family: 'times new roman', times, serif;\">\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 @<\/span><\/code><\/div>\n<div><code><span style=\"font-size: 16px; font-family: 'times new roman', times, serif;\">\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0\u00a0<\/span><\/code><\/div>\n<div><code><span style=\"font-size: 16px; font-family: 'times new roman', times, serif;\">\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 &lt;&lt;presentation, eval=TRUE,warning=FALSE,echo=FALSE&gt;&gt;=<\/span><\/code><\/div>\n<div><code><span style=\"font-size: 16px; font-family: 'times new roman', times, serif;\">\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 @<\/span><\/code><\/div>\n<div><code><span style=\"font-size: 16px; font-family: 'times new roman', times, serif;\">\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0\u00a0<\/span><\/code><\/div>\n<div><code><span style=\"font-size: 16px; font-family: 'times new roman', times, serif;\">\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%<\/span><\/code><\/div>\n<div><code><span style=\"font-size: 16px; font-family: 'times new roman', times, serif;\">\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 % MAIN REPORT WITH EMBEDDED GRAPHS AND TABLES<\/span><\/code><\/div>\n<div><code><span style=\"font-size: 16px; font-family: 'times new roman', times, serif;\">\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0% \\title{\u2026}\u7528\u4e8e\u8bbe\u5b9aPDF\u9996\u9875\u7f6e\u9876\u5c45\u4e2d\u6587\u7ae0\u540d<\/span><\/code><\/div>\n<div><code><span style=\"font-size: 16px; font-family: 'times new roman', times, serif;\">\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0% \\author{\u2026}\u7528\u4e8e\u8bbe\u5b9a\u4f5c\u8005\u540d<\/span><\/code><\/div>\n<div><code><span style=\"font-size: 16px; font-family: 'times new roman', times, serif;\">\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%<\/span><\/code><\/div>\n<div><code><span style=\"font-size: 16px; font-family: 'times new roman', times, serif;\">\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \\title{Plot}<\/span><\/code><\/div>\n<div><code><span style=\"font-size: 16px; font-family: 'times new roman', times, serif;\">\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \\author{beneplot}<\/span><\/code><\/div>\n<div><code><span style=\"font-size: 16px; font-family: 'times new roman', times, serif;\">\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \\maketitle\\thispagestyle{empty}<\/span><\/code><\/div>\n<div><code><span style=\"font-size: 16px; font-family: 'times new roman', times, serif;\">\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0\u00a0<\/span><\/code><\/div>\n<div><code><span style=\"font-size: 16px; font-family: 'times new roman', times, serif;\">\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0<\/span><\/code><\/div>\n<div><code><span style=\"font-size: 16px; font-family: 'times new roman', times, serif;\">\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0\u00a0<\/span><\/code><\/div>\n<div><code><span style=\"font-size: 16px; font-family: 'times new roman', times, serif;\">\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 &lt;&lt;plot,echo=FALSE,message=FALSE,results='asis',warning=FALSE,results='hide', fig.width =8, fig.height = 6&gt;&gt;=<\/span><\/code><\/div>\n<div><code><span style=\"font-size: 16px; font-family: 'times new roman', times, serif;\">\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 @<\/span><\/code><\/div>\n<div><code><span style=\"font-size: 16px; font-family: 'times new roman', times, serif;\">\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0\u00a0<\/span><\/code><\/div>\n<div><code><span style=\"font-size: 16px; font-family: 'times new roman', times, serif;\">\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0\u00a0<\/span><\/code><\/div>\n<div><code><span style=\"font-size: 16px; font-family: 'times new roman', times, serif;\">\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \\end{document}<\/span><\/code><\/div>\n<\/div>\n<div>\u00a0<\/div>\n<div>\u00a0<\/div>\n<div><code><span style=\"font-size: 16px; font-family: 'times new roman', times, serif;\">###################################################################################<\/span><\/code><\/div>\n","protected":false},"excerpt":{"rendered":"<p>\u4e3a\u63d0\u5347\u7814\u7a76\u7684\u4e25\u8c28\u6027\u548c\u53ef\u8ffd\u6eaf\u6027\uff0c\u6570\u636e\u5206\u6790\u62a5\u544a\u7684\u81ea\u52a8\u5316\u88ab\u8d8a\u6765\u8d8a\u591a\u7684\u7814\u7a76\u8005\u5173\u6ce8\u3002 \u5728\u5b9e\u9645\u5e94\u7528\u4e2d\uff0c\u81ea\u52a8\u5316\u62a5\u544a\u7684\u597d\u5904\u5728\u4e8e [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[10],"tags":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v14.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<meta name=\"robots\" content=\"index, follow\" \/>\n<meta name=\"googlebot\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<meta name=\"bingbot\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.beneplot.com\/?p=609\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"\u81ea\u52a8\u5316\u62a5\u544a\u7b97\u6cd5 (R\u4e0eLatex) - Beneplot\" \/>\n<meta property=\"og:description\" content=\"\u4e3a\u63d0\u5347\u7814\u7a76\u7684\u4e25\u8c28\u6027\u548c\u53ef\u8ffd\u6eaf\u6027\uff0c\u6570\u636e\u5206\u6790\u62a5\u544a\u7684\u81ea\u52a8\u5316\u88ab\u8d8a\u6765\u8d8a\u591a\u7684\u7814\u7a76\u8005\u5173\u6ce8\u3002 \u5728\u5b9e\u9645\u5e94\u7528\u4e2d\uff0c\u81ea\u52a8\u5316\u62a5\u544a\u7684\u597d\u5904\u5728\u4e8e [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.beneplot.com\/?p=609\" \/>\n<meta property=\"og:site_name\" content=\"Beneplot\" \/>\n<meta property=\"article:published_time\" content=\"2017-07-05T06:16:02+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2020-07-23T07:17:35+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.beneplot.com\/?attachment_id=610\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.beneplot.com\/#website\",\"url\":\"https:\/\/www.beneplot.com\/\",\"name\":\"Beneplot\",\"description\":\"\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":\"https:\/\/www.beneplot.com\/?s={search_term_string}\",\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"zh-CN\"},{\"@type\":\"ImageObject\",\"@id\":\"https:\/\/www.beneplot.com\/?p=609#primaryimage\",\"inLanguage\":\"zh-CN\",\"url\":\"https:\/\/www.beneplot.com\/?attachment_id=610\"},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.beneplot.com\/?p=609#webpage\",\"url\":\"https:\/\/www.beneplot.com\/?p=609\",\"name\":\"\\u81ea\\u52a8\\u5316\\u62a5\\u544a\\u7b97\\u6cd5 (R\\u4e0eLatex) - Beneplot\",\"isPartOf\":{\"@id\":\"https:\/\/www.beneplot.com\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.beneplot.com\/?p=609#primaryimage\"},\"datePublished\":\"2017-07-05T06:16:02+00:00\",\"dateModified\":\"2020-07-23T07:17:35+00:00\",\"author\":{\"@id\":\"https:\/\/www.beneplot.com\/#\/schema\/person\/ea14f85ae789ceaaa712ceee1dd1f95b\"},\"inLanguage\":\"zh-CN\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.beneplot.com\/?p=609\"]}]},{\"@type\":[\"Person\"],\"@id\":\"https:\/\/www.beneplot.com\/#\/schema\/person\/ea14f85ae789ceaaa712ceee1dd1f95b\",\"name\":\"beneplot\",\"image\":{\"@type\":\"ImageObject\",\"@id\":\"https:\/\/www.beneplot.com\/#personlogo\",\"inLanguage\":\"zh-CN\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/15d96ce801cfddbd59ef2b0d986cd9b1?s=96&r=g\",\"caption\":\"beneplot\"}}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","_links":{"self":[{"href":"https:\/\/www.beneplot.com\/index.php?rest_route=\/wp\/v2\/posts\/609"}],"collection":[{"href":"https:\/\/www.beneplot.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.beneplot.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.beneplot.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.beneplot.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=609"}],"version-history":[{"count":11,"href":"https:\/\/www.beneplot.com\/index.php?rest_route=\/wp\/v2\/posts\/609\/revisions"}],"predecessor-version":[{"id":669,"href":"https:\/\/www.beneplot.com\/index.php?rest_route=\/wp\/v2\/posts\/609\/revisions\/669"}],"wp:attachment":[{"href":"https:\/\/www.beneplot.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=609"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.beneplot.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=609"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.beneplot.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=609"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}