Skip to content

Commit

Permalink
ok
Browse files Browse the repository at this point in the history
  • Loading branch information
systematicinvestor committed Jun 9, 2015
1 parent d27f6e5 commit 6cc89c0
Show file tree
Hide file tree
Showing 6 changed files with 67 additions and 2 deletions.
31 changes: 31 additions & 0 deletions R/utils.r
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,37 @@ env.del <- function(names, env) {
}


###############################################################################
# Variables to List and back
#' @export
###############################################################################
vars2list <- function(...) {
out = list( ... )
names(out) = as.character(substitute(c(...))[-1])
out
}

#' @export
list2vars <- function(data, env = parent.frame()) {
for(n in names(data))
assign(n, data[[n]], env)
}

###############################################################################
# Check default argumnets
#' @export
###############################################################################
check.args = function(default.args, args=NULL) {
if(is.null(args)) return(default.args)

for(n in ls(default.args))
if(is.null(args[[n]]))
args[[n]] = default.args[[n]]

args
}


###############################################################################
#' Shortcut for all.equal function
#'
Expand Down
4 changes: 2 additions & 2 deletions pkg/DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ Type: Package
Title: Systematic Investor Toolbox
Description: Systematic Investor Toolbox is a collection of tools that
I use in my investment research.
Version: 2015.06.05
Date: 2015-06-05
Version: 2015.06.09
Date: 2015-06-09
License: GPL-3
LazyLoad: yes
Author: Michael Kapler <TheSystematicInvestor@gmail.com>
Expand Down
3 changes: 3 additions & 0 deletions pkg/NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ export(calendar.signal)
export(calendar.strategy)
export(cap.weighted.mean)
export(cboe.volatility.term.structure.SPX)
export(check.args)
export(chr)
export(clean.table)
export(cluster.group.FTCA)
Expand Down Expand Up @@ -236,6 +237,7 @@ export(last.trades)
export(ledoit.wolf.shrinkage)
export(len)
export(list2matrix)
export(list2vars)
export(load.packages)
export(load.VXX.CBOE)
export(log.fn)
Expand Down Expand Up @@ -447,6 +449,7 @@ export(ulcer.index)
export(update.ia)
export(us.ishares.components)
export(variable.number.arguments)
export(vars2list)
export(visualize.system.parameter.optimization)
export(write.xts)
export(xts2ts)
Expand Down
31 changes: 31 additions & 0 deletions pkg/R/utils.r
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,37 @@ env.del <- function(names, env) {
}


###############################################################################
# Variables to List and back
#' @export
###############################################################################
vars2list <- function(...) {
out = list( ... )
names(out) = as.character(substitute(c(...))[-1])
out
}

#' @export
list2vars <- function(data, env = parent.frame()) {
for(n in names(data))
assign(n, data[[n]], env)
}

###############################################################################
# Check default argumnets
#' @export
###############################################################################
check.args = function(default.args, args=NULL) {
if(is.null(args)) return(default.args)

for(n in ls(default.args))
if(is.null(args[[n]]))
args[[n]] = default.args[[n]]

args
}


###############################################################################
#' Shortcut for all.equal function
#'
Expand Down
Binary file modified sit.gz
Binary file not shown.
Binary file modified sit.lite.gz
Binary file not shown.

0 comments on commit 6cc89c0

Please sign in to comment.