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

______________________________________________
R-help@stat.math.ethz.ch 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.

Reply via email to