Displaying 20 results from an estimated 20000 matches similar to: "Bug with curve?"
2007 Feb 23
4
using "integrate" in a function definition
Dear list members,
I'm quite new to R, and though I tried to find the answer to my probably
very basic question through the available resources (website, mailing
list archives, docs, google), I've not found it.
If I try to use the "integrate" function from within my own functions,
my functions seem to misbehave in some contexts. The following example
is a bit silly, but
2007 Apr 18
5
Problem with ?curve
Dear all R gurus,
I have following syntax:
y = c(1:10)
chippy <- function(x)
{
y[5] = x
sin(cos(t(y)%*%y)*exp(-t(y)%*%y/2))
}
curve(chippy, 1, 20, n=200)
But I am getting error while executing :
Error in xy.coords(x, y, xlabel, ylabel, log) :
'x' and 'y' lengths differ
In addition: Warning message:
number of items to
2012 Jun 04
1
Plotting with Rgraphviz
Hi All,
After a lengthy battle just to get the package installed, I am not able to
actually use Rgraphviz to generate any plots. I tried just using the sample
code in the documentation
(http://www2.warwick.ac.uk/fac/sci/moac/people/students/peter_cock/r/rgraphviz/)
and I get the following:
*> > library(Rgraphviz)
> test.matrix<-matrix(rep(c(0,1,0,0), 9), ncol=6, nrow=6)
>
2005 Oct 27
1
Puzzled over curve() syntax.
It's probably toadally elementary (and, like, duhhhhh) but
I can't figure out why the following doesn't work:
curve(function(x){qnorm(x,4,25)},from=0,to=1)
I get the error:
Error in xy.coords(x, y, xlabel, ylabel, log) :
'x' and 'y' lengths differ
But if I do
foo <- function(x){qnorm(x,4,25)}
curve(foo,from=0,to=1)
it goes like a train.
Also
2006 Jan 21
1
Bug in xy.coords() or documentation error?
Hi,
I noticed the following problem with xy.coords() in R 2.2.1-patched
(version info at the foot of this email) and R 2.3.0 unstable
(subversion no: r37123):
> xy.coords(x = matrix(1:20, ncol = 2))
Error in xy.coords(x = matrix(1:20, ncol = 2)) :
argument "y" is missing, with no default
> xy.coords(x = matrix(1:20, ncol = 2), y = NULL)
$x
[1] 1 2 3 4 5 6 7 8 9
2011 Feb 21
2
(no subject)
What is plot.new? and how can i get it to work so i can load other data?
> library(splancs)
> area = 6*4
> lambda = 1.5
> N = rpois(1,lambda*area)
> u = runif(N,-2,4)
> v = runif(N,0,4)
> plot(u,v,asp=1)
> h = chull(u,v)
> h = c(h,h[1])
> plot(u[h],v[h],"1",asp=1)
Error in plot.xy(xy, type, ...) : invalid plot type '1'
>
2001 May 04
1
scoping error in xy.coords (PR#932)
Hola!
> rm(list=ls(all=TRUE))
> x <- 1:20
> y <- 1+x+rnorm(x)
> xy.coords(y ~ x,NULL)
... expected output, correct, but when called from inside lowess:
> lowess(y ~ x)
Error in xy.coords(x, y) : x and y lengths differ
> debug(xy.coords)
> lowess(y ~ x)
debugging in: xy.coords(x, y)
... long listing deleted
if (is.language(x)) {
if (inherits(x,
2004 Nov 23
2
Quadratic curve on a loop
Dear R community, once again I request your generous help on an R issue
I cannot seem to figure out.
I am trying to do some analysis for multiple sites, in my example I am
using only two, but the same will done on many sites. It's just ONE
line, so I hope somebody can give a me a hand by email.
Look at the loop to make the plot x ~ y. If the curve function is
removed from the loop
2010 May 18
2
automate curve drawing on nls() object
Hi, I would like to use the curve() function to draw the predicted curve from an nls() object. for example:
dd<-read.table("dd.txt",sep='\t',header=T,row.names=1)
obj<-nls(y~c+(d-c)/(1+(x/e)^b),data=dd,start=list(b=-1, c=0, d=100, e=150))
coef(obj)
b c d e
-1.1416422 0.6987028 102.8613176 135.9373131
2003 Apr 16
2
trying to plot function using curve
Dear People,
I hope someone can help me with this. I have a function (density) which I
am trying to plot using curve. I am calling mg.hist(3,2,1), and getting
the following errors.
Error in xy.coords(x, y, xlabel, ylabel, log) :
x and y lengths differ
In addition: There were 50 or more warnings (use warnings() to see the
first 50)
> warnings()
1: longer object length
is not a multiple of
2005 Dec 31
1
xy.coords
In ?xy.coords it says:
If 'y' is missing and 'x' is a
formula: of the form 'yvar ~ xvar'. 'xvar' and 'yvar' are used as
x and y variables.
list: containing components 'x' and 'y', these are used to define
plotting coordinates.
time series: the x values are taken to be 'time(x)' and the y
2008 Oct 23
3
xy.coords in text
Hello,
I want to add text annotation about correlation on "pairs" plots. I
found that I could pass a function to the "panel" argument of pairs :
panel.annot <- function(x, y, ...) {
points(x, y, ...)
c <- cor.test(x, y)
legend("topleft", legend=substitute(rho == r, list(r=sprintf("%.2f",
c$estimate))), bty="n")
}
And then :
2004 Jul 13
2
help with as.function
HI, sorry but i don't understand how to make a function with as.function()
formula<-"2+3*x"
formu<-as.symbol(formula)
> formu
2+3*x
formul<-as.function(alist(x=,formu))
curve(formul,1,5,col="blue")
Error in xy.coords(x, y, xlabel, ylabel, log) :
x and y lengths differ
> typeof(formul)
[1] "closure"
and not plot the curve function, Why?
2006 Jun 04
4
xy.coords(MATRIX) bug in code or documentation (PR#8937)
Hi, people.
xy.coords() does not behave like its documentation says, when given some
matrices. ?xy.coords says:
If 'y' is 'NULL' and 'x' is a [...] formula [...] list [...]
time series [...] matrix with two columns [...]
In any other case, the 'x' argument is coerced to a vector and
returned as *y* component [...]
Now, consider this short
2004 Nov 30
4
adding regression curve to xyplot
Dear R-listers,
It seems that predict() behaves differently within panel.xyplot. Am I
doing something stupid?
Thanks,
Carlisle
First, without xyplot():
> lmtest <- lm(t~s,data=subset(P100,whichLon100==1 & whichLat100==1))
> lmtest
Call:
lm(formula = s ~ t, data = subset(P100, whichLon100 == 1 & whichLat100 ==
1))
Coefficients:
(Intercept) t
33.3307
2012 Apr 01
1
Error in xy.coords(x, NULL, log = log) : (list) object cannot be coerced to type 'double'
Hi there,
When I run the code below I get the error
Error in xy.coords(x, NULL, log = log) :(list) object cannot be coerced to
type 'double'
Any tips how I can resolve this?
>
> library("waveslim")
>
> vols=read.csv(file="C:/Users/ocuk/My Documents/Abs Vol.csv", header=TRUE,
> sep=",")
> x<-c(vols[,1])
> #x
> #data(ibm)
>
2011 May 24
1
histogram with density
Hello All,*
*I want to draw a histogram with density curve. *
*For that simply i created a data called*"x" *and i used the function called
* hist(x, col = "blue", freq = FALSE),** *from this function i got a
histogram*.
*After that , i tried this function* ** lines(density(x), col = "red", lwd
= 2 ) *but i could not get the density curve.
So, Again i used
2006 May 15
1
adding line to spinogram
Dear all,
I wonder what's special about spinograms {vcd} that prevents me from using
it the way I do with other plots.
I do:
> spine(f.speaker.identity ~ x.log.lengthening,
> data=ms,breaks=45,gp=gpar(fill=c("red","green")),xlab="length difference
> (log ms)",ylab="speaker")
> curve(0*x,add=T)
Error in plot.xy(xy.coords(x, y), type =
2009 Jun 06
1
large numbers of observations using ME() of spdep
Dear All,
We aim to remove the spatial structure of our data using Moran Eigen
Vectors and spdep package . Our data has 3694 samples and 13
variables.
The computer stop working after almost 4 days of processing (we found
it emitting a sharp sound and with all colors on the screen. No
wories, it was restared without problem!). And we are left with
nothing: no result file was produced since the
2004 Nov 23
6
Weibull survival regression
Dear R users,
Please can you help me with a relatively straightforward problem that I
am struggling with? I am simply trying to plot a baseline survivor and
hazard function for a simple data set of lung cancer survival where
`futime' is follow up time in months and status is 1=dead and 0=alive.
Using the survival package:
lung.wbs <- survreg( Surv(futime, status)~ 1, data=lung,