0

In standard R scripts, sections can be labelled by adding four dashes after a comment. E.g.

# simple math ----
1+1

looks like this:

script with label

how can I label sections in a Rnw script? Four dashes don't work here. See:

script without label

jmjr
  • 2,090
  • 2
  • 21
  • 31

1 Answers1

0

The solution should be the following one:

<<section-label-name>>=
//code
@

Regards,

J_F

J_F
  • 9,956
  • 2
  • 31
  • 55
  • I don't mean labelling chunks of code. I mean the function within RStudio. In the first image it says "simple math" as intended, in the second it doesn't. It just says "c (Top Level)" – jmjr Jun 02 '16 at 14:02
  • I don´t get the point. With my solution this is possible. Of course it´s named "chunk" but the usage is the same: You can jump between the sections, etc. – J_F Jun 02 '16 at 14:09
  • I see what you mean. It is a way, but not what I am looking for, because I do not want do add a chunk without needing one. So I am actually looking for a way that comments serve as labels. Thanks for clarifying. – jmjr Jun 02 '16 at 15:46