I have an Rmd file that I want to convert to a pdf file. Currently it is located in a subfolder of the "static" folder that is a part of my blog site structure created by the blogdown package. The problem is, when I hit the "Knit" button in RStudio, it calls rmarkdown::render_site(...)
while I was expecting rmarkdown::render(...)
. I do have a file R/build.R
with a single line of a command blogdown::build_dir("static")
so this is weird to me. When I tried to convert other Rmd files in a different folder (not associated with my blog folders/files) everything works perfectly fine as expected.
To get what I want, I am currently typing rmarkdown::render("myfile.Rmd")
in the console, or I am using infinite moon reader, but neither is as convenient as the "Knit" button :(
The following is the output from xfun::session_info('blogdown')
after updating the blogdown package to ver 1.1:
> xfun::session_info('blogdown') R version 4.0.3 (2020-10-10) Platform: x86_64-w64-mingw32/x64 (64-bit) Running under: Windows 10 x64 (build 18363), RStudio 1.4.1103 Locale: LC_COLLATE=English_United States.1252 LC_CTYPE=English_United States.1252 LC_MONETARY=English_United States.1252 LC_NUMERIC=C LC_TIME=English_United States.1252 Package version: base64enc_0.1.3 BH_1.75.0.0 blogdown_1.1 bookdown_0.21 digest_0.6.27 evaluate_0.14 glue_1.4.2 graphics_4.0.3 grDevices_4.0.3 highr_0.8 htmltools_0.5.0 httpuv_1.5.4 jsonlite_1.7.2 knitr_1.30 later_1.1.0.1 magrittr_2.0.1 markdown_1.1 methods_4.0.3 mime_0.9 promises_1.1.1 R6_2.5.0 Rcpp_1.0.5 rlang_0.4.9 rmarkdown_2.6 servr_0.21 stats_4.0.3 stringi_1.5.3 stringr_1.4.0 tinytex_0.29 tools_4.0.3 utils_4.0.3 xfun_0.20 yaml_2.2.1
edited: I am not absolutely sure if this will help, but the Rmd file I want to convert to pdf goes like the following:
--- title: "Homework 3" subtitle: "due Feb 2, 2021" output: pdf_document: default ---
knitr::opts_chunk$set( echo = FALSE, fig.align = "center") library(tidyverse)
\bigskip **1.** Recall `iris` data set. Find the maximum value of the sum `Sepal.Length` $+$ `Sepal.Width`. To which species does the sample with the maximum value you found above belong? _Hint_: you might want to start with defining a new variable `Sepal.Sum` using `mutate()`, for example.
iris %>% mutate(Sepal.Sum = Sepal.Length + Sepal.Width) %>% arrange(desc(Sepal.Sum)) %>% slice(1) %>% select(Sepal.Sum, Species)
When I save this file in the folder ``
https://stackoverflow.com/questions/65820777/the-behavior-of-the-knitr-button-in-rstudio-when-rendering-an-rmd-file-sitting-i January 21, 2021 at 11:31AM
没有评论:
发表评论