Displaying 20 results from an estimated 20000 matches similar to: "Sweave and the "[" function"
2010 Jul 27
4
Sweave and scan()
I am introducing the scan() function to my class. Consider the following
file (Scanexamp.Rnw )
\documentclass[12pt]{article}
\begin{document}
<<>>=
height = scan()
64 62 66 65 62
69 72 72 70
part = scan(what = character(0))
"Soprano" "Soprano" "Soprano"
"Alto" "Alto" "Tenor"
"Tenor" "Bass"
2014 Jan 03
1
Sweave trims console output in "tex" mode
Hi
In the example .Rnw file below, only the newline between c and d is
visible in the resulting .tex file after running R CMD Sweave. What is
the reason for this behavior? Newlines are important in LaTeX and should
be preserved. In particular, this behavior leads to incorrect LaTeX code
generated when using tikz(console=TRUE) inside a Sweave chunk, as shown
in the tikzDevice vignette.
A
2011 Mar 21
1
Sweave, white space and code blocks
Sweave is very useful, and I'm gradually getting used to it.
I've just been battling Sweave over the re-use of code chunks. As I am
pretty ignorant in the byways of both Sweave and R, this took a chunk of
time to sort out. Here is what I learned:
If one re-uses a code chunk, then Sweave (but not Stangle) will insist that
<>
start in column 1. In particular, white space to its left
2004 Sep 06
2
Sweave echoing comments (again)
Hello,
I try to document some R scripts for my collegues and observed the
problem, that Sweave strips comment lines away.
As a small example I write in an Rtex file:
\begin{Scode}
## a small example
test() # line comment
\end{Scode}
... the .tex file generated by Sweave only contains:
\begin{Schunk}
\begin{Sinput}
test()
\end{Sinput}
\end{Schunk}
... and all the comments are lost.
2004 Sep 06
2
Sweave echoing comments (again)
Hello,
I try to document some R scripts for my collegues and observed the
problem, that Sweave strips comment lines away.
As a small example I write in an Rtex file:
\begin{Scode}
## a small example
test() # line comment
\end{Scode}
... the .tex file generated by Sweave only contains:
\begin{Schunk}
\begin{Sinput}
test()
\end{Sinput}
\end{Schunk}
... and all the comments are lost.
2010 May 20
2
Sweave and uttf-8 under Windows XP
Hi list,
I need to process a Rnw file and and a csv file (both are encoded in
UTF-8) under Windows XP (R Version 2.11.0, i386, mingw32).
I can source and run the Rnw file:
> Stangle("Bericht.Rnw")
Writing to file Bericht.R
> source(file("Bericht.R", encoding="UTF-8"))
which runs fine, but running Sweave() failed:
> Sweave("Bericht.Rnw")
2010 Oct 25
1
Sweave and absolute escaped backslashed Windows paths in R 2.12.0
I've noticed a change in behavior in R 2.12.0 from 2.11.1 regarding the
treatment of absolute paths in the file argument of Sweave in a Windows
environment.
Consider the minimal Rnw file, attached and reproduced below my
signature in case .Rnw files get stripped. This file is stored on my
(Windows) computer in H:/My Documents. Using an absolute path with the
standard window's
2011 Apr 19
1
Sweave tokens not in column 1: enhancement request
When I re-use a code chunk in Sweave, together with keep.source=TRUE, I would
like to follow usual programming conventions in which the amount of white
space on the left indicates logical structure. It seems that one can't do
this in Sweave, or am I wrong?
for (i in ind) {
do such-and-such and then
<<code chunk 20>>
do something-else
}
Sweave will say that << is
2010 Nov 07
1
Sweave: option keep.source=TRUE and package cacheSweave
Dear all,
When I use the cacheSweave package together with the Sweave option
keep.source = TRUE, all the LaTeX code before the Sweave code chunk is
included in the TeX file to be compiled. For example, with the
following Sweave file
\documentclass[12pt]{article}
\usepackage[nogin]{Sweave}
% Sweave options
\SweaveOpts{keep.source=TRUE, strip.white=TRUE, eps=FALSE, pdf=TRUE}
\begin{document}
2007 Jun 28
4
Sweave bug? when writing figures / deleting variable in chunk
I have found a quite strange (to me) behaviour in Sweave. It only
occurs in the following situation:
1. define a variable in one chunk
2. use it within a subsequent figure-generating chunk
3. delete it at the end of that same chunk
Then the Sweave driver chokes, not finding the variable name when
generating the figure
Example:
% document bug2.Rnw
\documentclass{article}
\usepackage{Sweave}
2008 Jun 13
4
Sweave: looping over mixed R/LaTeX code
Dear guRus,
I would like to loop over a medium amount of Sweave code, including both R and LaTeX chunks. Is there any way to do so? As an illustration, can I create a .tex file like this using a loop within a .Rnw file, where the "1,2,3" comes from some iteration variable in R?
################################################
\documentclass{article}
\usepackage{Sweave}
\begin{document}
2004 Mar 30
2
Sweave and graphic output locations
Hello,
I'm using R1.8.1 on windows 2000 and version 1.8.1 of the tools package.
I am attempting to have Sweave write files to a different directory via:
testfile <- system.file("Sweave", "Sweave-test-1.Rnw",
package = "tools")
## create a LaTeX file
Sweave(
testfile,
output = "C:/temp/Sweave-test-1.tex",
2009 Jul 26
3
Sweave, cacheSweave, and data frame
Dear All,
I have been using Sweave (mainly via the Sweave.sh script) and really like
it. I am working a paper (using Sweave, of course) which includes several
time-consuming computations, and it gets tedious to re-compile the whoel
thing every time I made changes. Then I discover the "cacheSweave" package,
which seems the right solution to my problem. I only have on problem. Here
is
2011 Feb 07
2
Error with named chunks in Sweave with the development version of R
Dear all,
There seems to be a problem with named chunks in Sweave with the version
of R under development (downloaded yesterday). When I sweave the file
toto.Rnw described at the end of this mail (Ubuntu 10.04 LTS), the
function Sweave returns an Internal error:
> utils::Sweave("toto.Rnw")
Writing to file toto.tex
Processing code chunks ...
1 : echo term verbatim (label=a)
2
2007 May 11
1
can't use Sweave in a function?
Hi List,
Please see the following simple example which illustrate the problem. I'm
using R-2.5.0 in WinXP and
R2HTML 1.58.
Thanks,
....Tao
#============="test.rnw" =================
<html>
<body>
<div>
<h1 align=center>Report</h1>
<p>
<<echo=FALSE,results=html>>=
print(y)
print("\n")
print(paste("(",
2009 Mar 02
2
Fwd: Converting R to Sweave (Rnw)
Hi
I am thinking about using Sweave more frequently, especially for
documenting code. But the syntax is slightly awkward for me (<<name>>=
... @), and I was thinking if there would be a way of importing the
type of code extracted from an Rnw file back into an Rnw file? The
advantage would be that the code could run in R without tangling.
Obviously, sweave options could not be
2009 Jan 19
1
Sweave encoding problem
Hello,
Sweave seems to have trouble processing german letters in R.
For example, my noweb R-input looks like this.
<<>>=
Oberfl?chenfehler = c(4, 11, 6, 2, 7, 9)
@
If I send it through Sweave, I get the following error message.
error: chunk 1
Error in parse(text = chunk) : unexpected input in "Oberfl??"
extra: Warning message:
In readLines(f[1]) :
underfull last line in
2007 Mar 15
1
Sweave bug using 'FDR' in chunk label (PR#9567)
Full_Name: Kevin Coombes
Version: 2.4.0
OS: Windows XP
Submission from: (NULL) (143.111.22.24)
I'm running R 2.4.0 on a Windows XP machine, with only the default packages
loaded.
Running Sweave or Stangle on the following Rnw file:
--------------
% bug.Rnw
\begin{document}
Demonstrate an Sweave/Stangle bug.
<<info>>=
sessionInfo()
@
<<getFDR>>=
x <- 1
@
2005 Jul 25
1
FW: LyX and Sweave
Hello R-users!
I have tried to use Sweave within LyX* and found two ways to accomplish
this. I have attached LyX source file for both ways.
*<http://www.lyx.org>
Lep pozdrav / With regards,
Gregor Gorjanc
----------------------------------------------------------------------
University of Ljubljana
Biotechnical Faculty URI: http://www.bfro.uni-lj.si/MR/ggorjan
Zootechnical
2013 Feb 13
2
sweave question
Hi Everyone: I was having trouble getting the plot size correct when
putting a plot in an sweave document. So, I searched on the internet and I
found a clever solution where the person uses
the cat function to write latex code so he can include the cat code in the
chunk and place the plot using width and height. The solution is here:
https://stat.ethz.ch/pipermail/r-help/2009-April/195094.html.