Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
N
ngs_tools
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
15
Issues
15
List
Boards
Labels
Service Desk
Milestones
Requirements
Requirements
List
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Analytics
Analytics
Insights
Issue
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
bioinfo
ngs_tools
Commits
2c73d150
Commit
2c73d150
authored
May 14, 2019
by
Lena Hersemann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added template for R scripts
parent
f9eb3a78
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
63 additions
and
0 deletions
+63
-0
misc/template_r_script.R
misc/template_r_script.R
+63
-0
No files found.
misc/template_r_script.R
0 → 100644
View file @
2c73d150
#!/usr/bin/env Rscript
##TODO: define title and objective
#' # Report Title
#' Objective: Analysis objective
#'
#' Created by: `r system("whoami", intern=T)`
#'
#' Created at: `r format(Sys.Date(), format="%B %d %Y")`
#-----------------------------------------------------------------------------------------------------------------------
#+ include=FALSE
suppressMessages
(
require
(
docopt
))
##TODO: specify function of the script, usage (name of R script and required input data) and optional parameters with type (e.g. boolean, file, etc.), a description and the default setting
doc
=
'
Function of the script
Usage: script_name.R [options] <required_input_1> <required_input_2>
Options:
--parameter_1 <parameter_type> parameter description [default: parameter_default]
--parameter_2 <parameter_type> parameter description [default: parameter_default]
'
#commandArgs <- function(x) c("--argument_1", "argument_1_setting", "required_input_1", "required_input_2")
opts
=
docopt
(
doc
,
commandArgs
(
TRUE
))
#-----------------------------------------------------------------------------------------------------------------------
## REQUIRED PACKAGES
devtools
::
source_url
(
"https://git.mpi-cbg.de/bioinfo/datautils/raw/v1.45/R/core_commons.R"
)
#TODO: load all additionally required packages
## NEWLY DEFINED FUNCTIONS
#TODO: define new functions if required
#-----------------------------------------------------------------------------------------------------------------------
#TODO: write script with commented code
#-----------------------------------------------------------------------------------------------------------------------
## ADDITIONAL INFORMATION EXPORT
## export R version and package infos
writeLines
(
capture.output
(
devtools
::
session_info
()),
".sessionInfo.txt"
)
## save R session as hidden file
#TODO: use the R script's name as a name for the session file
session
::
save.session
(
".script_name.dat"
)
# session::restore.session(".script_name.dat")
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment