Hi everyone, can anyone tell me how i can change how i display mean(age), i want it to say The mean age of patients within the sample is mean(age) -- View this message in context: http://www.nabble.com/displaying-results-tp23558890p23558890.html Sent from the R help mailing list archive at Nabble.com.
Read the posting guide please. Self-contained, minimal, reproducible code. On Fri, May 15, 2009 at 8:33 AM, deanj2k <dl120 at le.ac.uk> wrote:> > Hi everyone, can anyone tell me how i can change how i display mean(age), i > want it to say The mean age of patients within the sample is mean(age) > -- > View this message in context: http://www.nabble.com/displaying-results-tp23558890p23558890.html > Sent from the R help mailing list archive at Nabble.com. > > ______________________________________________ > R-help at 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. >-- Stephen Sefick Let's not spend our time and resources thinking about things that are so little or so large that all they really do for us is puff us up and make us feel like gods. We are mammals, and have not exhausted the annoying little problems of being mammals. -K. Mullis
Absolutely no idea what you mean, Try reconstructing your question in concise English with reproducible code. Simon. ----- Original Message ----- From: "deanj2k" <dl120 at le.ac.uk> To: <r-help at r-project.org> Sent: Friday, May 15, 2009 1:33 PM Subject: [R] displaying results> > Hi everyone, can anyone tell me how i can change how i display mean(age), > i > want it to say The mean age of patients within the sample is mean(age) > -- > View this message in context: > http://www.nabble.com/displaying-results-tp23558890p23558890.html > Sent from the R help mailing list archive at Nabble.com. > > ______________________________________________ > R-help at 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. >
On 5/15/2009 8:33 AM, deanj2k wrote:> Hi everyone, can anyone tell me how i can change how i display mean(age), i > want it to say The mean age of patients within the sample is mean(age)I think you want something like this: cat(sprintf("The mean age of patients within the sample is %.1f.\n", mean(age))) Play with the %.1f format for more decimal places, etc. Duncan Murdoch
Duncan Murdoch wrote:> On 5/15/2009 8:33 AM, deanj2k wrote: >> Hi everyone, can anyone tell me how i can change how i display >> mean(age), i >> want it to say The mean age of patients within the sample is mean(age) > > I think you want something like this: > > cat(sprintf("The mean age of patients within the sample is %.1f.\n", > mean(age))) >or maybe cat(sprintf("The mean age of patients within the sample is %.1f.\n", round(mean(age), 1)))> Play with the %.1f format for more decimal places, etc.... and be aware of excel bugs. vQ