0

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
Roland
  • 127,288
  • 10
  • 191
  • 288
G_1991
  • 139
  • 11

2 Answers2

2

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)
Koundy
  • 5,265
  • 3
  • 24
  • 37
0

You can use the capture.output function, if you don't want to perform further arithmetic operations on the result

output <- capture.output(manovasum)
rmuc8
  • 2,869
  • 7
  • 27
  • 36