Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

rpubsUpload

Upload an HTML file to RPubs


Description

This function uploads an HTML file to rpubs.com. If the upload succeeds a list that includes an id and continueUrl is returned. A browser should be opened to the continueUrl to complete publishing of the document. If an error occurs then a diagnostic message is returned in the error element of the list.

Usage

rpubsUpload(title, htmlFile, id = NULL, properties = list(), 
    method = getOption("rpubs.upload.method", "auto"))

Arguments

title

The title of the document.

htmlFile

The path to the HTML file to upload.

id

If this upload is an update of an existing document then the id parameter should specify the document id to update. Note that the id is provided as an element of the list returned by successful calls to rpubsUpload.

properties

A named list containing additional document properties (RPubs doesn't currently expect any additional properties, this parameter is reserved for future use).

method

Method to be used for uploading. "internal" uses a plain http socket connection; "curl" uses the curl binary to do an https upload; "rcurl" uses the RCurl package to do an https upload; and "auto" uses the best available method searched for in the following order: "curl", "rcurl", and then "internal". The global default behavior can be configured by setting the rpubs.upload.method option (the default is "auto").

Value

A named list. If the upload was successful then the list contains a id element that can be used to subsequently update the document as well as a continueUrl element that provides a URL that a browser should be opened to in order to complete publishing of the document. If the upload fails then the list contains an error element which contains an explanation of the error that occurred.

Examples

## Not run: 
# upload a document
result <- rpubsUpload("My document title", "Document.html")
if (!is.null(result$continueUrl)) 
    browseURL(result$continueUrl) else stop(result$error)

# update the same document with a new title
updateResult <- rpubsUpload("My updated title", "Document.html", result$id)

## End(Not run)

markdown

Render Markdown with the C Library 'Sundown'

v1.1
GPL-2
Authors
JJ Allaire [aut], Jeffrey Horner [aut], Yihui Xie [aut, cre] (<https://orcid.org/0000-0003-0645-5666>), Henrik Bengtsson [ctb], Jim Hester [ctb], Yixuan Qiu [ctb], Kohske Takahashi [ctb], Adam November [ctb], Nacho Caballero [ctb], Jeroen Ooms [ctb], Thomas Leeper [ctb], Joe Cheng [ctb], Andrzej Oles [ctb], Vicent Marti [aut, cph] (The Sundown library), Natacha Porte [aut, cph] (The Sundown library), RStudio [cph]
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.