using myfunction in stat_function

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

using myfunction in stat_function

Veerappa Chetty
HI,

I use solve(A,b) inside my function, myfun2; it works fine when I return
one value or a list.

 I want use the return values in ggplot as below: ggplot(data.frame(
x=c(0.1,0.8)),aes(x=x))+stat_function(fun=myfun.2,geom="line")
I get a blank graph. Would greatly appreciate help! Thanks.

--
Professor of Family Medicine
Boston University
Tel: 617-414-6221, Fax:617-414-3345
emails: [hidden email]

        [[alternative HTML version deleted]]

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Reply | Threaded
Open this post in threaded view
|

Re: using myfunction in stat_function

David Winsemius

> On Jun 6, 2018, at 8:04 PM, Veerappa Chetty <[hidden email]> wrote:
>
> HI,
>
> I use solve(A,b) inside my function, myfun2; it works fine when I return
> one value or a list.
>
> I want use the return values in ggplot as below:


> ggplot(data.frame(
> x=c(0.1,0.8)),aes(x=x))+stat_function(fun=myfun.2,geom="line")

Error in layer(data = data, mapping = mapping, stat = StatFunction, geom = geom,  :
  object 'myfun.2' not found

> I get a blank graph. Would greatly appreciate help! Thanks.
>
> --
> Professor of Family Medicine
> Boston University
> Tel: 617-414-6221, Fax:617-414-3345
> emails: [hidden email]
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> [hidden email] mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

David Winsemius
Alameda, CA, USA

'Any technology distinguishable from magic is insufficiently advanced.'   -Gehm's Corollary to Clarke's Third Law

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Reply | Threaded
Open this post in threaded view
|

Re: using myfunction in stat_function

Jeff Newmiller
In reply to this post by Veerappa Chetty
Your example is not reproducible.

Perhaps read [1]

[1] http://rstudio-pubs-static.s3.amazonaws.com/3365_9573f6d661b444499365fe1841ee65d3.html

On June 6, 2018 8:04:44 PM PDT, Veerappa Chetty <[hidden email]> wrote:
>HI,
>
>I use solve(A,b) inside my function, myfun2; it works fine when I
>return
>one value or a list.
>
> I want use the return values in ggplot as below: ggplot(data.frame(
>x=c(0.1,0.8)),aes(x=x))+stat_function(fun=myfun.2,geom="line")
>I get a blank graph. Would greatly appreciate help! Thanks.

--
Sent from my phone. Please excuse my brevity.

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.