[R] sweave output
Duncan Murdoch
murdoch.duncan at gmail.com
Tue Oct 5 15:51:13 CEST 2010
On 05/10/2010 7:58 AM, Rubin, Norman wrote:
> I'm just starting to use sweave with latex and have a beginner question
> I expect this has been asked before - but I cannot seem to find the answer
>
> An input like:
>
> <<echo=false>>=
> X<- 1:3
> X
> @
>
> Generates
>
> [1] 1 2 3
>
> Is there a way to suppress the [1] ?
This isn't really an Sweave question. Sweave just prints what R would
print. To get R to print without the decorations, use cat(X, "\n")
instead of
X (which is really a synonym for print(X)). The "\n" says to go to a
new line; it's optional in this example (because Sweave will insert a
line break automatically), but it would make a difference if you were
printing multiple things within the same code chunk.
Duncan Murdoch
> I know I can write each term out using this
>
> the line is \Sexpr{X[1]} \Sexpr{X[2]} \Sexpr{X[3]}
>
> But there must be a simpler way.
> Any suggestions?
> If you send out an answer would you copy me directly as well as send it to the mailing list
>
>
> Thanks
> Norm
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> 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.
More information about the R-help
mailing list