Displaying 20 results from an estimated 6000 matches similar to: "Environment of a formula"
2003 Nov 07
1
xyplot
Dear all,
I am trying to use xyplot inside a function
plotme<-function(dataframe)
{
xyplot(x~y|z,data=dataframe)
}
x,y,z are members of the data frame.
When calling function
library(lattice)
plotme(dataframe)
nothing happens. (R-1.8.0, SuSe Linux 8.1)
What am I doing wrong? Many thanks in advance
Peter
2003 Jun 16
2
extension to plot.formula?
Could I suggest the following extension to plot.formula:
plot(cbind(y1,y2) ~ x, ...)
should plot (y1 against x) and (y2 against x) on the same plot.
The default y axis limits would be determined by the range of c(y1,y2).
This would be pretty handy sometimes, replacing 4 lines of code.
The current plot.formula evaluates cbind(y1,y2), which is a matrix,
so plot.formula looks for
2005 Jun 03
2
dot in formula
gReetings,
I want to manipulate a formula object, containing the name "."
so that "." is replaced by a desired (arbitrary) expression.
What is a safe way to do this?
Adrian Baddeley
2011 Jan 26
1
aggregate(as.formula("some formula"), data, function) error when called from in a function
I'm having a problem with aggregate.formula when I call it in a function and the function is converted from a string in the funtion
I think my problem may also only occur when the left hand side of the formula is cbind(...)
Here is example code that generates a dataset and then the error.
The first function "agg2" fails
> agg2(FALSE)
do agg 2
Error in m[[2L]][[2L]] : object
2006 Nov 29
1
Removing terms from formula
R-help,
Given a simple linear model, say lm(x ~ y + z), I would like to remove
model terms that are factors with only one level. Thus, if 'z' were a
factor with only one level, lm(x ~ y + z) becomes lm(x ~ y + 1).
Likewise, if both 'y' and 'z' are one-level factors, then the resulting
calculation is simply lm(x ~ 1).
Unfortunately, I have not been able to come up with an
2006 Jun 20
1
changes to terms.formula in 2.3.x
Hi, all,
I just recently noticed a change in terms.formula from 2.2.1 to 2.3.1
(possibly 2.3.0, but I didn't check). Here's the problem:
## 2.2.1
> update(~ x | y, z ~ .)
z ~ x | y
## 2.3.1
> update(~ x | y, z ~ .)
z ~ (x | y)
and in the NEWS for 2.3.1
o terms.formula needed to add parentheses to formulae with
terms containing '|'. (PR#8462)
So, there must be
2005 Aug 03
2
hash code for arbitrary object
Can anyone suggest a simple way to calculate a 'hash code'
from an arbitrary R object?
hash(x) should return an integer or string
with the property that
if hash(x) != hash(y) then x and y are not identical
and the time to compute hash(x) should be quite short.
Any suggestions welcome
thanks
Adrian Baddeley
2011 Mar 25
0
Bounding ellipse for any set of points
After a lot of effort I developed the following function to compute the
bounding ellipse (also known a as minimum volume enclosing ellipsoid) for
any set of points. This script is limited to two dimensions, but I believe
with minor modification the algorithm should work for 3 or more dimensions.
It seems to work well (although I don't know if can be optimized to run
faster) and
2006 May 23
2
nls: formula error?
So thanks for the help,
I have a matrix (AB) which in the first column has my bin numbers so -4 - +4
in 0.1 bin units. Then I have in the second column the frequency from some
data. I have plotted them and they look roughly Gaussian. So I want to fit
them/ find/optimize "mu", "sigma", and "A".
So I call the nls function :
nls_AB <- nls(x ~ (A/sig*sqrt(2*pi))*
2003 Jun 17
0
plot.formula
Thanks to Andy Liaw and Baz
for alternatives to tinkering with plot.formula
to get
plot(cbind(y1,y2) ~ x, ...)
to work.
However...
> From: "Liaw, Andy" <andy_liaw at merck.com>
matplot(x, cbind(y1, y2), ...)
> From: Barry Rowlingson <B.Rowlingson at lancaster.ac.uk>
xyplot(y1+y2~x,data=xyy,allow.multiple=T)
The former requires separate code for the
2004 Dec 03
4
factor matrix
Sorry if this is a FAQ.
Is there a good reason why a factor has to be
a one-dimensional vector and cannot be a matrix?
I want to construct matrices of categorical values.
Vain attempts like
matrix(factor(c(T,F,F,T), 2,2)
yield a matrix of character strings representing the factor levels,
not the levels themselves, while
factor(matrix(c(T,F,F,T), 2,2))
converts the matrix to a
2005 Jun 16
3
Excel files first row not being read
hi,
i am using the RODBC package to read excel files using
odbcConnectExcel and susequently sqlFetch to read the contents of the
file.
the file that i use is just a matrix of numbers thats all. no headers
and column names. what happens is that the sqlFetch is not reading my
first row of numbers.
i have tried different combinations of colnames and rownames logical
values but that first row is not
2014 Jul 30
2
listof
Dear R developers
A question about the class 'listof', defined in package 'stats'.
Other than its definition and use in the code for 'anova',
we can't see that the class 'listof' is used for anything else
(in recommended packages, or elsewhere).
In the spatstat package we have been using a 'listof'
to represent a list of spatial objects of the same
2011 Jul 21
0
Bounding ellipse for any set of points
The mvee() function is intended to be released under the BSD license.
Copyright (c) 2009, Nima Moshtagh
Copyright (c) 2011, Andy Lyons
All rights reserved.
http://www.opensource.org/licenses/bsd-license.php
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
Redistributions of source code must
2011 Nov 13
1
Myriam Saavedra M. Sc. Questions about maximun radius distance
Dear Mr. Baddeley
I just graduated from a Masters in Applied Mathematics on Jun19th. My thesis was about spatial distribution /a nalysis of some trees in a part of the Congo Basic Forest.
In my thesis I used your spatial package in R, and today I'm doing a more deeper study about how we choise the r distance in Function F(). I would like to
be able to understand about value of rmaxdefault
2005 May 20
5
Dell PowerEdge SC420 for Office Implementation???
I was wondering how the Dell SC420 will perform under normal office to
office communications. We would equip each server with a T1 card to make
office to office SIP calls. They will integrate into our existing PBX
systems.
Does anyone on this list use this hardware currently????
Thanks!
2005 Dec 09
1
O-ring statistic
Rainer M Krug writes:
> Thorsten Wiegand used in his paper Wiegand T., and K. A. Moloney 2004.
> Rings, circles and null-models for point pattern analysis in ecology.
> Oikos 104: 209-229 a statistic he called O-Ring statistic which is
> similar to Ripley's K, only that it uses rings instead of circles.
>
> http://www.oesa.ufz.de/towi/towi_programita.html#ring
2006 Aug 24
3
generating an expression for a formula automatically
Hi!
I would like to be able to create formulas automatically. For example, I
want to be able to create a function that takes on two values: resp and
x, and then creates the proper formula to regress resp on x.
My code:
fit.main <- function(resp,x) {
form <- expression(paste(resp," ~ ",paste(x,sep="",collapse=" + "),sep=""))
z <-
2013 Sep 19
1
Vignette problem and CRAN policies
Hello, All:
The vignette with the sos package used "upquote.sty", required for R
Journal when it was published in 2009. Current CRAN policy disallows
"upquote.sty", and I've so far not found a way to pass "R CMD check"
with sos without upquote.sty.
I changed sos.Rnw per an email exchange with Prof. Ripley without
solving the problem; see below. The
2005 Jan 27
7
getting package version inside .First.lib
Greetings -
Is it possible, inside .First.lib,
to find out the version number of the package that is being loaded?
If only one version of the package has been installed,
we could scan the DESCRIPTION file, something like
.First.lib <- function(lib, pkg) {
library.dynam("spatstat", pkg, lib)
dfile <- system.file("DESCRIPTION", package="spatstat")