Hi:
Borrowing from this thread, courtesy of Brian Diggs:
http://groups.google.com/group/ggplot2/browse_thread/thread/478f9e61d41b4678/ed323c497db61156?lnk=gst&q=stat_function#ed323c497db61156
...here's a small reproducible example:
ddf <- data.frame(x = 1:10, y = 0.4 + 0.6 * (1:10) + rnorm(10))
Thanks Rainer. I did not know about dput(). Here is the data.
mom_hs <- c(1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 0,
1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 0, 1, 1, 1,
0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1,
Hi All,
I have a scatter plot produced using ggplot2 and I want to add the
regression line to this scatter plot. I suppose I can use
geom_smooth() to do this, but for the sake of learning ( I am new both
to R and ggplot2), I want to try and add it as a function (something
that curve() does in the
On 27/07/2011 9:21 AM, dean123 wrote:
Hi David,
I am trying to define t as a single numeric value and not as a vector.. I
want the function to realise that if I call test(t) and t is less than equal
10 return zero, if t greater than 10 return 2*t. Am i missing some code in
which to define t a nu
Hi David,
I am trying to define t as a single numeric value and not as a vector.. I
want the function to realise that if I call test(t) and t is less than equal
10 return zero, if t greater than 10 return 2*t. Am i missing some code in
which to define t a numeric value instead of a vector?
Also,
On Jul 27, 2011, at 3:01 AM, dean123 wrote:
I am trying to plot the following function over the range 0-100
test <- function(t){{
if (t<=10)
x<-t*0
else x<-2*t
}
x
}
Two problems I see. The first is the one described fairly clearly by
the error message:
Read:
?"if"
It is not designed
I am trying to plot the following function over the range 0-100
test <- function(t){{
if (t<=10)
x<-t*0
else x<-2*t
}
x
}
when I use plot(test,0,100) the GUI produces the following;
"Warning message:
In if (t <= 10) x <- t * 0 else x <- 2 * t :
the condition has length > 1 and only the first e
Take a look at the examples in ?curve. As suggested by Erik, in the
future please read the posting guide so you can get a more accurate
response.
Regards,
Francisco
Dr. Francisco J. Zagmutt
Vose Consulting
1643 Spruce St., Boulder
Boulder, CO, 80302
USA
www.voseconsulting.com
Jin wrote:
He
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Jin wrote:
Hello Dear,
I am trying to plot a function to see a minimum point (actually, using
"optim"). For example,
1. y=f(x)
2. x has a range
3. pl
Hello Dear,
I am trying to plot a function to see a minimum point (actually, using
"optim"). For example,
1. y=f(x)
2. x has a range
3. plot(x,y) to see a point x minimizing y
I tried "plot(x,y)", but it made an error. Am I doing a right way?
Thanks,
Jin
--
View this message in context:
htt
Thank you for your replies. I figured out that curve has an option of add
which adds it to a previously existing graph.
Thank you,
Amit
On Fri, May 9, 2008 at 10:07 AM, Amit Soni <[EMAIL PROTECTED]> wrote:
> Hi,
>
> I have a histogram of an array of numbers.
> hist(v,10)
>
> How can I plot a fun
Hi,
I have a histogram of an array of numbers.
hist(v,10)
How can I plot a function, say a semi circle,
curve(sqrt(2.25-x*x), -1.5,1.5)
in the same graph?
Thank you
[[alternative HTML version deleted]]
__
R-help@r-project.org mailing list
htt
12 matches
Mail list logo