| powers_of_ten | R Documentation |
I often need to table big numbers in non-scientific notation.
convert_to_power_of_ten(x, exponent = NULL)
convert_from_power_of_ten(x)
df_to_powers_of_ten(x, is_individual = FALSE)
df_from_powers_of_ten(x)
x |
A data frame with attributed numeric columns. |
exponent |
Specify an exponent instead of deriving one from the data. |
is_individual |
Use individual powers of ten for each numeric column in
|
An attributed numeric vector.
A numeric vector.
A data frame with attributed numeric columns.
A data frame.
Other statistics:
column_sums(),
count_groups(),
relative_difference(),
round_half_away_from_zero(),
sloboda(),
weighted_variance()
Other vector functions:
char2factor(),
escape_non_ascii(),
file_string()
Other vector functions:
char2factor(),
escape_non_ascii(),
file_string()
Other statistics:
column_sums(),
count_groups(),
relative_difference(),
round_half_away_from_zero(),
sloboda(),
weighted_variance()
Other statistics:
column_sums(),
count_groups(),
relative_difference(),
round_half_away_from_zero(),
sloboda(),
weighted_variance()
# Using vectors
print(x <- (5 + rnorm(15)) * 10^11)
convert_to_power_of_ten(x, 6)
print(y <- convert_to_power_of_ten(x))
all.equal(x, convert_from_power_of_ten(y))
# Using data frames
## same exponent for all numeric columns
x <- (5 + rnorm(15)) * 10^11
df <- data.frame(x, y = x * 10^3, z = letters[seq_along(x)],
row.names = as.character(seq_along(x)))
x <- df_to_powers_of_ten(df)
str(x)
y <- df_from_powers_of_ten(x)
identical(df, y)
## individual exponents for different columns - but what for?
### automatically
### manually
df1 <- df
df1[["x"]] <- convert_to_power_of_ten(df1[["x"]])
df1[["y"]] <- convert_to_power_of_ten(df1[["y"]])
str(df1)
print(df2 <- df_from_powers_of_ten(df1))
identical(df, df2)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.