Duncan Murdoch wrote: > >> and there's always sprintf() for those moments when you >> want neat formatting. > > That's good when you want good control over the formatting, but it > doesn't tend to be all that readable, with the variables all listed > at the end, instead of in between the bits of string. > As the old saying goes, you can eat the cake and have it:
x <- rnorm(1) cat("x is close to ", sprintf("%.1lf", x), " and closer to ", sprintf("%.10lf", x), "\n", sep = "") :-) I am using R as a generic programming language for doing jobs in Windows that I can't do using DOS batch - things like taking a text in Latin-1 and removing the accented characters, or looping through a directory and renaming files with weird names, or creating a .wpl file with the mp3s. Alberto Monteiro ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.