Have you ever typed something like this in your R script as a section break:
#.........................just a example.........................
ARTofR is designed to help you do this, by auto-inserting title, divider and block of comments, for example:
xxx_divider1('just a example')
will give you
#.........................just a example.........................
xxx_title2('another example')
will give you
##~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ## another example ---- ##~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
ARTofR is a wrapper of bannerCommenter::banner(), written with thanks to the author, Bill Venables
Install from CRAN:
install.packages("ARTofR")User guide with Rstudio Addins
User guide for any R users
- Click
Addins
in your Rstudio top ribbon- Choose
ARTofR user interface
- Follow instruction in the app
- type your text in any text editor
- copy your text
- call xxx_box() or xxx_box1() etc without arguments in R console
- NO NEED to copy again!!!
- paste into your R script
xxx_title2('your title') ##~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ## your title ---- ##~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ xxx_box1('your comments') #............................................................................... # . # your comments . # . #...............................................................................
xxx_title() will automatically bring you a navigation panel
but xxx_divider will not
library(ARTofR) xxx_title0('ARTofR') ##~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ##~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ## ~~ ## ARTOFR ---- ## ~~ ##~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ##~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ xxx_title1('ARTofR') ##~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ## -- ##...................................ARTOFR.................................---- ## -- ##~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ xxx_title2('ARTofR') ##~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ## ARTofR ---- ##~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ xxx_title3('ARTofR') ##~~~~~~~~~~~~~~~~ ## ~ ARTofR ---- ##~~~~~~~~~~~~~~~~
You need to turn-off auto-indent
in options\code
of R studio, to keep the spaces before the line break
library(ARTofR) xxx_divider1('') #................................................................ xxx_divider1('ARTofR') #.............................ARTofR............................. xxx_divider2('') ##~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ xxx_divider2('ARTofR') # ARTofR ~~~ #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Copy this paragraph:
I used ARTofR everyday and it makes my R script so neat. I used ARTofR everyday and it makes my R script so neat. I used ARTofR everyday and it makes my R script so neat. I recommended this pacakge to all my families. Yes, even my grandmother like it!
Then in your R console do:
xxx_box() # I used ARTofR everyday and it makes my R script so neat. I used ARTofR # everyday and it makes my R script so neat. I used ARTofR everyday and it # makes my R script so neat. # # I recommended this pacakge to all my families. # # Yes, even my grandmother like it! xxx_box1() #............................................................................... # . # I used ARTofR everyday and it makes my R script so neat. I used ARTofR . # everyday and it makes my R script so neat. I used ARTofR everyday and it . # makes my R script so neat. . # . # I recommended this pacakge to all my families. . # . # Yes, even my grandmother like it! . # . #............................................................................... xxx_box1(center = T) #............................................................................... # . # I used ARTofR everyday and it makes my R script so neat. I used ARTofR . # everyday and it makes my R script so neat. I used ARTofR everyday and it . # makes my R script so neat. . # . # I recommended this pacakge to all my families. . # . # Yes, even my grandmother like it! . # . #...............................................................................
Copy this list:
1. I used ARTofR everyday 2. I used ARTofR everyday and it makes my R script so neat. I used ARTofR everyday and it makes my R script so neat. 3. I recommended this pacakge to all my families. I recommended this pacakge to all my families. 4. Yes, even my grandmother like it!
Then in your R console:
xxx_list() # 1. I used ARTofR everyday # 2. I used ARTofR everyday and it makes my R script so neat. I used ARTofR # everyday and it makes my R script so neat. # 3. I recommended this pacakge to all my families. I recommended this # pacakge to all my families. # 4. Yes, even my grandmother like it! xxx_list1() #............................................................................... # . # 1. I used ARTofR everyday . # 2. I used ARTofR everyday and it makes my R script so neat. I used ARTofR . # everyday and it makes my R script so neat. . # 3. I recommended this pacakge to all my families. I recommended this . # pacakge to all my families. . # 4. Yes, even my grandmother like it! . # . #...............................................................................
xxx_list1(center = T) is not recommended, use xxx_box(center=T)
There is a gratuitous advice in BannerCommenter help doc saying: ‘A potential danger of providing this simple facility is that some authors may be tempted to overdo their script decoration.’
These set of functions, being a wrapper of banner, was designed to
Here are some other pacakages I found useful for R codes formatting:
strcode
styler
bannercommenter
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4