convertTo <- function(quantity=null, unit=NA) {
if (is.null(quantity) | is.na(unit))
stop("You must provide a quantity and a unit")
unitList <- findUnits(unit)
unitObj <- unitList$get(as.integer(0))
newQuantity <- quantity$convertTo(unitObj)
newQuantity
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.