[R] Error in "plot(aov.object)" after upgradation to R-4.0.0 and R-4.0.1 for given R-Script-Example

Akhilesh Singh @kh||e@h@|ngh@|gkv @end|ng |rom gm@||@com
Sun Jun 21 21:23:33 CEST 2020


Dear Peter,

Thanks for your reply, and pointing out my mistake of misspelling in
'Permanganate' variable.

However, it couldn't be detected because the same code, with misspelled
variable at factor declaration level, ran successful ly till I upgraded to
R-4.0.0 and later to R-0.1.

I am sure the bug pointed out by you would taken care of soon. Thanks again.

With best regards,

Dr. A.K. Singh



On Sun, Jun 21, 2020, 5:11 PM peter dalgaard <pdalgd using gmail.com> wrote:

> This is fallout from the stringsAsFactors changes. You have 'Permanganate'
> as a character vector and it runs afoul of this code
>
>     aterms <- attributes(terms(x))
>     dcl <- aterms$dataClasses[-aterms$response]
>     facvars <- names(dcl)[dcl %in% c("factor", "ordered")]
>
> which does not include 'Permanganate', even though the model fit has de
> facto promoted it to a factor. In the end, you try to multiply a px2-matrix
> by a 3-vector and things go poof.
>
> This probably counts a bug in R, but I see that your code actually tries
> to pre-convert the variables to factors. However, you misspelled
> "Permangate"....
>
> -pd
>
> > On 19 Jun 2020, at 17:13 , Akhilesh Singh <akhileshsingh.igkv using gmail.com>
> wrote:
> >
> > Dear learned experts of R,
> >
> > I was writing a book through RStudio-Rmarkdown and had finally compiled
> it
> > successfully based on R package R-3.6.2. Afterwards, I updated my R-3.6.2
> > to R-4.0.0 and even later to R-4.0.1.
> >
> > Then, the publishers demanded to recompile the book with font embedding,
> so
> > I tried to recompile the book, when I found the following error:
> >
> > "Error in (dm - 1) %*% ff : non-conformable arguments"
> >
> > For convenience and reproducibility of the error, I am giving below the
> > same code chunk as an R-Script-Example, wherein the error is occurring in
> > the plot() function with the input of an aov() object.
> >
> > R-Script-Example producing error:
> > ==========================
> >
> > setwd("E:/AKS-DATA-New/Software/R and allied
> > packages/R-Markdown/knitr/MyBooks/STAT-512_STAT-564")
> > getwd()
> >
> > #After Upgrading to R-4.0.0 and even in R-4.0.1 following error in
> "plot()"
> > function occurs:
> >
> > Block=c(1,1,1,1,2,2,2,2,3,3,3,3)
> >
> Permanganate=c("without","without","with","with","without","without","with","with","without","without","with","with")
> > Sample.Size=c(0.25,1,0.25,1,0.25,1,0.25,1,0.25,1,0.25,1)
> > Riboflavin=c(39.5,38.6,27.2,24.6,43.1,39.5,23.2,24.2,45.2,33,24.8,22.2)
> >
> > #Creating data frame
> > sned.2x2.woint=data.frame(Block, Sample.Size, Permanganate, Riboflavin)
> >
> > #Declaring Block, Sample.Size, Permanganate as factors
> > sned.2x2.woint$Block = factor(sned.2x2.woint$Block)
> > sned.2x2.woint$Sample.Size = factor(sned.2x2.woint$Sample.Size)
> > sned.2x2.woint$Permangate=factor(sned.2x2.woint$Permanganate)
> >
> > #ANOVA of RBD when Block, Sample.Size, Permanganate are a fixed effects
> > sned.2x2.woint.aov1=aov(Riboflavin ~ Block + Sample.Size + Permanganate +
> > Sample.Size:Permanganate,data=sned.2x2.woint)
> >
> > cat("ANOVA of RBD when Block, Sample.Size and Permanganate are fixed
> > effects:\n")
> > summary(sned.2x2.woint.aov1)
> >
> > #ANOVA of RBD when Block, Sample.Size, Permanganate are fixed effects
> > sned.2x2.woint.aov2=aov(Riboflavin ~ Block + Sample.Size + Permanganate,
> > data=sned.2x2.woint)
> >
> > cat("ANOVA of RBD when Block, Sample.Size and Permanganate are fixed
> > effects:\n")
> >
> > summary(sned.2x2.woint.aov2)
> >
> > plot(sned.2x2.woint.aov2, which=1) #OK
> > plot(sned.2x2.woint.aov2, which=2) #Ok
> > plot(sned.2x2.woint.aov2, which=3) #OK
> > plot(sned.2x2.woint.aov2, which=4) #OK
> >
> > plot(sned.2x2.woint.aov2, which=5) #Error in (dm - 1) %*% ff :
> > non-conformable arguments
> >
> > plot(sned.2x2.woint.aov2, which=6) #OK
> > =================================
> >
> > I request the esteemed and learned experts of R to kindly me out to
> > overcome this error.
> >
> > With regards
> >
> >
> >
> > --
> > Dr. A.K. Singh
> > Professor and Head (Agricultural Statistics)
> > Department of Agricultural Statistics and Social Science (L)
> > Indira Gandhi Krishi Vishwavidyalaya, Raipur-492 012,
> > Chhattisgarh, India
> > Mobile: +918770625795
> > Email: akhileshsingh.igkv using gmail.com
> >
> >       [[alternative HTML version deleted]]
> >
> > ______________________________________________
> > R-help using r-project.org 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.
>
> --
> Peter Dalgaard, Professor,
> Center for Statistics, Copenhagen Business School
> Solbjerg Plads 3, 2000 Frederiksberg, Denmark
> Phone: (+45)38153501
> Office: A 4.23
> Email: pd.mes using cbs.dk  Priv: PDalgd using gmail.com
>
>
>
>
>
>
>
>
>
>

	[[alternative HTML version deleted]]



More information about the R-help mailing list