search for: rval

Displaying 20 results from an estimated 259 matches for "rval".

Did you mean: real
2006 Jul 20
3
How do I modify an exported function in a locked environment?
...contains function "rollmean.default" > rollmean.default function (x, k, na.pad = FALSE, align = c("center", "left", "right"), ...) { x <- unclass(x) n <- length(x) y <- x[k:n] - x[c(1, 1:(n - k))] y[1] <- sum(x[1:k]) rval <- cumsum(y)/k if (na.pad) { rval <- switch(match.arg(align), left = { c(rval, rep(NA, k - 1)) }, center = { c(rep(NA, floor((k - 1)/2)), rval, rep(NA, ceiling((k - 1)/2))) }, right = { c(rep(NA, k - 1), rval)...
2006 Jul 20
3
How do I modify an exported function in a locked environment?
...contains function "rollmean.default" > rollmean.default function (x, k, na.pad = FALSE, align = c("center", "left", "right"), ...) { x <- unclass(x) n <- length(x) y <- x[k:n] - x[c(1, 1:(n - k))] y[1] <- sum(x[1:k]) rval <- cumsum(y)/k if (na.pad) { rval <- switch(match.arg(align), left = { c(rval, rep(NA, k - 1)) }, center = { c(rep(NA, floor((k - 1)/2)), rval, rep(NA, ceiling((k - 1)/2))) }, right = { c(rep(NA, k - 1), rval)...
2007 Jul 25
2
initalizing and checking validity of S4 classes
...l="character"), prototype( v=numeric(0), l=character(0) ) ) setMethod("initialize", "someclass", function(.Object, v=numeric(0), l=character(0)) { # strip the vector names cv <- v cl <- l names(cv) <- NULL names(cl) <- NULL rval <- .Object rval@v <- cv rval@l <- cl rval } ) # at this point this should be OK o <- new("someclass", v=1:2, l=letters[1:3]) o # check validity f <- function(object) { rval <- NULL if( length(object@v) != length(object@l) ) rval <- c( rval, &quo...
2007 Jun 12
0
Branch 'as' - 3 commits - libswfdec/swfdec_as_array.c libswfdec/swfdec_as_context.c libswfdec/swfdec_as_math.c libswfdec/swfdec_as_native_function.c libswfdec/swfdec_as_number.c libswfdec/swfdec_as_object.c libswfdec/swfdec_as_string.c
..._color_as.c index e73505d..8ebefe5 100644 --- a/libswfdec/swfdec_color_as.c +++ b/libswfdec/swfdec_color_as.c @@ -57,7 +57,8 @@ swfdec_movie_color_init (SwfdecMovieColo /*** AS CODE ***/ static void -swfdec_movie_color_getRGB (SwfdecAsObject *obj, guint argc, SwfdecAsValue *argv, SwfdecAsValue *rval) +swfdec_movie_color_getRGB (SwfdecAsContext *cx, SwfdecAsObject *obj, + guint argc, SwfdecAsValue *argv, SwfdecAsValue *rval) { int result; SwfdecMovie *movie = SWFDEC_MOVIE_COLOR (obj)->movie; @@ -81,7 +82,8 @@ add_variable (SwfdecAsObject *obj, const } static void -swfdec_movie_...
2011 Apr 22
3
[LLVMdev] copy instructions
...Expression::codeGen() { Value *l = left->codeGen(); Value *r = right->codeGen(); Value *result = new TempValue; // get unique temporary emit(result->str() + " add " + l->str() + ", " r-str()); return result; } Value *assignExpression::codeGen() { Value *rval = rvalue->codeGen(); Value *lval = new NameValue(ident); emit(lval->str() + " = " + rval->str()); // emit (silly) copy instruction return lval; } What I have suggested to my students is to omit the (non-existent) copy instruction and use the "rval" above as a...
1998 Mar 26
1
R-beta: problem with locfit
I installed the locfit package under Linux (gcc 2.7.2). Installation was ok but > x <- runif(200) > y.compl <- 10*x*x*rgamma(200,3) > med.y <- median(y.compl) > cens <- ifelse(y.compl<=med.y,1,0) > y <- cens * y.compl + (1-cens)*med.y > library(locfit) > m <- locfit(y~x,cens=cens,family="gamma") /usr/local/src/R-0.61.1/bin/R.binary: can't
2011 Jun 20
1
requesting a mentor for R development
...g R functions & packages and then submitting proposed patches to the R Core team. Would someone be willing to mentor me through one example? For starters, consider an example. I'd like to revise the t.test function to return the stderr value to the user. We only need to change the "rval" in the third-from-the end line of stats:::t.test.default. Change this: rval <- list(statistic = tstat, parameter = df, p.value = pval, conf.int = cint, estimate = estimate, null.value = mu, alternative = alternative, method = method, data.name = dname) class(rval) &l...
2015 Feb 26
3
iterated lapply
...have to be changed to parent.frame(8) for that to work. Such code looks pretty ugly to me but seems to be rare.) It also seems to cause problems with some built-in functions: newlapply <- function (X, FUN, ...) { FUN <- match.fun(FUN) if (!is.list(X)) X <- as.list(X) rval <- vector("list", length(X)) for (i in seq(along = X)) { rval[i] <- list(local({ i <- i FUN(X[[i]], ...) })) } names(rval) <- names(X) return(rval) } newlapply(1:2,log) #Error in FUN(X[[i]], ...) : non-numeric argument to...
2002 Mar 19
1
should lapply preserve attributes?
I have an application where I need to preserve object attributes across calls to 'lapply'. The current definition is: lapply <- function (X, FUN, ...) { FUN <- match.fun(FUN) if (!is.list(X)) X <- as.list(X) rval <- .Internal(lapply(X, FUN)) names(rval) <- names(X) return(rval) } Would it make sense to replace names(rval) <- names(X) with attributes(rval) <- attributes(X) ?? I can, of course, make a local function for this, but wondered if this change would be useful in general....
2007 May 30
1
Sort in ecdf
...the ecdf() R code (R ver. 2.5.0) contains two call to sort: --- [R-code] --- ecdf <- function(x) x <- sort(x) n <- length(x) if (n < 1) stop("'x' must have 1 or more non-missing values") vals <- sort(unique(x)) rval <- approxfun(vals, cumsum(tabulate(match(x, vals)))/n, method = "constant", yleft = 0, yright = 1, f = 0, ties = "ordered") class(rval) <- c("ecdf", "stepfun", class(rval)) attr(rval, "call") <- sys.call() rv...
2011 Apr 23
2
[LLVMdev] copy instructions
...= left->codeGen(); >  Value *r = right->codeGen(); >  Value *result = new TempValue;  // get unique temporary >  emit(result->str() + " add " + l->str() + ", " r-str()); >  return result; > } > > Value *assignExpression::codeGen() { >  Value *rval = rvalue->codeGen(); >  Value *lval = new NameValue(ident); >  emit(lval->str() + " = " + rval->str());    // emit (silly) copy instruction >  return lval; > } > > What I have suggested to my students is to omit the (non-existent) copy instruction > and use t...
2011 Apr 23
0
[LLVMdev] copy instructions
...= left->codeGen(); >  Value *r = right->codeGen(); >  Value *result = new TempValue;  // get unique temporary >  emit(result->str() + " add " + l->str() + ", " r-str()); >  return result; > } > > Value *assignExpression::codeGen() { >  Value *rval = rvalue->codeGen(); >  Value *lval = new NameValue(ident); >  emit(lval->str() + " = " + rval->str());    // emit (silly) copy instruction >  return lval; > } > > What I have suggested to my students is to omit the (non-existent) copy instruction > and use t...
2015 Feb 24
2
iterated lapply
...ific enough on the indented semantics in > this situation to consider this a bug. The original R-level > implementation of lapply was > > lapply <- function(X, FUN, ...) { > FUN <- match.fun(FUN) > if (!is.list(X)) > X <- as.list(X) > rval <- vector("list", length(X)) > for(i in seq(along = X)) > rval[i] <- list(FUN(X[[i]], ...)) > names(rval) <- names(X) # keep `names' ! > return(rval) > } > > and the current internal implementation is consistent w...
2010 Oct 31
1
biglm: how it handles large data set?
...)) stop("`weights' must be a formula") w <- model.frame(weights, data)[[1]] } else w <- NULL mf <- model.frame(tt, data) mm <- model.matrix(tt, mf) qr <- bigqr.init(NCOL(mm)) qr <- update(qr, mm, model.response(mf), w) rval <- list(call = sys.call(), qr = qr, assign = attr(mm, "assign"), terms = tt, n = NROW(mm), names = colnames(mm), weights = weights) if (sandwich) { p <- ncol(mm) n <- nrow(mm) xyqr <- bigqr.init(p * (p + 1)) xx <- matrix...
2010 Jul 02
2
unable to get bigglm working, ATTN: Thomas Lumley
...00 -0.100 11 0 the code is: make.data <- function (filename, chunksize, ...) { conn<-NULL; function (reset=FALSE) { if (reset) { if (!is.null(conn)) { close(conn); }; conn <<- file (description=filename, open="r"); } else { rval <- read.table (conn, nrows=chunksize,sep=' ', skip=0, header=FALSE,...); if (nrow(rval)==0) { close(conn); conn<<-NULL; rval<-NULL; } else { rval$relage <- rval$loctime/rval$term; }; return(rval);...
2015 Feb 24
3
iterated lapply
From: Daniel Kaschek <daniel.kaschek at physik.uni-freiburg.de> > ... When I evaluate this list of functions by > another lapply/sapply, I get an unexpected result: all values coincide. > However, when I uncomment the print(), it works as expected. Is this a > bug or a feature? > > conditions <- 1:4 > test <- lapply(conditions, function(mycondition){ >
2001 Jun 14
1
expand.model.frame() fails when subset is specified (PR#979)
...R/expand.model.frame.R Mon Jun 11 16:30 :51 2001 --- /home/warneg/R-src/R-1.2.3/src/library/base/R/expand.model.frame.R Mon Jun 11 16:30:51 2001 *************** *** 18,27 **** if (!na.expand){ naa <- model$call$na.action subset <- model$call$subset ! rval <- model.frame(ff, data=data, subset=subset, na.action=naa) } else { subset <- model$call$subset ! rval <- model.frame(ff, data=data, subset=subset, na.action=I) oldmf <- model.frame(model) keep <- match(rownames(oldmf), rownames(rval))...
2012 Feb 13
1
survey package svystat objects from predict()
...SE 1 1.850412 0.2413889 2 1.681429 0.2413889 3 1.512447 0.2413889 I think what's happening is that as.data.frame.svystat() method in the survey package ends up calling the wrong function to calculate the standard errors. From the survey package: as.data.frame.svystat<-function(x,...){ rval<-data.frame(statistic=coef(x),SE=SE(x)) names(rval)[1]<-attr(x,"statistic") if (!is.null(attr(x,"deff"))) rval<-cbind(rval,deff=deff(x)) rval } The relevant SE method seems to be: SE.svrepstat<-function(object,...){ if (is.list(object)){ object<...
2007 Apr 12
0
Branch 'as' - 15 commits - libswfdec/swfdec_as_context.c libswfdec/swfdec_as_context.h libswfdec/swfdec_as_frame.c libswfdec/swfdec_as_frame.h libswfdec/swfdec_as_function.c libswfdec/swfdec_as_function.h libswfdec/swfdec_as_interpret.c
...1], &max)) - return JS_FALSE; + val = swfdec_as_stack_peek (cx->frame->stack, 1); + max = swfdec_as_value_to_integer (cx, val); if (max <= 0) - result = 0; + SWFDEC_AS_VALUE_SET_NUMBER (val, 0); else - result = g_random_int_range (0, max); - - return JS_NewNumberValue(cx, result, &cx->fp->sp[-1]); + SWFDEC_AS_VALUE_SET_NUMBER (val, g_rand_int_range (cx->rand, 0, max)); } +#if 0 static void swfdec_action_old_compare (SwfdecAsContext *cx, guint action, const guint8 *data, guint len) { @@ -2159,8 +2158,10 @@ const SwfdecActionSpec swfdec_as_...
2011 Apr 23
0
[LLVMdev] copy instructions
... Value *r = right->codeGen(); >>  Value *result = new TempValue;  // get unique temporary >>  emit(result->str() + " add " + l->str() + ", " r-str()); >>  return result; >> } >> >> Value *assignExpression::codeGen() { >>  Value *rval = rvalue->codeGen(); >>  Value *lval = new NameValue(ident); >>  emit(lval->str() + " = " + rval->str());    // emit (silly) copy >> instruction >>  return lval; >> } >> >> What I have suggested to my students is to omit the (non-existent...