Hello,

\Sexpr only displays one value.

Why don't you print your vector into a verbatim environment ?

<<echo=F,results=verbatim>>
print(rx)
@

But if you want to generate a table with xtable, one solution :

<<echo=F,results=tex>>
print(xtable(as.data.frame(t(rx))), include.rownames = F, include.colnames =
F)
@


David


On Tue, May 26, 2009 at 11:36 PM, M Berg <dber...@gmail.com> wrote:

> Hello,
>
> I am trying to use the package "exams" to construct problem sets.
>
> I have constructed an exercise which generates a list of integers and asks
> the student to compute the median.
>
> rx is the vector of n numbers
>
> >str(rx)
> num [1:16] 21 9 8 18 4 12 17 2 9 7 ...
>
> I want to print out the entire vector as part of the problem.
> When I use \Sexpr(rx) only the first value (in this case 21) is printed
> out.
>
> I have been trying to get xtable to work.
>
> > xtable(rx)
> Error in UseMethod("xtable") : no applicable method for "xtable"
>
> > methods(xtable)
>  [1] xtable.anova*           xtable.aov*             xtable.aovlist*
>  [4] xtable.coxph*           xtable.data.frame*      xtable.glm*
>  [7] xtable.lm*              xtable.matrix*          xtable.prcomp*
> [10] xtable.summary.aov*     xtable.summary.aovlist* xtable.summary.glm*
> [13] xtable.summary.lm*      xtable.summary.prcomp*  xtable.table*
> [16] xtable.ts*              xtable.zoo*
>
>   Non-visible functions are asterisked
>
> I am new to R and would appreciate any suggestions.
>
> What is the best way to get exams/Sweave to print out the entire vector?
>
> Thanks in advance.
>
> DBerg
>
>        [[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