round_df | R Documentation |
This function allows the user to round all numeric values of a data frame, directly, even if the data frame contains non-numeric variables (which would throw an error in the round function).
round_df(df, digits, rf = "round")
df |
A data frame. |
digits |
Numeric vector for the desired number of digits. |
rf |
Type of round to be used. It can either be |
A data frame, with all the numeric variables rounded up to the number given to digits
.
Sollano Rabelo Braga sollanorb@gmail.com
library(forestmangr)
# Round all numeric variables
round_df(iris)
# Round all numeric variables using the floor function
round_df(iris, rf="floor")
# Do not run
# trying this with the the base function throws an error:
# round(iris)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.