public
Authored by
Delaigue Olivier
RStudio header
RStudio snippet to add a header using a keyboard shortcut in an a R script
To add a header easily at the beginning of the script in RStudio:
- Tools/Global Options/Code/Snippets/Edit Snippets
- Copy the content of the code from the
RStudio_snippet_header.R
file (edit the user name and the user email) - Once in an R script, type
hde
(English) orhdf
(French), then tab and you will get an automatic header.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
snippet hdf
`r paste0("
# ---------------------------------------------------------------------------------------
#
# Description :
#
# Auteurs : Name Surname <name.surname@inrae.fr>
#
# Date creation : ", Sys.time(), "
# Date modification :
#
# Commentaires :
#
# ---------------------------------------------------------------------------------------
# ----------------------------- definition des chemins
# -------------- sources
# repertoire des sources
path_src <- \"../01_src\"
# -------------- resultats
# repertoire des resultats
path_res <- \"../02_res\"
# ----------------------------- chargement des packages
# ----------------------------- chargement des donnees")`
snippet hde
`r paste0("
# ---------------------------------------------------------------------------------------
#
# Description :
#
# Authors : Name Surname <name.surname@inrae.fr>
#
# Creation date : ", Sys.time(), "
# Modification date :
#
# Comments :
#
# ---------------------------------------------------------------------------------------
# ----------------------------- path definition
# -------------- sources
# source directory
path_src <- \"../01_src\"
# -------------- results
# result directory
path_res <- \"../02_res\"
# ----------------------------- package loading
# ----------------------------- data loading")`
Please register or sign in to comment