Hi, this works for me (R 2.5.1, Linux):
<<echo=false>>= data(airquality) library(ctest) kruskal.test(Ozone ~ Month, data = airquality) @ Wir haben hier also \Sexpr{nrow(airquality)} Datenzeilen in airquality. This works \Sexpr{2+6} I think the error is in your latex setup, not in R or Sweave. ryancw wrote: > > I'm trying to learn Sweave. So far things are going well with the chunks > of code identified by << >>= > > But I'm having trouble with the in-line text use of \Sexpr. > > Here is a short example .Rnw file: > > \documentclass[12pt]{article} > \usepackage[margin=1.25in]{geometry} > \usepackage{graphicx} > \usepackage{Sweave} > > \begin{document} > > <<test>>= > pnorm(1) > @ > > > \Sexpr{2+6} > > \end{document} > > The .tex file that it yields contains > > \Sexpr{2+6} as its next-to-last line. \usepackage{Sweave} is in its > preamble. > > When I pdflatex that file, the resulting pdf file shows the proper value > of pnorm(1), but it does not contain "8" near its end. Instead it > contains "2+6". I had expected the computed value. > > Also, pdflatex gives me a message that "there was an error opening the > document. The file cannot be found." I have to go find it and open it, > instead of it opening automatically like a non-problematic case would. > > Running R 2.5.1 on WinXP, with MikTex. > > Any advice? Thanks. > > --Chris Ryan > > ______________________________________________ > 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. > > -- View this message in context: http://www.nabble.com/how-to-use-%5CSexpr%7B%7D-with-sweave-tf4581860.html#a13080823 Sent from the R help mailing list archive at Nabble.com. ______________________________________________ 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.