similar to: getting variable names from formula

Displaying 20 results from an estimated 20000 matches similar to: "getting variable names from formula"

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
2005 Mar 29
1
improved pairs.formula?
Dear all, I would like to suggest changing the pairs.formula command such that a command like pairs(GNP ~ . - Year - GNP.deflator, longley) would behave in a similar fashion as lm(GNP ~ . - Year - GNP.deflator, longley) i.e., make a pairwise scatterplot of GNP and all other variables in the (longley) dataframe except for Year and GNP.deflator. The above command, with the
2004 Aug 28
6
model.matrix.default chokes on backquote (PR#7202)
Full_Name: Gabor Grothendieck Version: R version 1.9.1, 2004-08-03 OS: Windows XP Submission from: (NULL) (207.35.143.52) The following gives an error: > `a(b)` <- 1:4 > `c(d)` <- (1:4)^2 > lm(`a(b)` ~ `c(d)`) Error in model.matrix.default(mt, mf, contrasts) : model frame and formula mismatch in model.matrix() To fix it replace this line in model.matrix.default:
2010 Aug 05
2
linear model with similar response predictor
Hi, can somebody tell me why R is not able to calculate a linear model written in this way? > lm (seq(1:100)~seq(1:100)) Call: lm(formula = seq(1:100) ~ seq(1:100)) Coefficients: (Intercept) 50.5 Warning messages: 1: In model.matrix.default(mt, mf, contrasts) : the response appeared on the right-hand side and was dropped 2: In model.matrix.default(mt, mf, contrasts) : problem
2013 Nov 06
3
Basic question: why does a scatter plot of a variable against itself works like this?
Hello all, I just noticed the following behavior of plot: x <- c(1,2,9) plot(x ~ x) # this is just like doing: plot(x) # when maybe we would like it to give this: plot(x ~ c(x)) # the same as: plot(x ~ I(x)) I was wondering if there is some reason for this behavior. Thanks, Tal ----------------Contact Details:------------------------------------------------------- Contact me:
2009 Aug 08
2
Problem using model.frame with argument subset in own function
Dear List, I am writing a formula method for a function in a package I maintain. I want the method to return a data.frame that potentially only contains some of the variables in 'data', as specified by the formula. The problem I am having is in writing the function and wrapping it around model.frame. Consider the following data frame: dat <- data.frame(A = runif(10), B = runif(10), C
2017 Aug 03
2
rnorm is not truly random used in the lm function
To whom it may concern, I happened to run the following R code just to check the layout of the output, but found that the code doesn't work the way I thought it should work. '' > lm(rnorm(100) ~ rnorm(100)) Call: lm(formula = rnorm(100) ~ rnorm(100)) Coefficients: (Intercept) -0.07966 Warning messages: 1: In model.matrix.default(mt, mf, contrasts) : the response appeared
2005 Jan 24
2
using eval() with pre-built expression inside function
I'm trying to evaluate a pre-built expression using eval(), e.g. dataset <- data.frame(y = runif(30, 50,100), x = gl(5, 6)) # one like this mf <- expression(model.frame(y~x)) eval(mf, dataset, parent.frame()) # rather than this eval(expression(model.frame(y~x)), dataset, parent.frame()) In the example above there is no problem, the problem comes when I try to do a similar thing
2006 Apr 11
1
Time Series information in formulae
Dear List The UKgas data is stored as an object of class 'ts'. I am trying to use "UKgas" in a formula as argument to a function. However, I do not know how to access the 'time series' information in the response (such as start() end() etc.). Here is a boiled down example. ssm <- function(formula, data = list(),subset=NULL) { cl <- match.call() if
2013 Apr 12
2
model frame and formula mismatch in model.matrix()
Hello everyone, I am trying to fit the following model All X. variables are continuous, while the conditions are categoricals. model <- lm(X2
2011 Jul 13
1
question on formula and terms.formula()
I'm trying to create a formula object to pass on to a function that applies the function terms.formula() to it. f <- function(formula, ...) { ... mf <- match.call() term <- terms.formula(mf$formula) ... } However, my code below gives an error. form <- as.formula("y~x") f(form, ...) The error message was: Error in terms.formula(mf$formula): argument is not a valid
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
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 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
2009 Sep 05
4
[LLVMdev] omission: clang-cc -MD -MF -c -fPIC
Hi, I do not really have much direct control over the compile lines any more. I guess I could code up a wrapper for your wrapper so that the libtool wrapper would be happy, but could you all consider libtool built projects and embed the necessary option stripping in your clang-cc thing? Thank you. Regards, Bruce make[2]: Entering directory `/home/bkorb/ag/ag/snprintfv' /bin/sh ../libtool
2004 Dec 29
5
spandsp-0.0.2pre6
Just wondering if anyone else has managed to successfully compile spandsp-0.0.2pre6... I'm assuming it is working for most people, else it probably wouldn't have been released, and/or, other people would have had more to say about it... In any case, these are the errors I am getting while doing a make: if /bin/sh ../libtool --mode=compile gcc -DHAVE_CONFIG_H -I. -I. -I. -I -g -O2 -MT
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/
2011 Apr 09
2
Strange libtool problem
I'm not sure if this is related to me updating to gcc 4.6.0 or not, but in the gnulib/lib directory I get an error which comes down to the following libtool command running: $ ../../libtool --tag=CC --mode=compile gcc -std=gnu99 -std=gnu99 -DHAVE_CONFIG_H -I. -I../.. -g -O2 -MT c-ctype.lo -MD -MP -MF .deps/c-ctype.Tpo -c -o c-ctype.lo c-ctype.c ../../libtool: line 2075: c-ctype.c: command not
2009 Apr 16
1
[LLVMdev] OpenMPI and llvm-gcc
Hi, I was wondering whether or not MPI-libraries are expected to work with llvm-gcc? I tried to compile openmpi-1.3 using the llvm-gcc4.2-2.5-x86-darwin9 distribution on my MacBook Pro running OS 10.5.6. Installation using the gcc (gcc version 4.0.1 (Apple Inc. build 5490)) worked well. But for the llvm-gcc I get the following error message (during the make): > .... > Making all
2009 Dec 07
2
xapain install
Hi, I am trying to isntall Xapain. I run $./cofigure optionand then I rune make, but it echos following message in infinite loop. Is there anything wrong? How to correct? --------------------------------- /bin/sh ./libtool --tag=CXX --mode=compile g++ -DHAVE_CONFIG_H -I. -I./common -I./include -Wall -W -Wredundant-decls -Wpointer-arith -Wcast-qual -Wcast-align -Wno-long-long