[R] R News, volume 7, issue 1 is now available --error in AMMI article

Duncan Murdoch murdoch at stats.uwo.ca
Thu Apr 26 14:34:06 CEST 2007


On 4/26/2007 7:55 AM, Lux Zhang wrote:
> On 26/04/07, Lux Zhang <yuanlux at gmail.com> wrote:
>>
>>
>>
>> On 26/04/07, John Fox <jfox at mcmaster.ca> wrote:
>> >
>> > Dear Yuandan,
>> >
>> > My attention was drawn by your claim of an "error in AMMI article."
>> >
>> > As you say, the code for the AMMI function is given directly in the
>> > article.
>> > If the argument biplot is equal to 1, then a biplot is drawn by the
>> > function, as is apparent from the section of code labelled "## 5 -
>> > Biplots."
>> >
>> > Why is this an error?
>>
>>
>>
>> when loading this AMMI function, at the line "if (biplot == 1) { ", R
>> seems treating the 'biplot' as a subject, the biplot function from stats
>> package, inseatd of treating it as argument for the AMMI function.
>>
>> here is the error messenge when I load it
>>
>> > source ("AMMI.R")
>> Error in parse(file, n = -1, NULL, "?") : syntax error at
>> 51: ( bplot == 1 ) {
>> 52:     plot(1, type =
>>
> 
> Sorry, I had another look, it seems something to do with
> plot (1, type = 'n' ... [ i copy this code from the pdf file]
> 
> after change it to
> 
> plot (1, type = "n" ... as below
> 
>   if ( biplot == 1 ) {
>     plot(1, type = "n", xlim = range(c(envir.mean, var.mean)), ylim =
> range(c(E[,1], G[,1])), xlab = "Yield",
> 
> lt was loaded.

I would guess you used an editor that replaced the ASCII single quotes 
with some other similar looking character.  For example, if I fire up my 
ancient copy of Word 97 (it still works!  amazing!) and try to type

X <- 'n'

(using 0x27 chars for quotes) what actually gets entered is

X <- ‘n’

which is a syntax error, as it's using 0x91 and 0x92 instead.

Duncan Murdoch



More information about the R-help mailing list