public
Authored by avatar 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) or hdf (French), then tab and you will get an automatic header.
Edited
RStudio_snippet_header.R 1.49 KiB
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")`
	
	
	
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment