Ah! I was always trying collapse with sep and other options. Not by itself.
Perfect!

And yes, that was my bad example.


Robin Jeffries
MS, DrPH Candidate
Department of Biostatistics
UCLA
530-624-0428



On Tue, Jan 18, 2011 at 10:27 PM, Joshua Wiley <jwiley.ps...@gmail.com>wrote:

> Hi Robin,
>
> Have you looked at the 'collapse' argument to paste?
> something like:
>
> myvec <- paste(1:4, collapse = ", ")
>
> Might do what you want.  Also maybe ?bquote or the like to get rid of
> quotes possibly (I'm not in a position to try presently).
>
> Side note, it is really probably best not to use 'c' as a variable name
> since it is such a fundamental function.
>
> Cheers,
>
> Josh
>
>
> On Jan 18, 2011, at 21:46, Robin Jeffries <rjeffr...@ucla.edu> wrote:
>
> > I am trying to print a nice looking vector in Sweave.
> >
> > c <- 1:4
> >
> > I want to see (1, 2, 3, 4) in TeX. .
> >
> > If I use
> > paste(c, ",", sep="")
> > I get
> > "1," "2," "3," "4,"
> >
> > If use cat(c, sep=",")
> > I can't seem to assign it to an object,
> > 1,2,3,4> myvec <- cat(c, sep=",")
> > 1,2,3,4> myvec
> > NULL
> >
> > and if I bypass the object assignment and put
> > "My vector is (\Sweave{cat(c, sep=",")}). "
> > prints out
> > "My vector is (). "
> >
> > Suggestions?
> >
> >
> > Robin Jeffries
> > MS, DrPH Candidate
> > Department of Biostatistics
> > UCLA
> > 530-624-0428
> >
> >    [[alternative HTML version deleted]]
> >
> > ______________________________________________
> > 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.
>

        [[alternative HTML version deleted]]

______________________________________________
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.

Reply via email to