Description Usage Arguments Details Value See Also Examples
View source: R/statTools_code_OTHER.R
The first element is placed outside brackets and the rest inside. In de form of before (inside1, inside2, ...)
1 2 |
before |
Vector with the values written before the bracket starts. It can also be a data frame or matrix (see Details). |
... |
Other vectors to be displayed between brackets. |
between |
Defaults to "-". Character vector with the strings to separate values inside the brackets. If it has length 1, it is replicated for all elements. |
add |
Defaults to |
rounding |
Defaults to getOption("rounding"). Number of decimals used for rounding. See |
When before
is a data frame, it returns a vector of strings where the first column from the data frame is outside the brackets
and all the others inside separated by the symbol given in between
.
When before
is a vector and ...
are also vectors of the same length, a data frame is created and the same that above is performed.
Returns a vector of strings with the values before and between the brackets. Has an attribute named data.frame
with the values used.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | mins <- apply(iris[1:4], 2, min)
maxs <- apply(iris[1:4], 2, max)
means <- apply(iris[1:4], 2, mean)
inbra(means, mins, maxs, between = " to ")
freqs <- as.numeric(table(iris$Species))
percents <- as.numeric(100*prop.table(table(iris$Species)))
inbra(freqs, percents, rounding = 2, add = "%")
# with a data frame:
values <- inbra(iris[c(5, 1:4)], between = c("; ", " - ", " - "), add = "cm")
values
# data arguments are still stored in
attributes(values)$data
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.