Applying round off function on all sheets in a run in R -
thanks community, using following code round off numeric values in given data frame. take step further , automate function identifies imported dataframe ( not ones created in workflow) , round off numeric values in it. have run function every time import dataframe. round of function using
round_df <- function(df, digits) { nums <- vapply(df, is.numeric, fun.value = logical(1)) df[, nums] <- round(df[, nums], digits = digits) (df) } df <- round_df(df, digits = 2) is there way identify imported dataframe in environment? should use loop?
thank much.
Comments
Post a Comment