How do you control the formatting of digits when converting lists of numbers to character?
问题 I have a nested list containing numbers, for example x <- list(1 + .Machine$double.eps, list(rnorm(2), list(rnorm(1)))) If I call as.character on this, all the numbers are given in fixed format, to 15 significant digits. as.character(x) ## [1] "1" ## [2] "list(c(0.654345721043012, 0.611306113713901), list(-0.278722330674071))" I'd like to be able to control how the numbers are formatted. At the very least, I'd like to be able to control how many significant figures are included. As a bonus,