[R] Problem with Sweave not recognising \Sexpr{}
I am trying to run the Sweave example at http://www.stat.uni-muenchen.de/~leisch/Sweave/Sweave-Rnews-2002-3.pdf However, the \Sexpr{} code is not being evaluated, although the actual R code within the {} runs ok in R. Below is part of the resulting .tex file. Can anyone help identify the cause? I am using R 2.10.1 on Windows XP. Consider the \texttt{cats} regression example from Venables \ Ripley (1997). The data frame contains measurements of heart and body weight of \Sexpr{nrow(cats)} cats (\Sexpr{sum(cats$Sex==F)} female, \Sexpr{sum(cats$Sex==M)} male). Thanks Mike White __ 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.
Re: [R] Problem with Sweave not recognising \Sexpr{}
I think I have solved the problem. In the Sweave manual it mentions that problems may occur after loading the R2HTML package. I have not recently loaded this package but the proposed solution to problems caused by R2HTML also solves my problem with the evaluation of R code in \Sexpr. It seems that it is necessary to set the syntax option in the Sweave function as follows Sweave(..., syntax=SweaveSyntaxNoweb) although I am not sure why this is required. Mike On 19:59, Mike White wrote: I am trying to run the Sweave example at http://www.stat.uni-muenchen.de/~leisch/Sweave/Sweave-Rnews-2002-3.pdf However, the \Sexpr{} code is not being evaluated, although the actual R code within the {} runs ok in R. Below is part of the resulting .tex file. Can anyone help identify the cause? I am using R 2.10.1 on Windows XP. Consider the \texttt{cats} regression example from Venables \ Ripley (1997). The data frame contains measurements of heart and body weight of \Sexpr{nrow(cats)} cats (\Sexpr{sum(cats$Sex==F)} female, \Sexpr{sum(cats$Sex==M)} male). Thanks Mike White __ 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.
Re: [R] Problem with Sweave not recognising \Sexpr{}
I had the same problem before and I think it has something to do with the R2HTML package. To take care of that problem simply sweave your rnw file like this: Sweave(yourfile.Rnw,syntax=SweaveSyntaxNoweb) and try Sexpr{} again. Felipe D. Carrillo Supervisory Fishery Biologist Department of the Interior US Fish Wildlife Service California, USA - Original Message From: Mike White mikewhite@btconnect.com To: r-help@r-project.org r-help@r-project.org Sent: Tue, May 25, 2010 2:25:36 AM Subject: [R] Problem with Sweave not recognising \Sexpr{} I am trying to run the Sweave example at http://www.stat.uni-muenchen.de/~leisch/Sweave/Sweave-Rnews-2002-3.pdf However, the \Sexpr{} code is not being evaluated, although the actual R code within the {} runs ok in R. Below is part of the resulting .tex file. Can anyone help identify the cause? I am using R 2.10.1 on Windows XP. Consider the \texttt{cats} regression example from Venables \ Ripley (1997). The data frame contains measurements of heart and body weight of \Sexpr{nrow(cats)} cats (\Sexpr{sum(cats$Sex==F)} female, \Sexpr{sum(cats$Sex==M)} male). Thanks Mike White __ ymailto=mailto:R-help@r-project.org; href=mailto:R-help@r-project.org;R-help@r-project.org mailing list href=https://stat.ethz.ch/mailman/listinfo/r-help; target=_blank 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. __ 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.
Re: [R] Problem with Sweave not recognising \Sexpr{}
What other packages do you have loaded? Sometimes things interfere with each other. Also, what version, os, etc are you working with? (the info asked for in the posting guide). -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare greg.s...@imail.org 801.408.8111 -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r- project.org] On Behalf Of Mike White Sent: Tuesday, May 25, 2010 3:26 AM To: r-help@r-project.org Subject: [R] Problem with Sweave not recognising \Sexpr{} I am trying to run the Sweave example at http://www.stat.uni-muenchen.de/~leisch/Sweave/Sweave-Rnews-2002-3.pdf However, the \Sexpr{} code is not being evaluated, although the actual R code within the {} runs ok in R. Below is part of the resulting .tex file. Can anyone help identify the cause? I am using R 2.10.1 on Windows XP. Consider the \texttt{cats} regression example from Venables \ Ripley (1997). The data frame contains measurements of heart and body weight of \Sexpr{nrow(cats)} cats (\Sexpr{sum(cats$Sex==F)} female, \Sexpr{sum(cats$Sex==M)} male). Thanks Mike White __ 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. __ 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.