| div | R Documentation |
Divide column values in a data frame with a common number.
div(x, cols, by = 1000, grep = FALSE, ...)
x |
a data frame. |
cols |
column names, or column indices. |
by |
a number to divide with. |
grep |
whether |
... |
passed to |
A data frame similar to x, after dividing columns cols by the
number by.
Provides notation that is convenient for modifying many columns at once.
transform can also be used to recalculate column values, using
a more general and verbose syntax.
grep is the underlying function used to match column names if
grep is TRUE.
rnd is a similar function that rounds columns.
TAF-package gives an overview of the package.
# These are equivalent:
x1 <- div(summary.taf, c("Rec","Rec_lo","Rec_hi",
"TSB","TSB_lo","TSB_hi",
"SSB","SSB_lo","SSB_hi",
"Removals","Removals_lo","Removals_hi"))
x2 <- div(summary.taf, "Rec|TSB|SSB|Removals", grep=TRUE)
x3 <- div(summary.taf, "Year|Fbar", grep=TRUE, invert=TRUE)
# Less reliable in scripts if columns have been added/deleted/reordered:
x4 <- div(summary.taf, 2:13)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.