[R] [Sweave] string.prefix without hyphen-minus

Yihui Xie xie at yihui.name
Fri May 4 17:50:20 CEST 2012


I guess that is hard-coded in Sweave, so you probably cannot control
it unless you (partially) rewrite the driver. And just FYI, you can
try the knitr package, which does not add the hyphen for you, but the
name of the option 'prefix.string' has been changed to 'fig.path'
(http://yihui.name/knitr/options). If you set fig.path='foo/', figures
will be generated as, e.g., foo/label.pdf instead of foo/-label.pdf

utils::RweaveChunkPrefix
function (options)
{
    if (!is.null(options$label)) {
        if (options$prefix)
            chunkprefix <- paste(options$prefix.string, "-",
                options$label, sep = "")
        else chunkprefix <- options$label
    }
    else chunkprefix <- paste(options$prefix.string, "-",
formatC(options$chunknr,
        flag = "0", width = 3), sep = "")
    chunkprefix
}


Regards,
Yihui
--
Yihui Xie <xieyihui at gmail.com>
Phone: 515-294-2465 Web: http://yihui.name
Department of Statistics, Iowa State University
2215 Snedecor Hall, Ames, IA


On Fri, May 4, 2012 at 10:23 AM,  <julia.jacobson at arcor.de> wrote:
> Dear Sweave users,
>
> Could you help me to find a way to place Sweave output files in a subdirectory of the currentfolder without giving them a subname?
> If the option "prefix.string=foo/" is used, all files are placed in this folder, but begin with an hyphen-minus, which makes it difficult to work with them. If the option "prefix=FALSE" is used, then files won't be placed in a subdirectory.
>
> Thanks in advance for your help,
> Julia
>



More information about the R-help mailing list