После часов поиска и установки удаления R, MikTex и т. Д. Я сдаюсь.
Я пытаюсь составить таблицы, основанные на нашем анализе данных, использую kableExtra, чтобы предварительно их отформатировать, а затем экспортировать и сохранить их в формате PDF. Я использовал как стабильную, так и dev версию для rmarkdown и tinytex. Также меняется латексный движок в RStudio. Любая помощь очень ценится.
Session info ----------------------------------------------------------------------------------------------------------------------
setting value
version R version 3.5.1 (2018-07-02)
system x86_64, mingw32
ui RStudio (1.1.456)
language (EN)
collate English_United States.1252
tz America/New_York
date 2018-08-30
Packages --------------------------------------------------------------------------------------------------------------------------
package * version date source
arsenal * 1.3.0 2018-07-20 CRAN (R 3.5.1)
assertthat 0.2.0 2017-04-11 CRAN (R 3.5.1)
backports 1.1.2 2017-12-13 CRAN (R 3.5.0)
base * 3.5.1 2018-07-02 local
bindr 0.1.1 2018-03-13 CRAN (R 3.5.1)
bindrcpp 0.2.2 2018-03-29 CRAN (R 3.5.1)
colorspace 1.3-2 2016-12-14 CRAN (R 3.5.1)
compiler 3.5.1 2018-07-02 local
crayon 1.3.4 2017-09-16 CRAN (R 3.5.1)
curl 3.2 2018-03-28 CRAN (R 3.5.1)
datasets * 3.5.1 2018-07-02 local
devtools * 1.13.6 2018-06-27 CRAN (R 3.5.1)
digest 0.6.16 2018-08-22 CRAN (R 3.5.1)
dplyr * 0.7.6 2018-06-29 CRAN (R 3.5.1)
evaluate 0.11 2018-07-17 CRAN (R 3.5.1)
git2r 0.23.0 2018-07-17 CRAN (R 3.5.1)
glue 1.3.0 2018-07-17 CRAN (R 3.5.1)
graphics * 3.5.1 2018-07-02 local
grDevices * 3.5.1 2018-07-02 local
highr 0.7 2018-06-09 CRAN (R 3.5.1)
hms 0.4.2 2018-03-10 CRAN (R 3.5.1)
htmltools 0.3.6 2017-04-28 CRAN (R 3.5.1)
httr 1.3.1 2017-08-20 CRAN (R 3.5.1)
kableExtra * 0.9.0 2018-05-21 CRAN (R 3.5.1)
knitr * 1.20 2018-02-20 CRAN (R 3.5.1)
magick 1.9 2018-05-11 CRAN (R 3.5.1)
magrittr 1.5 2014-11-22 CRAN (R 3.5.1)
memoise 1.1.0 2017-04-21 CRAN (R 3.5.1)
methods * 3.5.1 2018-07-02 local
munsell 0.5.0 2018-06-12 CRAN (R 3.5.1)
pillar 1.3.0 2018-07-14 CRAN (R 3.5.1)
pkgconfig 2.0.2 2018-08-16 CRAN (R 3.5.1)
purrr 0.2.5 2018-05-29 CRAN (R 3.5.1)
R6 2.2.2 2017-06-17 CRAN (R 3.5.1)
Rcpp 0.12.18 2018-07-23 CRAN (R 3.5.1)
readr 1.1.1 2017-05-16 CRAN (R 3.5.1)
rlang 0.2.2 2018-08-16 CRAN (R 3.5.1)
rmarkdown 1.10.12 2018-08-30 Github (rstudio/rmarkdown@6e56ad8)
rprojroot 1.3-2 2018-01-03 CRAN (R 3.5.1)
rsconnect 0.8.8 2018-03-09 CRAN (R 3.5.1)
rstudioapi 0.7 2017-09-07 CRAN (R 3.5.1)
rvest 0.3.2 2016-06-17 CRAN (R 3.5.1)
scales 1.0.0 2018-08-09 CRAN (R 3.5.1)
stats * 3.5.1 2018-07-02 local
stringi 1.2.4 2018-07-20 CRAN (R 3.5.1)
stringr 1.3.1 2018-05-10 CRAN (R 3.5.1)
testthat 2.0.0 2017-12-13 CRAN (R 3.5.1)
tibble 1.4.2 2018-01-22 CRAN (R 3.5.1)
tidyselect 0.2.4 2018-02-26 CRAN (R 3.5.1)
tools 3.5.1 2018-07-02 local
utils * 3.5.1 2018-07-02 local
viridisLite 0.3.0 2018-02-01 CRAN (R 3.5.1)
withr 2.1.2 2018-03-15 CRAN (R 3.5.1)
xml2 1.2.0 2018-01-24 CRAN (R 3.5.1)
yaml 2.2.0 2018-07-25 CRAN (R 3.5.1)
мой код:
makePaperTable <- function(geneList, Results4wk,Results10wk,n,table_title){
fourWeek <- Results4wk[,"genes"] %in% geneList
tenWeek <- Results10wk[,"genes"] %in% geneList
not_in <- geneList %in% Results4wk[,"genes"]
cat(c("Number of Genes in Gene list provided:",length(geneList),"\n"))
cat(c("Number of Genes in 4wk Results : ",sum(fourWeek),"\n"))
cat(c("Number of Genes in 10wk Results : ",sum(fourWeek),"\n"))
cat(c("Genes:"), geneList[!not_in],"\n","\n" )
table_joon <- merge(Results4wk[fourWeek,c("genes","FC","adj.P.Val")],Results10wk[tenWeek,c("genes","FC","adj.P.Val","Gene.description")], by="genes", all=T)
colnames(table_joon) <- c("Gene Symbol", "Fold Change", "Adj. p-Value", "Fold Change", "Adj. p-Value", "Gene Description")
table_joon$`Gene Description` <- tools::toTitleCase(gsub(x = table_joon$`Gene Description`, pattern = "\\[.*", replacement = "",perl = F) )
table_joon[,2:5] <- sapply(table_joon[,2:5],prettyNum,digits=2)
joon <- kable(table_joon,
caption = paste0("Table ", n,": ",stringr::str_replace_all(table_title,pattern = "\\.",replacement = " ")) ,
format = "latex",
booktabs=T,
align = c("l","c","c","c","c","l")) %>%
kable_styling(latex_options = "striped") %>%
add_header_above(c(" ", " 4 Week Group" = 2, "10 Week Group" = 2),bold = T,align = "c")
return(joon)
}
Output created: tablesV2.pdf
Error in tools::file_path_as_absolute(output_file) :
file 'tablesV2.pdf' does not exist
Calls: <Anonymous> -> <Anonymous>
In addition: Warning message:
In readLines(logfile) : incomplete final line found on 'tablesV2.log'
Execution halted