[R] demo()

Yurii Aulchenko i.aoultchenko at erasmusmc.nl
Fri Oct 20 00:16:39 CEST 2006


Dear All,

I am programming a demo for an R package (say, the name is "mydemo"); when
I run it, it works perfectly fine.

Now is the problem: I would like some explanatory text to appear before
the command recorded in mydemo runs. If I use "cat" or "print", the result
is not nice: first, the comment appears as the command, and then it is
printed out. See what I mean:

In mydemo code I have

# This command will show a histogram of x:
cat("This command will show a histogram of x:\n";
hist(x)

What appears in the output is something like:

> cat("This command will show a histogram of x:\n";
This command will show a histogram of x:
> hist(x)
<<histogram is generated>>

What I would like to have as the output is:

This command will show a histogram of x:
> hist(x)
<<histogram is generated>>

Could someone suggest me a solution?

Yurii



More information about the R-help mailing list