[R] Odp: Error in lm.fit(
Petr PIKAL
petr.pikal at precheza.cz
Wed Oct 3 16:37:04 CEST 2007
Hi
r-help-bounces at r-project.org napsal dne 03.10.2007 14:56:19:
> I am using R.2.4.1 on Windows XP 5.1 (SP 2).
Upgrade R. Version 2.6.0 is imminent.
>
> I have the following line in my R code.
>
> Analysis=anova(lm(PM ~ x))
>
> It works the first 60 or so times it is called but
> then I get the following error message.
>
> Error in lm.fit(x, y, offset = offset, singular.ok =
> singular.ok, ...) : 0 (non-NA) cases
Somehow x or PM is without any numbers.
>
> In order to examine the input, I preceeded the call
> with the following.
>
> print(PM)
> print(x)
Check from where you printed it. Maybe you have these somwhere in your
environment but actual lm is using different ones.
>
> This gave the following.
>
> [1] 245.0 189.0 249.8 188.0 184.3 230.0 147.0 185.3
> 196.0 142.3 282.0 169.0
> [13] 231.5 162.0 115.0 168.8 195.0 214.0 173.0 111.3
> 360.0 192.3 305.5 206.0
> [25] 111.0 247.0 188.0 246.0 252.0 114.0
>
> [1] 20.00 20.00 20.00 20.00 20.00 10.00 10.00 10.00
> 10.00 10.00 7.50 7.50
> [13] 7.50 7.50 7.50 5.00 5.00 5.00 5.00 5.00
> 2.50 2.50 2.50 2.50
> [25] 2.50 1.25 1.25 1.25 1.25 1.25
>
> I would be most grateful if someone could help with
> this problem. I do not see why these input vectors
> would give this error message.
>
> Also, is there a way to make it so the script keeps
> running if it gets an error like this?
Maybe ?try.
You did not reveal much information for anybody to get you some help. If
you try to construct an artificial example which anybody can reproduce you
would maybe find what is the problem yourself.
Regards
Petr
>
> Many thanks in advance,
> Peter Lauren.
>
> ______________________________________________
> 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