针织衫掉落记录

时间:2018-06-29 19:01:59

标签: r knitr

我有一个人离开后继承的R包。在了解了文件和代码之后,我意识到生成的knitr文件正在删除正在构建的html表上的最后几条记录。
问题: 代码以10条记录的块的形式获取数据,然后生成表。我需要弄清楚如何将剩余的块放入其中。
这是产生数据块的代码

<!--begin.rcode echo=FALSE, results='asis', message=FALSE
overLevel <- 0
step <- 10

for(i in seq(1, nrow(exposures), by=step)) {
  tryCatch({
    tmp <- exposures[i:(i+step-1),]
    cols <- ifelse( (as.numeric(gsub(",","",gsub(" ","",tmp$ARExcess)))) >  overLevel, 'tomato', 
                 ifelse(as.numeric(gsub(",","",gsub(" ","",tmp$MTMExcess))) > overLevel, 'lightyellow', 
                 ifelse(as.numeric(gsub(",","",gsub(" ","",tmp$VolumeExcess))) > overLevel, 'azure3', 'white')))

    cat(paste0('<h4><u>Exposures</u></h4>'))
    cat(htmlTable(as.matrix(tmp), col.rgroup = cols, rnames = FALSE))
  },error = function(e) {print(e)})
}

end.rcode-->

0 个答案:

没有答案