Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b34bebd
commit 1c22501
Showing
13 changed files
with
162 additions
and
141 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,12 @@ | ||
# Export all names | ||
exportPattern(".") | ||
|
||
import( | ||
proto | ||
) | ||
export("list") | ||
|
||
S3method("[<-", "result") | ||
S3method("as.function", "formula") | ||
S3method("$", "fn") | ||
|
||
import(proto) | ||
|
||
importFrom("utils", "read.table") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
list <- structure(NA,class="result") | ||
"[<-.result" <- function(x,...,value) { | ||
args <- as.list(match.call()) | ||
args <- args[-c(1:2,length(args))] | ||
length(value) <- length(args) | ||
for(i in seq(along=args)) { | ||
a <- args[[i]] | ||
if(!missing(a)) eval.parent(substitute(a <- v,list(a=a,v=value[[i]]))) | ||
} | ||
x | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
|
||
transform2 <- function(`_data`, ...) { | ||
f <- function(){} | ||
formals(f) <- eval(substitute(as.pairlist(c(alist(...), `_data`)))) | ||
body(f) <- substitute(modifyList(`_data`, data.frame(...))) | ||
f() | ||
} |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
\name{list} | ||
\alias{list} | ||
\alias{[<-.result} | ||
\title{Multiple value assignment.} | ||
\description{ | ||
Multiple value assignment. | ||
} | ||
\details{ | ||
Enables \code{list} to be used on the left hand side of assignment statements | ||
as shown in the examples. | ||
} | ||
\examples{ | ||
# swap a and b without explicitly creating a temporary | ||
a <- 1; b <- 2 | ||
list[a,b] <- list(b,a) | ||
|
||
# get eigenvectors and eigenvalues | ||
list[eval, evec] <- eigen(cbind(1,1:3,3:1)) | ||
|
||
# get today's month, day, year | ||
require(chron) | ||
list[Month, Day, Year] <- month.day.year(unclass(Sys.Date())) | ||
|
||
# get first two components of linear model ignoring rest | ||
list[Coef, Resid] <- lm(rnorm(10) ~ seq(10)) | ||
|
||
# assign Green and Blue (but not Red) components | ||
list[,Green,Blue] <- col2rgb("aquamarine") | ||
|
||
# Assign QR and QRaux but not other components | ||
list[QR,,QRaux] <- qr(c(1,1:3,3:1)) | ||
|
||
} | ||
\keyword{misc} |
Oops, something went wrong.