search for: makeunits

Displaying 1 result from an estimated 1 matches for "makeunits".

Did you mean: makeinit
2008 Jun 25
1
expression, strsplit, ...
...".", l^{4})) To make this a bit prettier, I've attempted to mimic the behavior of the SIstyle latex package which defines a macro that cleverly parses an expression for units, exponents, etc. My code fails in putting together the unit, as seen in the example below: > > makeUnits <- function(expr){ # formats the units > > units.list <- strsplit(expr, "[[:blank:]]", perl=F) > expr.list <- strsplit(unlist(units.list), "\\^", perl=T) > > units <- unlist(lapply(expr.list, function(unit) { > if (length(unit) == 2) paste(unit[...