similar to: using eval() with pre-built expression inside function

Displaying 20 results from an estimated 10000 matches similar to: "using eval() with pre-built expression inside function"

2009 Feb 25
2
[R] length 1 offset in glm (& lm)
This post about length 1 offsets on R help seems to have been ignored (sorry deleted original email - is there a way to continue thread in this case?) https://stat.ethz.ch/pipermail/r-help/2009-February/189352.html It does seem to be a bug, in that glm does not behave as documented. In fact the same bug applies to lm as well. I don't think the suggested fix works though - Y isn't
2006 Jan 10
2
standardized residuals (rstandard & plot.lm) (PR#8468)
This bug is not quite fixed - the example from my original report now = works using R-2.2.1, but plot(Uniform, 6) does not. The bug is due to if (show[6]) { ymx <- max(cook, na.rm =3D TRUE) * 1.025 g <- hatval/(1 - hatval) # Potential division by zero here # plot(g, cook, xlim =3D c(0, max(g)), ylim =3D c(0, ymx),=20 main =3D main, xlab =3D
2007 Feb 10
1
how to eval subset?
Hi, I have problems with subset when calling a function from inside a function from inside a function. Here is a small example to be called as 'f1()'. 'eval()' in f3 fails with error message Error in eval(expr, envir, enclos) : object "subs" not found Is it possible to supplement subset to data, to be calculated in a different environment than the data itself? Thanks
2008 Feb 13
1
stumped by eval
In the following example, the inner evaluation pulls in the global value of subset (a function) rather than the one I thought I was passing in (a vector). Can anyone help me understand what's going on, and what I need to do to fix the problem? f0 <- function(formula, data, subset, na.action ) { f1(formula, data, subset,
2008 May 09
1
str and class
In previous versions of the gnm package, the terms component of "gnm" objects had a "classID" attribute. This caused problems when used with str as the following simple example illustrates: > x <- 1 > attr(x, "classID") <- "type1" > str(x) Class 'type1' Class 'type1' Class 'type1' Class 'type1' Class
2004 Oct 05
2
Package Installation in RGui (PR#7262)
Full_Name: Heather Turner Version: 2.0.0 OS: Windows NT Submission from: (NULL) (137.205.8.2) I tried using the Packages menu to install the gam package and get the following output: > local({a <- CRAN.packages() + install.packages(select.list(a[,1],,TRUE), .libPaths()[1], available=a, dependencies=TRUE)}) trying URL `http://cran.r-project.org/bin/windows/contrib/2.0/PACKAGES' Content
2004 Dec 13
3
Advice on parsing formulae
Dear list I would like to be able to group terms in a formula using a function that I will call tvar(), eg. the formula Y ~ 1 + tvar(x:A) + tvar(z) + u + tvar(B) + tvar(poly(v,3)) where x,u and v are numeric and A and B are factors - binary, say. As output, I want the model.matrix as if tvar had not been there at all. In addition, I would like to have information on the grouping, as a vector
2009 Feb 12
3
proposed simulate.glm method
I have found the "simulate" method (incorporated in some packages) very handy. As far as I can tell the only class for which simulate is actually implemented in base R is lm ... this is actually a little dangerous for a naive user who might be tempted to try simulate(X) where X is a glm fit instead, because it defaults to simulate.lm (since glm inherits from the lm class), and the
2005 Oct 12
1
Using matprod from array.c
Hi, I was wondering if I could use the matprod function from array.c in my own C routine. I tried the following as a test /* my_matprod.c */ # include <Rinternals.h> /* for REAL, SEXP etc */ # include <R_ext/Applic.h> /* array.c says need for dgemm */ /* following copied from array.c */ static void matprod(double *x, int nrx, int ncx, double *y, int nry, int ncy, double *z)
2007 Feb 14
1
predict.lm point forecasts with factors
hello, I am trying to use predict.lm to make point forecasts based on a model with continuous and categorical independent variables I have no problems fitting the model using lm, but when I try to use predict to make point predictions. it reverts back to the original dataframe and gives me the point predictions for the fitted data rather than for the new data, I imagine that I am missing
2006 Dec 14
3
Model formula question
Hi all, I'm not familiar with R programming and I'm trying to reproduce a result from a paper. Basically, I have a dataset which I would like to model in terms of successive increments, i.e. (y denote empirical values of y) y_1 = y1, y_2 = y1 + delta1, y_3 = y1 + delta1 + delta2. ... y_m = y1 + sum_2^m delta j where delta_j donote successive increments in the y-values, i.e. delta
2005 Oct 03
1
storage.mode, C data types and speed
Hi, I am trying to speed up part of an algorithm in which certain columns of a large matrix (X) are replaced by the element-wise product of a matrix (M) and a vector (v). In R, the code might be X[, ind] <- M * v I have written a small C routine to do this for me, but the timing depends on how I define the storage.mode of the objects in R and the data types in C, in a way which I don't
2006 Jan 18
2
Loading of namespace on load of .Rdata (was strange behaviour of load)
Last week Giovanni Parrinello posted a message asking why various packages were loaded when he loaded an .Rdata file. Brian Ripley replied saying he thought it was because the saved workspace contained a reference to the namespace of ipred. (Correspondence copied below). This begs the question: how did the reference to the namespace of ipred come to be in the .Rdata file? Brian did say it is
2005 Dec 06
1
standardized residuals (rstandard & plot.lm) (PR#8367)
Full_Name: Heather Turner Version: 2.2.0 OS: Windows XP Submission from: (NULL) (137.205.240.44) Standardized residuals as calculated by rstandard.lm, rstandard.glm and plot.lm are Inf/NaN rather than zero when the un-standardized residuals are zero. This causes plot.lm to break when calculating 'ylim' for any of the plots of standardized residuals. Example:
2013 Jan 29
3
how to suppress the intercept in an lm()-like formula method?
I'm trying to write a formula method for canonical correlation analysis, that could be called similarly to lm() for a multivariate response: cancor(cbind(y1,y2,y3) ~ x1+x2+x3+x4, data=, ...) or perhaps more naturally, cancor(cbind(y1,y2,y3) ~ cbind(x1,x2,x3,x4), data=, ...) I've adapted the code from lm() to my case, but in this situation, it doesn't make sense to include an
2002 Nov 01
1
init.data function error
We had been using R1.2.3 "print tip lowess function" as described by Terry Speed's group to normalize microarray data and up until this week the commands we were using were working fine. First, we load our data using arrayname<-read.table("filename", header=T) and then check that the table is OK. We format the data list using setup1<-init.data() and usually get a
2005 Jan 12
4
"model.response" error
When I installed R 2.0.1 (replacing 1.9.0) for Windows, a code using "model.response" began acting up. Here are the first several lines of a code I had been tweaking for a spatial model (the code is mostly that of Roger Bivand--I am adapting it to a slightly different data structure and the problem I'm sure is with my changes, not his code). <command name> <- function
2010 Jun 04
2
[LLVMdev] build errors while cross compiling llvm-gcc for ARM
I'm getting following errors while cross compiling llvm for ARM. Please help since it is urgent and critical My gcc version is 4.2.0, 32bit Linux and target is ARM Configure options are: ./configure --host=i686-pc-linux-gnu --build=i686-pc-linux-gnu --target=armv7fl-montavista-linux-gnueabi --enable-cross --with-sysroot=/home//arm_v7_vfp_le/target/
2005 Mar 14
1
Problem Compiling Spandsp
Sirs, I can't compile the source spandsp-0.0.2pre10; when i try to do the "make" sentence the following errors appear: # make Making all in src make[1]: Entering directory `/export/usr/src/spandsp-0.0.2/src' make all-am make[2]: Entering directory `/export/usr/src/spandsp-0.0.2/src' if /bin/sh ../libtool --mode=compile gcc -DHAVE_CONFIG_H -I. -I. -I. -I -g -O2 -MT
2007 Mar 09
1
Applying some equations over all unique combinations of 4 variables
#I have a data set that looks like this. A bit more complicated actually with # three factor levels but these calculations need to be done on one factor at a #I then have a set of different rates that are applied #to it. #dataset cata <- c( 1,1,6,1,1,2) catb <- c( 1,2,3,4,5,6) doga <- c(3,5,3,6,4, 0) data1 <- data.frame(cata, catb, doga) rm(cata,catb,doga) data1 # start rates #