[R] plot formula 'x' is missing?
Duncan Murdoch
murdoch.duncan at gmail.com
Sat May 15 13:00:34 CEST 2010
On 15/05/2010 1:22 AM, Giovanni Azua wrote:
> Hi Jorge and Dennis,
>
> Thank you for the hint!
>
> However, I'm still very intrigued as to why it does not work using plot ... what is special about this specific formula that plot doesn't like it?
>
>
There's nothing special about the formula. plot() is simply saying (in
a slightly unclear way) that it requires an argument named x, and you
didn't pass one. You would get past that error by leaving off the
"formula =" part of your call, so that the first argument gets passed as
x by default. But then you'll get a new error:
>
plot(y~1/(1+exp(5.0993-0.1084*x)),data=data.frame(x=seq(0,100,length.out=1000)))
Error in eval(expr, envir, enclos) : object 'y' not found
The problem here is that you're asking to plot y versus an expression
involving x, without defining what y is. The version that works is the
slightly odd looking
> plot(1/(1+exp(5.0993-0.1084*x)) ~
x,data=data.frame(x=seq(0,100,length.out=1000)))
(or the version involving curve() that Jorge sent.)
Duncan Murdoch
> Best regards,
> Giovanni
>
> On May 15, 2010, at 7:12 AM, Jorge Ivan Velez wrote:
>
>> Hi Giovanni,
>>
>> curve(1/(1+exp(5.0993-0.1084*x)), 0, 100)
>>
>> HTH,
>> Jorge
>>
>>
>> On Sat, May 15, 2010 at 12:43 AM, Giovanni Azua <> wrote:
>> Hello,
>>
>> I'd like to plot the logistic function for a specific model like this:
>>
>>
>>> plot(formula=y~1/(1+exp(5.0993-0.1084*x)),data=data.frame(x=seq(0,100,length.out=1000)))
>>>
>> Error in is.function(x) : 'x' is missing
>>
>> However, I get the 'x' is missing error above and don't know how to fix it ...
>>
>> Can anyone advice?
>> Thanks in advance,
>> Best regards,
>> Giovanni
>>
>> ______________________________________________
>> 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.
>>
>>
>
>
> [[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