Applying round function to every element in a dataframe
We can try with lapply
A[] <- lapply(A, function(x) if(is.numeric(x)) round(x, 3) else x)
If we need to change the format of numeric elements in those with character/factor
class columns as well
A[] <- lapply(A, function(x) {
x1 <- type.convert(as.character(x), as.is=TRUE)
ifelse(grepl("^[0-9.]+$", x1), round(as.numeric(x1), 3), x1)})