Skip to content

Instantly share code, notes, and snippets.

@rhilfi
Created November 30, 2020 03:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rhilfi/bffa0cea4ce54b98ef52ec206bacbb69 to your computer and use it in GitHub Desktop.
Save rhilfi/bffa0cea4ce54b98ef52ec206bacbb69 to your computer and use it in GitHub Desktop.
round_all_number_in_dataframe #R
Name<-c("John", "Paul","George", "Ringo")
Age <-rnorm(4, 70, 2)
number_1<-c(2.34324,2.32145,5.432,5.3456)
number_2<-c(6.5432,8.32456,3.2346,9.3254245)
data<-data.frame(Name, Age, number_1, number_2)
data_rounded<-data %>%
mutate(across(where(is.numeric), round, 1))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment