yihui | Personal website of Yihui Xie | Static Site Generator library
kandi X-RAY | yihui Summary
kandi X-RAY | yihui Summary
This is a repo to host the (Markdown) source files of my personal website, including my Chinese and English blogs, as well as several project websites (such as knitr.) The content of all pages is licensed under CC BY-NC-SA 4.0. To build the website locally, you must clone this repo with its submodule (use the --recursive argument), e.g.,. The website is built via the R package blogdown. Please read its documentation for how to use it. I don't recommend you to study how my website is built, because it is complicated. In particular, the way I manage images is fairly complicated.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of yihui
yihui Key Features
yihui Examples and Code Snippets
Community Discussions
Trending Discussions on yihui
QUESTION
I am currently preparing html slides for an R modelling workshop, for which I use the awesome xaringan package for R. It is based on remark.js. Compared to ioslides and slidy, it does much better suit my expectations. I am absolutely excited! One feature that I missed, are scrollable "long slides". Here I leave of course the "slides" paradigm towards a mix between slides and ordinary web pages, but I find this didactically attractive to explain complex content and code. This style worked well with slidy, and I found also some hints how to enable scrollable code in xaringan.
Here I use the following CSS (found in a related post at SO):
...ANSWER
Answered 2021-Jun-11 at 20:06remark.js
was not made with scrollable slides in mind, which means that it is not possible to implement scrolling without a major feature addition to remark.js
or breaking certain remark.js
features.
If you are willing to break some features, the easiest way I can think of to hack in scrollable slides is by altering the y-overflow
of the .remark-slide-scaler
class. All we have to do is add the following CSS:
QUESTION
If I use \FloatBarrier to maintain the desired order of the document, I get the following error and can't knit the PDF (specifically happens with PDF). It worked probably six months ago.
...ANSWER
Answered 2021-Jun-10 at 09:21You have to load the placeins
package if you want to use one of its macros:
QUESTION
I want to create a footer within the float for a figure created with ggplot2 in an rmarkdown document that is generating a .pdf file via LaTeX.
My question: Is there a way within rmarkdown/knitr to add more LaTeX commands within the figure environment?
Specifically, I'd like to find a way to insert custom LaTeX using either the floatrow
or caption*
macro as described in https://tex.stackexchange.com/questions/56529/note-below-figure within the figure environment.
When I looked at the chunk options (https://yihui.org/knitr/options/#plots), something like out.extra
seems close to what I want, but that is used as an extra option to \includegraphics
while I want access to put extra LaTeX within the figure environment, outside of any other LaTeX command.
ANSWER
Answered 2021-Jun-07 at 10:41The solution to your question is perhaps quite similar to this one. However, I believe yours is a bit more general, so I'll try to be a bit more general as well...
As far as I know, there's no simple solution to add extra LaTeX code within the figure environment. What you can do is update the knit (or output) hook (i.e. the LaTeX code output generated by the figure chunk).
The source code for the LaTeX figure output hook can be found here (hook_plot_tex
). The output generated can be found starting at line 159. Here we can see how the output is structured and we're able to modify it before it reaches the latex engine.
However, we only want to modify it for relevant figure chunks, not all. This is where Martin Schmelzer's answer comes in handy. We can create a new chunk option which allows for control over when it is activated. As an example enabling the use of caption*
and floatrow
we can define the following knit hook
QUESTION
For my jekyll blog, I'm knitting Rmd to Md for the posts. At somewhere (preferably top), I want to programmatically add a link to view the source page (Rmd) hosted under _sources
folder in top level directory.
Similar implementation can be found at https://yihui.org/en/about/ (at the left sidebar- Edit this page
option)
Can this be done by some modification in custom knit
command?
OR
Some html-include
with liquid
syntax should be used?
ANSWER
Answered 2021-Mar-26 at 18:32What about this? This has the Github icon, and links to the repo on the github page. Without any reprex, or an example from you, this is the best I can do unless you give more details. Does Jekyll use YAML?
QUESTION
As explained in this chapter of the R Markdown Cookbook, it is possible to make custom blocks in R Markdown files with this syntax (here, to center some text):
...ANSWER
Answered 2021-Jun-06 at 09:06There are two issues:
- You use
print()
instead ofcat()
(even if you refer to cat() in your post - You put spaces at the beginning of each line which prevents the custom block to be rendered.
- If you prefer the lines to be indented (as I do) then I would suggest make each line a separate string as I do in the second example. This also has the advantage that you could add the line breaks via the
sep
argument instead of having to add them manually.
Reproducible example:
QUESTION
From RStudio I have created a new file, File / New File / R Markdown, I have tried to generate the .pdf file from knitr / knitr to PDF, and the error that I reproduce below occurs, I am starting with LaTeX and I do not know very well what make. I appreciate your help.
Console RStudio:
...ANSWER
Answered 2021-May-26 at 05:21According to the comments, the answer posted at https://tex.stackexchange.com/a/27141 solved the issue.
The relevant part:
Remedy: start MiKTeX Options and choose either Yes or No (but not "Ask me first") for the option "Install missing packages on-the-fly"
QUESTION
I would like to extract the github repo url for all the packages on CRAN. And I have tried to first read the link of CRAN and get the table of all the package names, which also contains the url for the description page of each package, for I want to extract the github repo url through the description page. But I can't get the completed url. Could you please help me with this? Or is there any better way to get the repo url for all packages?
This is my supplementary :
Actually, I want to filter the pkgs that do have a official github repo, like some pkgs as xfun or fddm. And I found I can extract the username and repo name from the description of pkgs on CRAN, and put them in a github formatted url. (for most of them have the same format url like : https://github.com/{username}/{reponame}. For example, for package xfun
, it would be like : https://github.com/yihui/xfun.
And now, I have get some of them like : (three of them)
And I am wondering how could I get the url for all of them. I know use glue pkg can replace the elements in a url. and for get the url by replacing elements (username and reponame) I have tried map() and map_dfr() function. But it returns me error : Error in parse_url(url) : length(url) == 1 is not TRUE
Here is my code :
...ANSWER
Answered 2021-May-25 at 16:26I want to suggest a different method for getting where you want.
As discussed in the comments, not all R packages have public GitHub repos.
Here is a version of some code from an answer to another question by Dirk Eddelbuettel that retrieves information from CRAN's database, including the package name and the URL field. If a package has a public GH repo, it is very likely that the authors have included that information in the URL field: there may be a few packages where the GH repo information is guessable (i.e. the GH user name is the same as (e.g.) the identifier in the maintainer's e-mail address; the GH repo name is the same as the package name), but it seems like a lot of work to do all that guessing (and accessing GitHub to see if the guess was correct) for a relatively low return.
QUESTION
I am looking to create unique/individual reports for a given list of vendors. The ideal output format would be a seperate html file of the given vendors information.
The issue is that I am having trouble wrapping my head around creating parameterized reports in RMarkdown. I have been taking a look at this link to understand how to loop/iterate through RMarkdown reports
To illustrate and share the logic of what I want to execute is the following:
...ANSWER
Answered 2021-May-13 at 20:42I think the step you were missing was specifying the output filename so that each "vendor" would have its own file; otherwise, the same filename is overwritten each time leaving you with a single HTML document.
An example:
QUESTION
According to the rmarkdown cookbook, using knitr::include_url
should produce an inline frame of the webpage (note that it works and contains images):
But when I do the exact same thing in HTML document, I see no images in my inline frame, and I am not sure why:
DetailsIn case it helps, here are some more details:
YAML for my document
...ANSWER
Answered 2021-May-11 at 01:54This is due to a change in a recent version of Pandoc (not that recent but a few months ago) that it will embed URLs as base64 data. I just patched knitr to change this behavior. You can try the dev version of knitr:
QUESTION
I am gradually building an R Markdown (.RMD) file, learning by doing. I was able to insert a couple of tables, but I had a problem with one of them. The initial setup is:
...ANSWER
Answered 2021-May-10 at 20:48According to wiki, there are some characters that needs escaping
Here, is a tested version of the markdown code
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install yihui
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page