R: Knit an R Markdown document and post it to WordPress

knit2wp {knitr} | R Documentation

## Knit an R Markdown document and post it to WordPress

### Description

This function is a wrapper around the RWordPress package. It compiles an R Markdown document to HTML and post the results to WordPress.

### Usage

    knit2wp(input, title = "A post from knitr", ..., envir = parent.frame(),
        shortcode = FALSE, action = c("newPost", "editPost", "newPage"), postid,
        encoding = getOption("encoding"), publish = TRUE)

### Arguments

`input` | Filename of the Rmd document.
`title` | Title of the post.
`...` | Other meta information of the post, e.g. `categories = c('R', 'Stats')` and `mt_keywords = c('knitr', 'wordpress')`, et cetera.
`envir` | Environment in which code chunks are to be evaluated, for example, `parent.frame()`, `new.env()`, or `globalenv()`).
`shortcode` | A length-2 logical vector: whether to use the shortcode [sourcecode lang='lang'], which can be useful to WordPress.com users for syntax highlighting of source code and output. The first element applies to source code, and the second applies to text output. By default, both are `FALSE`.
`action` | Whether to create a new post, update an existing post, or create a new page.
`postid` | If `action` is `editPost`, the post id `postid` must be specified.
`encoding` | Encoding of the input file; see `file`.
`publish` | Boolean: publish the post immediately?

### Note

This function will convert the encoding of the post and the title to UTF-8 internally. If you have additional data to send to WordPress (e.g. keywords and categories), you may have to manually convert them to the UTF-8 encoding with the `iconv(x, to = 'UTF-8')` function (especially when using Windows).

### Author(s)

William K. Morris, Yihui Xie, and Jared Lander

### References

https://yihui.name/knitr/demo/wordpress/

### Examples

    # see the reference

[Package knitr version 1.20 Index]