Learn R Programming

microplot (version 1.0-45)

as.htmlimg: Place a filename or filepath in the format used by HTML

Description

Place a filename or filepath in the format used by HTML, by surrounding it with "<img src" and "/>" and with possible additional arguments between.

Usage

as.htmlimg(object, height = "80", width = NULL, wd = getwd(), align = "middle")

Arguments

object

Vector of character strings containing filenames.

height, width

Number of pixels as a character string.

wd

The directory in which the files reside. The default is the current working directory that R is using.

align

Specifies the alignment of an image according to surrounding elements (Not supported in HTML5). One of the strings: "top", "bottom", "middle", "left", "right"

Value

A character vector containing the input strings surrounded by "<img src" and "/>" and with possible additional arguments between.

See Also

microplot

Examples

Run this code
# NOT RUN {
as.htmlimg("abcd.png")
as.htmlimg("abcd.png", wd=".")
as.htmlimg(c("abcd.png", "efgh.png"))
cat( as.htmlimg("abcd.png")                , "\n")
cat( as.htmlimg("abcd.png", wd=".")        , "\n")
cat( paste(as.htmlimg(c("abcd.png", "efgh.png")), "\n"))

## For an example in context, please see the package example:
##    system.file(package="microplot", "examples/irisRMarkdownHtml.Rmd")
## Copy file irisRMarkdownHtml.Rmd to a directory in which you have write privileges.
## Run the statement
##   rmarkdown::render("irisRMarkdownHtml.Rmd", output_file="irisRMarkdownHtml.html")
## at the R Console.
# }

Run the code above in your browser using DataLab