[R] Plotting compound functions--help with defining x-axis as f(x)
Aimee Jones
alj27 at hoyamail.georgetown.edu
Mon Jul 25 02:34:53 CEST 2011
Thanks for your assistance, this worked perfectly, and sorry for
posting in html! I shall check it's plain text for future postings..
Would it be possible for you to explain why this works? I'm unsure as
to why redefining t works, when t is perfectly defined within the
script previously.
Thank you for any further help,
Aimee
2011/7/24 Uwe Ligges <ligges at statistik.tu-dortmund.de>
>
>
> On 23.07.2011 00:50, Aimee Jones wrote:
>>
>> Hi all,
>> I'm having trouble locating a script that will allow to me to create graphs
>> that show compound functions as a function of the simple function, rather
>> than just x (or time as it is in my case).
>>
>> Currently I have the following functions defined in my script:
>>
>>>
>>>
>>> T1<-function(t) {27.5-12.5*cos(2*pi*t/365)**}
>
> This is not syntactically correct. Perhaps some leftovers of your html message. The posting guide asks you *not* to send html mail!
>
>
>
>
>>> and
>>>
>>> B1<-function(T1,t) {dnorm(T1(t),mean=22.5,sd=**3.3)}
>>>
>>
>>
>>
>> plot(function(t) {B1(T1,t)}, 0, 365) plots B1 as a function of time, whereas
>> I am looking for a code that allows me to plot B1 as a function of T1. I
>> tried plot(function(T1(t) {B1(T1,t)}, 0, 365) and also plot(function(T1,t)
>> {B1(T1,t)}, 0, 365), neither of which worked. My coding skills are very
>> limited, and I'm somewhat out of ideas..
>
>
> So you probably want something along the lines:
>
> t <- seq(0, 365, length=1000)
> plot(T1(t), B1(T1, t), type="l")
>
> Uwe Ligges
>
>
>
>
>>
>> Thank you for any assistance you are able to give,
>> yours sincerely,
>> Aimee
>>
>> ps: If it's relevant I'm using R64 (R 2.11.1) on a Mac
>>
>> [[alternative HTML version deleted]]
>>
>> ______________________________________________
>> R-help at r-project.org mailing list
>> 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.
More information about the R-help
mailing list