On 25 Jan 2012, at 11:54, Duncan Murdoch wrote: > I think the documentation for cat is a little ambiguous, but it is working as > documented if I read "If any element of sep contains a newline character," to > mean that the element consists of a newline and nothing else. I'm not sure > if that was the intended reading or not.
I don't know about the reading, but if memory serves me well, once upon a time cat would not automatically go to a newline, i.e. cat(1, file = '') 1 > so I'd have to explictly set the newline as a separator: cat(1, file= '', sep = '\n') 1 > Though I admit my memory could be wrong. Thank you for the solution btw. BW Federico > >> >> How would I overcome this issue? I tried a number of things, all of which >> have failed. >> > > I'd use sprintf for that, i.e. something like > > count <- c(3, 17, 15) > pct <- c(20, 30, 31) > cat(sprintf("%d (%d%%)\n", count, pct), sep="") > > where count and pct are the vectors of values to go into the display. > > Duncan Murdoch -- Federico C. F. Calboli Neuroepidemiology and Ageing Research Imperial College, St. Mary's Campus Norfolk Place, London W2 1PG Tel +44 (0)20 75941602 Fax +44 (0)20 75943193 f.calboli [.a.t] imperial.ac.uk f.calboli [.a.t] gmail.com ______________________________________________ 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.