

Dear learned experts of R,
I was writing a book through RStudioRmarkdown and had finally compiled it
successfully based on R package R3.6.2. Afterwards, I updated my R3.6.2
to R4.0.0 and even later to R4.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 : nonconformable arguments"
For convenience and reproducibility of the error, I am giving below the
same code chunk as an RScriptExample, wherein the error is occurring in
the plot() function with the input of an aov() object.
RScriptExample producing error:
==========================
setwd("E:/AKSDATANew/Software/R and allied
packages/RMarkdown/knitr/MyBooks/STAT512_STAT564")
getwd()
#After Upgrading to R4.0.0 and even in R4.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 :
nonconformable 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, Raipur492 012,
Chhattisgarh, India
Mobile: +918770625795
Email: [hidden email]
[[alternative HTML version deleted]]
______________________________________________
[hidden email] mailing list  To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/rhelpPLEASE do read the posting guide http://www.Rproject.org/postingguide.htmland provide commented, minimal, selfcontained, reproducible code.


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 px2matrix by a 3vector and things go poof.
This probably counts a bug in R, but I see that your code actually tries to preconvert the variables to factors. However, you misspelled "Permangate"....
pd
> On 19 Jun 2020, at 17:13 , Akhilesh Singh < [hidden email]> wrote:
>
> Dear learned experts of R,
>
> I was writing a book through RStudioRmarkdown and had finally compiled it
> successfully based on R package R3.6.2. Afterwards, I updated my R3.6.2
> to R4.0.0 and even later to R4.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 : nonconformable arguments"
>
> For convenience and reproducibility of the error, I am giving below the
> same code chunk as an RScriptExample, wherein the error is occurring in
> the plot() function with the input of an aov() object.
>
> RScriptExample producing error:
> ==========================
>
> setwd("E:/AKSDATANew/Software/R and allied
> packages/RMarkdown/knitr/MyBooks/STAT512_STAT564")
> getwd()
>
> #After Upgrading to R4.0.0 and even in R4.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 :
> nonconformable 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, Raipur492 012,
> Chhattisgarh, India
> Mobile: +918770625795
> Email: [hidden email]
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> [hidden email] mailing list  To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/rhelp> PLEASE do read the posting guide http://www.Rproject.org/postingguide.html> and provide commented, minimal, selfcontained, 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: [hidden email] Priv: [hidden email]
______________________________________________
[hidden email] mailing list  To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/rhelpPLEASE do read the posting guide http://www.Rproject.org/postingguide.htmland provide commented, minimal, selfcontained, reproducible code.


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
R4.0.0 and later to R0.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 < [hidden email]> 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 px2matrix
> by a 3vector and things go poof.
>
> This probably counts a bug in R, but I see that your code actually tries
> to preconvert the variables to factors. However, you misspelled
> "Permangate"....
>
> pd
>
> > On 19 Jun 2020, at 17:13 , Akhilesh Singh < [hidden email]>
> wrote:
> >
> > Dear learned experts of R,
> >
> > I was writing a book through RStudioRmarkdown and had finally compiled
> it
> > successfully based on R package R3.6.2. Afterwards, I updated my R3.6.2
> > to R4.0.0 and even later to R4.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 : nonconformable arguments"
> >
> > For convenience and reproducibility of the error, I am giving below the
> > same code chunk as an RScriptExample, wherein the error is occurring in
> > the plot() function with the input of an aov() object.
> >
> > RScriptExample producing error:
> > ==========================
> >
> > setwd("E:/AKSDATANew/Software/R and allied
> > packages/RMarkdown/knitr/MyBooks/STAT512_STAT564")
> > getwd()
> >
> > #After Upgrading to R4.0.0 and even in R4.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 :
> > nonconformable 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, Raipur492 012,
> > Chhattisgarh, India
> > Mobile: +918770625795
> > Email: [hidden email]
> >
> > [[alternative HTML version deleted]]
> >
> > ______________________________________________
> > [hidden email] mailing list  To UNSUBSCRIBE and more, see
> > https://stat.ethz.ch/mailman/listinfo/rhelp> > PLEASE do read the posting guide
> http://www.Rproject.org/postingguide.html> > and provide commented, minimal, selfcontained, 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: [hidden email] Priv: [hidden email]
>
>
>
>
>
>
>
>
>
>
[[alternative HTML version deleted]]
______________________________________________
[hidden email] mailing list  To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/rhelpPLEASE do read the posting guide http://www.Rproject.org/postingguide.htmland provide commented, minimal, selfcontained, reproducible code.

