Install files and folders

This commit is contained in:
hyginn 2017-08-18 22:04:01 +02:00
parent 114ea02adb
commit 7c47af1b3d
10 changed files with 314 additions and 2 deletions

14
.Rprofile Normal file
View File

@ -0,0 +1,14 @@
init <- function() {
source(".init.R")
}
cat("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n")
cat(" =================")
cat("\n\n")
cat(" WELCOME !\n")
cat("\n")
cat(" Type 'init()' to begin\n\n")
cat("\n")
cat(" =================")
cat("\n\n")

8
.gitignore vendored
View File

@ -1,9 +1,12 @@
# Miscellaneous
.Ds_store
# History files
.Rhistory
.Rapp.history
# Session Data files
.RData
# .RData
# Example code in package build process
*-Ex.R
@ -15,7 +18,7 @@
/*.Rcheck/
# RStudio files
.Rproj.user/
# .Rproj.user/
# produced vignettes
vignettes/*.html
@ -31,3 +34,4 @@ vignettes/*.pdf
# Temporary files created by R markdown
*.utf8.md
*.knit.md
.Rproj.user

15
.init.R Normal file
View File

@ -0,0 +1,15 @@
# .init.R
# Functions to initialize this collection of learning units
# Boris Steipe
# ====================================================================
# Create a local copy of myScript.R if required, and not been done yet.
if (! file.exists("myScript.R") && file.exists(".tmp.R")) {
file.copy(".tmp.R", "myScript.R")
}
source(".utilities.R")
file.edit("ABC-units.R")
# [End]

22
.tmp.R Normal file
View File

@ -0,0 +1,22 @@
# myScript.R
#
# Write your notes and code experiments into this document. Save it
# from time to time - however I recommend that you do not _commit_
# your saved version.
#
# As long as you do not _commit_ this script to version control,
# you can _pull_ updated versions of the entire project from GitHub
# by using the RStudio version control interface. However, once
# you _commit_ any file in your local version, RStudio will require
# you to resolve conflicts before you can _pull_ updates.
#
# ====================================================================
# [END]

44
.utilities.R Normal file
View File

@ -0,0 +1,44 @@
# .utilities.R
#
# Miscellaneous R code to suppport the project
#
# Version: 1.0
# Date: 2016 12
# Author: Boris Steipe
#
# V 1.0 First code
#
# ToDo:
# Notes:
#
# ==============================================================================
objectInfo <- function(x) {
# Function to combine various information items about R objects
#
# Input: an R object
# Value: none - prints information as side-effect
cat("object contents:")
print(x, digits = 22) # print value at maximal precision
cat("\nstructure of object:\n")
str(x)
if (! is.list(x)) { # Don't use cat() if x is a list. cat() can't handle lists.
cat("\nmode: ", mode(x), "\n")
cat("typeof: ", typeof(x), "\n")
cat("class: ", class(x), "\n")
}
# if the object has attributes, print them too
if (! is.null(attributes(x))) {
cat("\nattributes:\n")
attributes(x)
}
# Done
}
# [END]

84
ABC-units.R Normal file
View File

@ -0,0 +1,84 @@
# ABC-units.R
#
# Purpose: A Bioinformatics Course: R code for learning units
#
# Version: 0.
#
# Date: 2017 08 18
# Author: Boris Steipe (boris.steipe@utoronto.ca)
#
# V 0.1 First code
#
# TODO:
#
#
# == HOW TO WORK WITH THIS FILE ================================================
#
# Go through this script line by line to read and understand the
# code. Execute code by typing <cmd><enter>. When nothing is
# selected, that will execute the current line and move the cursor to
# the next line. You can also select more than one line, e.g. to
# execute a block of code, or less than one line, e.g. to execute
# only the core of a nested expression.
#
# Edit code, as required, experiment with options, or just play.
# Especially play.
#
# DO NOT simply source() this whole file!
#
# If there are portions you don't understand, use R's help system,
# Google for an answer, or ask me. Don't continue if you don't
# understand what's going on. That's not how it works ...
#
# Once you have typed and executed the function init(), you will find a file
# called myScript.R in the project directory.
#
# Open it, you can place all of your code-experiments and notes into that
# file. This will be your "Lab Journal" for this session.
#
# ==============================================================================
" Introduction:
...
"
# ==============================================================================
# PART ONE: REVIEW
# ==============================================================================
# == SECTION ===================================================================
# == Subsection
# Continue ...
# ==============================================================================
# APPENDIX: OUTLOOK
# ==============================================================================
"There are many more functions for ... that this tutorial did not cover. You should know about the following. Look up the function and write a short bit of example code that uses it:"
?subset
?sweep
?with # ... and within()
"Then you should know about the following packages. Open the vignette and browse through it. You should know be able to come up with least one use-case where the package functions would be useful:
https://cran.r-project.org/web/packages/magrittr/
"
# [END]

16
ABC-units.Rproj Normal file
View File

@ -0,0 +1,16 @@
Version: 1.0
RestoreWorkspace: No
SaveWorkspace: No
AlwaysSaveHistory: No
EnableCodeIndexing: Yes
UseSpacesForTab: Yes
NumSpacesForTab: 2
Encoding: UTF-8
RnwWeave: knitr
LaTeX: XeLaTeX
AutoAppendNewline: Yes
StripTrailingWhitespace: Yes

33
functionTemplate.R Normal file
View File

@ -0,0 +1,33 @@
# functionTemplate.R
#
# Purpose: (General)
#
# ToDo:
# Notes:
#
# ==============================================================================
myFunction <- function(a, b=1) {
# Purpose:
# Describe ...
# Version:
# Date:
# Author:
#
# Parameters:
# a: ...
# b: ...
# Value:
# result: ...
# code ...
return(result)
}
# ==== TESTS =================================================================
# Enter your function tests here...
# [END]

68
scriptTemplate.R Normal file
View File

@ -0,0 +1,68 @@
# scriptTemplate.R
#
# Purpose:
# Version:
# Date:
# Author:
#
# Input:
# Output:
# Dependencies:
#
# ToDo:
# Notes:
#
# ==============================================================================
setwd("<your/project/directory>")
# ==== PARAMETERS ============================================================
# Define and explain all parameters. No "magic numbers" in your code below.
# ==== PACKAGES ==============================================================
# Load all required packages.
if (!require(RUnit, quietly=TRUE)) {
install.packages("RUnit")
library(RUnit)
}
# ==== FUNCTIONS =============================================================
# Define functions or source external files
source("<myUtilityFunctionsScript.R>")
myFunction <- function(a, b=1) {
# Purpose:
# Describe ...
# Parameters:
# a: ...
# b: ...
# Value:
# result: ...
# code ...
return(result)
}
# ==== PROCESS ===============================================================
# Enter the step-by-step process of your project here. Strive to write your
# code so that you can simply run this entire file and re-create all
# intermediate results.
# ==== TESTS =================================================================
# Enter your function tests here...
# [END]

12
taskSolutions.R Normal file
View File

@ -0,0 +1,12 @@
# taskSolutions.R
#
# Code for (some of) the workshop tasks
# [END]