I'm writing R scripts in RStudio and I use the code folding https://support.rstudio.com/hc/en-us/articles/200484568-Code-Folding-and-Sections a lot. I found that you can see the hierarchy of the folding by pressing cmd + shift + O. This is super helpful.
# to my dear love ---------------------------------------------------------
2+2
# yo man ====
x.2 = function (x) {x+2}
### I do love potatoes ####
See the result by pressing cmd + shift + O.
我不明白这是如何工作的,因为当我编写下面的代码时,我可以创建一个没有文本的小节,但当其中有文本时则不能创建一个小节(使用# ====
但不是# yo man ====
).
# to my dear love ---------------------------------------------------------
2+2
# ====
# yo man ====
### I do love potatoes ####
x.2 = function (x) {x+2}
data = "here is some data"
See the result by pressing cmd + shift + O.
![enter image description here](https://i.stack.imgur.com/iJVG7.png)
你可以在下面看到# to my dear love ---------------------------------------------------------
下面的所有内容都向右移动!这很酷!
- 因此,问题是,如何创建包含文本的部分层次结构?
- Is it a peculiar package or Emac that is doing this? How can I create subsections, with text, and see the hierarchy in the cmd + shift + O box?
- 如何通过减少右侧框中的视觉层次结构将一个部分(转到较高的部分(例如第 2 部分))向下移动到较低的部分(第 1 部分)?
EDIT
我想添加一个关于现在更简单的方法的评论(这类似于常规降价(除了----
在最后);请注意,最大级别数似乎为 6):
# Description -------------------------------------------------------------
### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ###
# Created by Me!
# Institution
# Created on DATE
# Why:
# Requires:
# NOTES:
### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ###
# Abstract ----
# This is a comment
# Introduction ----
## Important math ----
answer = 2 + 2
# Material and methods ----
## Another function in the wall ----
cement = function(brick) {
log(brick)
}
### Subsection 1.1 ----
#### Subsection 1.1.1 ----
##### Subsection 1.1.1.1 ----
###### Subsection 1.1.1.1.1 ----
####### Subsection 1.1.1.1.1.1 ----
# Results ----
answer
cement(exp(1))
# [...] ----
Gives