rdataframemanova

Storing the summary of a manova operation in a data frame


I'm new to R and was trying to store the summary of a "manova" operation in a data frame. Is it possible to do so. If not a data frame, in what type can I store the summary of a "manova" operation. I tried converting it into a list and then placing it in a data frame but its not possible to do so.

Here is the data:

Customer_Age<-c(45,51,40,44,51,32)   

Dependent_count<-c(3,3,3,2,4,0)      


Education_Level<-c("High School","Grad","Uneducated","Grad","High School","Grad")      

df_man<-data.frame(Education_Level,Customer_Age,Dependent_count)     

manovadf<-manova(cbind(Customer_Age,Dependent_count)~Education_Level,df_man)      

manovasum<-summary(manovadf)     

When I'm trying to convert it into a data frame, getting the following error:

data.frame(manovasum)
Error in as.data.frame.default(x[[i]], optional = TRUE, stringsAsFactors = stringsAsFactors) : 
cannot coerce class ""summary.manova"" to a data.frame

Solution

  • Normally you have to extract each attribute from mannova object using $ operator. It's true for all model objects in R. For tidying this objects and converting them into a data.frame, try broom package

    library(broom)
    
    M <- mannova(...)
    tidy(M)