how do i round a data frame in r which have some non numeric variables?

This should work if the variables are numeric indeed (you have to rename your columns I suppose as there are some limitations for column names in R):


df %>% 
  dplyr::select(col1 = 1, col2 = 2) %>% # enter all the columns you have and some simple names without special characters
  dplyr::mutate_if(is.numeric, ~ round(., 0))

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top