Skip to content
Prev 30137 / 398503 Next

Continuation string in Sweave

> Dear all,
  > In Sweave I have a code chunk
  > aaa <- "Sex, Drug/Sex:W1,Drug:W1,\
  >     Sex:W2,Drug:W2/Sex:W1:W2,Drug:W1:W2"
  > which in tex code turns into
  > \begin{Sinput}
  >> aaa <- "Sex, Drug/Sex:W1,Drug:W1,\n    Sex:W2,Drug:W2/Sex:W1:W2,Drug:W1:W2"
  > \end{Sinput}
  > meaning that the string is not split to two lines. Any suggestion about how to make Sweave break the string ?


Currently there is no way: Sweave operates on the *parsed* expressions
which do not contain the newlines. It does respect options(width=...)
settings, hence you can control approximately where lines are broken
(but not exactly).

Hope this helps,
Fritz