Displaying 20 results from an estimated 900 matches similar to: "as.character and a formula"
2010 Jan 13
3
counting the number of times a string appears
Hi all,
I have a vector of strings and need to count the number of times a string
appears in the vector.
eg:
[1] spp6 spp10 spp6 spp6 spp4 spp2 spp9 spp10 spp5 spp2 spp2 spp3
[13] spp4 spp3 spp6 spp10 spp6 spp4 spp9 spp3 spp6 spp1 spp10 spp8
[25] spp2 spp10 spp9 spp7 spp1 spp3 spp8 spp6 spp3 spp8 spp6 spp5
[37] spp5 spp9 spp3 spp1 spp4 spp5 spp9 spp3
2004 Mar 10
3
Center labels on a boxplot
Suppose that I have data on three species for a variable and datasets
from two time periods. I want to make a boxplot of the first dataset and
then add the second using 'at = ' and 'add = T' as in the example for
'boxplot.'
Since the boxes are paired by species, I want to do is have the x labels
be centered between the boxes. I'm doing this now with mtext and
entering
2005 Aug 16
2
problem using model.frame()
Hi I'm having a problem with model.frame, encapsulated in this example:
y1 <- matrix(c(3,1,0,1,0,1,1,0,0,0,1,0,0,0,1,1,0,1,1,1),
nrow = 5, byrow = TRUE)
y1 <- as.data.frame(y1)
rownames(y1) <- paste("site", 1:5, sep = "")
colnames(y1) <- paste("spp", 1:4, sep = "")
y1
model.frame(~ y1)
Error in model.frame(formula, rownames,
2005 Jul 01
1
scope argument in step function
Thanks a lot for help in advance. I am switching from matlab to R and I guess I need some time to get rolling. I was wondering why this code :
> fit.0 <- lm( Response ~ 1, data = ds3)
> step(fit.0,scope=list(upper=~.,lower=~1),data=ds3)
Start: AIC= -32.66
Response ~ 1
Call:
lm(formula = Response ~ 1, data = ds3)
Coefficients:
(Intercept)
1.301
is not working
2012 Feb 28
2
update.formula has 512 char buffer?
Hello,
I am trying to "paste" together a formula to use in the mob function of
party. This means the formula will be of the form y ~ x1+ ...+xM | z1+..zN.
I am doing some preliminary fits of y ~ x1+ ...+xM, then want to add the
conditional part of the equation using update().
Here's the test code:
var1 <- 1:78
x1 <- paste("x", var1, sep="")
f1 <-
2019 Sep 05
2
ARM vectorized fp16 support
Hi,
I'm trying to compile half precision program for ARM, while it seems
LLVM fails to automatically generate fused-multiply-add instructions
for c += a * b. I'm wondering whether I did something wrong, if not,
is it a missing feature that will be supported later? (I know there're
fp16 FMLA intrinsics though)
Test programs and outputs,
$ clang -O3 -march=armv8.2-a+fp16fml
2011 Dec 19
1
pls help to print out first row of terms(model) output in example program
Greetings.
I've written a convenience function for multicollinearity diagnosis.
I'd like to report to the user the formula that is used in a
regression. I get output like this:
> mcDiagnose(m1)
[1] "The following auxiliary models are being estimated and returned in a list:"
[1] "`x1` ~ ."
formula(fmla)()
[1] "`x2` ~ ."
I'd like to fill in the period
2012 Jan 25
4
formula error inside function
I want use survfit() and basehaz() inside a function, but it doesn't work.
Could you take a look at this problem. Thanks for your help. Following is my
codes:
library(survival)
n <- 50 # total sample size
nclust <- 5 # number of clusters
clusters <- rep(1:nclust,each=n/nclust)
beta0 <- c(1,2)
set.seed(13)
#generate phmm data set
Z <- cbind(Z1=sample(0:1,n,replace=TRUE),
2003 Oct 02
4
using a string as the formula in rlm
Hi,
I am trying to build a series of rlm models. I have my data frame and
the models will be built using various coulmns of the data frame.
Thus a series of models would be
m1 <- rlm(V1 ~ V2 + V3 + V4, data)
m2 <- rlm(V1 ~ V2 + V5 + V7, data)
m3 <- rlm(V1 ~ V2 + V8 + V9, data)
I would like to automate this. Is it possible to use a string in place
of the formula?
I tried doing:
fmla
2019 Sep 05
2
ARM vectorized fp16 support
Thanks for reply. I was using LLVM 8.0. Let me try trunk and will let
you know if it works.
On Wed, Sep 4, 2019 at 11:19 PM Sjoerd Meijer <Sjoerd.Meijer at arm.com> wrote:
>
> Hi,
> Which version of Clang are you using? I do get a "vfma.f16" with a recent trunk build. I haven't looked at older versions and when this landed, but we had an effort to plug the remaining
2008 Aug 29
1
nls() fails on a simple exponential fit, when lm() gets it right?
Dear R-help,
Here's a simple example of nonlinear curve fitting where nls seems to get
the answer wrong on a very simple exponential fit (my R version 2.7.2).
Look at this code below for a very basic curve fit using nls to fit to (a)
a logarithmic and (b) an exponential curve. I did the fits using
self-start functions and I compared the results with a more simple fit
using a straight lm()
2016 May 13
2
A question about AArch64 Cortex-A57 subtarget definition
Hello everybody,
I'm reading the .td files defining the Cortex-A57 processor,
which is a subtarget of AArch64 target, and there is something
confusing me in the `AArch64SchedA57.td` file.
In the top of `AArch64SchedA57.td`, various processor resource are
defined, as follows
```
def A57UnitB : ProcResource<1>; // Type B micro-ops
def A57UnitI : ProcResource<2>; // Type
2005 Jul 20
1
aregImpute in Hmisc
Hi,
I have a dataframe ds1.2 - 503 categorial variables
and 1 continuous response variables. I ran aregImpute
to deal with NA's and got the followig error:
> fmla = terms( Response ~ . ,data=ds1.2)
> ds.i = aregImpute(fmla,data=ds1.2)
Error in matrix(as.double(1), nrow = n, ncol = p,
dimnames = list(rnam, :
length of dimnames [2] not equal to array
extent
Could you explain
2003 Mar 02
1
model.frame.default problem in function definition
Could someone point me in the right direction for the following issue:
A function is defined as follows:
tfun <- function(dat)
{
fmla <- as.formula("y~x+z")
dat2 <- dat
mdl <- lm(fmla,dat2)
mdl <- step(mdl)
}
Then the following code
dat <- data.frame(x=1:10,z=1:10,y=(1:10)^2+10*(1:10))
tfun(dat)
generates the output
Start: AIC= 43.67
2006 May 24
1
Problem with pasteing formulas (PR#8897)
Hi,
If I create a formula with say 100 terms and then paste it:
xnam <- paste("x", 1:100, sep="")
fmla <- as.formula(paste("y ~ ", paste(xnam, collapse= "+")))
paste(fmla)
The result seems to cut off everything after the first 500 characters
and gives no warning message.
I have the most recent version of R from the R website and the problem
occurs
2005 Jun 24
1
"Error in contrasts" in step wise regression
Hi,
I have a problem in getting step function work. I am getting the following error:
> fit1 <- lm(Response~1)
> fmla <- as.formula(paste(" ~ ",paste(colnames,collapse="+")))
> sfit <- step(fit1,scope=list(upper= fmla,lower= ~1),k=log(nrow(dat)))
Start: AIC= -1646.66
Response ~ 1
Error in "contrasts<-"(`*tmp*`, value =
2012 May 29
3
trouble automating formula edits when log or * are present; update trouble
Greetings
I want to take a fitted regression and replace all uses of a variable
in a formula. For example, I'd like to take
m1 <- lm(y ~ x1, data=dat)
and replace x1 with something else, say x1c, so the formula would become
m1 <- lm(y ~ x1c, data=dat)
I have working code to finish that part of the problem, but it fails
when the formula is more complicated. If the formula has log(x1)
2010 Dec 26
1
Calculation of BIC done by leaps-package
Hi Folks,
I've got a question concerning the calculation of the Schwarz-Criterion
(BIC) done by summary.regsubsets() of the leaps-package:
Using regsubsets() to perform subset-selection I receive an regsubsets
object that can be summarized by summary.regsubsets(). After this
operation the resulting summary contains a vector of BIC-values
representing models of size i=1,...,K.
My problem
2005 Apr 29
2
Automating plot labelling in custom function in lapply() ?
Dear List,
Consider the following example:
dat <- data.frame(var1 = rnorm(100), var2 = rnorm(100),
var3 = rnorm(100), var4 = rnorm(100))
oldpar <- par(mfrow = c(2,2), no.readonly = TRUE)
invisible(lapply(dat,
function(x) {
plot(density(x),
main = deparse(substitute(x))) }
)
)
2007 Nov 26
1
mvr error in PLS package
All,
I have been using a data set to build pls models for three different soil properties. Two of the three models run fine; however I receive the following error for the final model.
> libs.IC.cal <- mvr(libs.IC.fmla, data = libsdata.cond.cal, ncomp=20,validation = "LOO", method = "oscorespls")
Error in colMeans(x, n, prod(dn), na.rm) :
'x' must