Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .Rbuildignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
^.*\.Rproj$
^\.Rproj\.user$
.gitignore
^\.gitignore$
^\.travis\.yml$
18 changes: 18 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Sample .travis.yml for R projects.
#
# See README.md for instructions, or for more configuration options,
# see the wiki:
# https://github.com/craigcitro/r-travis/wiki

language: c
script: ./travis-tool.sh run_tests
before_install:
- curl -OL http://raw.github.com/craigcitro/r-travis/master/scripts/travis-tool.sh
- chmod 755 ./travis-tool.sh
- ./travis-tool.sh bootstrap
install:
- ./travis-tool.sh install_deps
notifications:
email:
on_success: change
on_failure: change
4 changes: 2 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Type: Package
Title: Miscellaneous functions provided by Dason
Version: 0.1
Date: 2012-10-01
Author@R: c(person("Dason", "Kurkiewicz",
Authors@R: c(person("Dason", "Kurkiewicz",
role = c("aut", "ctb", "cre"),
email = "dasonk@iastate.edu"))
Author: Dason Kurkiewicz
Expand All @@ -22,7 +22,7 @@ Collate:
'sinkReset.R'
'permutations.R'
'getArgs.R'
'holtWinters.R'
'holtwinters.R'
'linFinder.R'
'shadePlot.R'
'trainTest.R'
5 changes: 4 additions & 1 deletion NAMESPACE
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
export(getArgs)
export(goldenRatioRolors)
export(goldenRatioColors)
export(holm)
export(linFinder)
export(lsos)
export(permutations)
export(qvalue)
export(shadePlot)
export(sinkReset)
export(trainTest)
Expand Down
2 changes: 1 addition & 1 deletion R/goldenRatioColors.R
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
#' xs <- seq(1, n)
#' plot(c(1, n+1), c(0, 1), type = "n")
#' rect(xs, 0, xs + 1, 1, col = goldenRatioColors(n))
goldenRatioRolors <- function(n, s = .5, v = 1, alpha = 1){
goldenRatioColors <- function(n, s = .5, v = 1, alpha = 1){
GR <- 2/(1 + sqrt(5))
hues <- (seq(0, n-1) * GR) %% 1
cols <- hsv(hues, s, v, alpha)
Expand Down
1 change: 1 addition & 0 deletions R/holm.R
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#' Transform p-values based on Holm's method
#'
#' @param p Numeric. The p-values to adjust
#' @export
#' @examples
#' p <- c(.042, .001, .031, .014, .007)
#' p.adjust(p, "holm")
Expand Down
2 changes: 1 addition & 1 deletion R/holtWinters.R → R/holtwinters.R
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#' @param y Vector. The data to smooth.
#' @param alpha Numeric. A smoothing parameter
#' @param beta Numeric. A smoothing parameter
holtWinters <- function(y, alpha = .5, beta = .5){
holtwinters <- function(y, alpha = .5, beta = .5){
n <- length(y)
yhat <- numeric(n)
yhat[1:2] <- NA
Expand Down
32 changes: 21 additions & 11 deletions R/lsos.R
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,10 @@
#' @param head logical. Use head on the output?
#' @param n numeric. Number of objects to display is head is TRUE
#' @author Dirk Eddelbuettel, Tony Breyal
#' @export
#' @examples
#' lsos()
#' lsos(pos = 2, n = 5)
#' \dontrun{
#' a <- rnorm(100000)
#' b <- matrix(1, 1000, 100)
Expand All @@ -23,19 +25,27 @@ lsos <- function (pos = 1, pattern, order.by = "Size",
napply <- function(names, fn) sapply(names, function(x)
fn(get(x, pos = pos)))
names <- ls(pos = pos, pattern = pattern)
obj.class <- napply(names, function(x) as.character(class(x))[1])
obj.mode <- napply(names, mode)
obj.type <- ifelse(is.na(obj.class), obj.mode, obj.class)
obj.prettysize <- napply(names, function(x) {
capture.output(print(object.size(x), units = "auto")) })
obj.size <- napply(names, object.size)
obj.dim <- t(napply(names, function(x)
as.numeric(dim(x))[1:2]))
vec <- is.na(obj.dim)[, 1] & (obj.type != "function")
obj.dim[vec, 1] <- napply(names, length)[vec]
if (length(names) > 0) {
obj.class <- napply(names, function(x) as.character(class(x))[1])
obj.mode <- napply(names, mode)
obj.prettysize <- napply(names, function(x) {
capture.output(print(object.size(x), units = "auto")) })
obj.size <- napply(names, object.size)
obj.dim <- t(napply(names, function(x) as.numeric(dim(x))[1:2]))
obj.type <- ifelse(is.na(obj.class), obj.mode, obj.class)
vec <- is.na(obj.dim)[, 1] & (obj.type != "function")
obj.dim[vec, 1] <- napply(names, length)[vec]
} else {
obj.class <- character()
obj.mode <- character()
obj.prettysize <- character()
obj.size <- integer()
obj.dim <- data.frame(Rows=integer(), Columns=integer())
obj.type <- character()
}
out <- data.frame(obj.type, obj.size, obj.prettysize, obj.dim)
names(out) <- c("Type", "Size", "PrettySize", "Rows", "Columns")
if (!missing(order.by))
if (!is.null(order.by) || !is.na(order.by))
out <- out[order(out[[order.by]], decreasing=decreasing), ]
if (head)
out <- head(out, n)
Expand Down
3 changes: 2 additions & 1 deletion R/qvalue.R
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#' @param p Numeric. The p-values to adjust
#' @param m Numeric. The estimated number of true nulls
#'
#' @export
#' @examples
#' pval <- rbeta(100, 1, 3)
#' qvalue(pval)
Expand All @@ -15,7 +16,7 @@ qvalue <- function(p, m = length(p)){
# sort the values
tmp <- p[id]
# Do the adjustment
qval <- tmp*m/(1:n)
qval <- tmp*m/(1:m)
# Make sure that if p1 < p2 that q1 <= q2
qval <- rev(cummin(rev(qval)))
# We could improvate that by doing the sorting in the opposite
Expand Down
20 changes: 0 additions & 20 deletions man/getargs.Rd

This file was deleted.

10 changes: 5 additions & 5 deletions man/goldenRatioColors.Rd
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
\name{goldenratiocolors}
\alias{goldenratiocolors}
\name{goldenRatioColors}
\alias{goldenRatioColors}
\title{Choose n colors using the golden ratio}
\usage{
goldenratiocolors(n, s = 0.5, v = 1, alpha = 1)
goldenRatioColors(n, s = 0.5, v = 1, alpha = 1)
}
\arguments{
\item{n}{Integer. The number of colors you want}
Expand All @@ -20,12 +20,12 @@
ratio.
}
\examples{
cols <- goldenratiocolors(5)
cols <- goldenRatioColors(5)
plot(1:5, 1:5, col = cols)

n <- 5
xs <- seq(1, n)
plot(c(1, n+1), c(0, 1), type = "n")
rect(xs, 0, xs + 1, 1, col = goldenratiocolors(n))
rect(xs, 0, xs + 1, 1, col = goldenRatioColors(n))
}

31 changes: 0 additions & 31 deletions man/goldenRatioRolors.Rd

This file was deleted.

31 changes: 0 additions & 31 deletions man/goldenratiocolors.Rd

This file was deleted.

17 changes: 0 additions & 17 deletions man/holtWinters.Rd

This file was deleted.

7 changes: 7 additions & 0 deletions man/holtwinters.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,13 @@
\usage{
holtwinters(y, alpha = 0.5, beta = 0.5)
}
\arguments{
\item{y}{Vector. The data to smooth.}

\item{alpha}{Numeric. A smoothing parameter}

\item{beta}{Numeric. A smoothing parameter}
}
\description{
Holt winters smoothing with no seasonality
}
Expand Down
18 changes: 0 additions & 18 deletions man/linfinder.Rd

This file was deleted.

2 changes: 1 addition & 1 deletion man/permutations.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
}
\examples{
permutations(1:3)
permuations(c("a", "b", "c"))
permutations(c("a", "b", "c"))
permutations(c("raptors", "are", "horrible"))
}

40 changes: 0 additions & 40 deletions man/shadeplot.Rd

This file was deleted.

27 changes: 0 additions & 27 deletions man/traintest.Rd

This file was deleted.