Question

After doing Analysis of variance and and building effects table, I need to capture only 5 of those term's table with minimum values. Because of a long list of factors; as there are around 100 factors starting from x1 to x100, I am unable to visualize all the tables.

model<-aov(y~., data=data)
effects<-model.tables(model, "effects")

The label names of any term's table is

names(effects$tables$x1)
"1"      "2"

I need to capture only 2 of those term's tables with minimum value for label "2".

Question edited:

effects$tables[1:4]   
$x1
x1
      1           2 
-0.01099232  0.01053045 

$x2
x2
      1           2 
-0.03292931  0.03321318 

$x3
x3
     1          2 
0.2881996 -0.3008399 

$x4
x4
       1            2 
-0.010151743  0.009236422 

The results may be -0.3008399 and 0.009236422, if we select only 2 minimum values out of the 4 above given tables.

Was it helpful?

Solution

Perhaps: (untested in absence of reproducible example)

eff2 <- effects$tables$x1[['2']]
eff2[ order(eff2) ][1:5]

Or perhaps (still untested in conitnued absence of example)

efftabls <- sapply(eff2, '[', 2)
head( efftabls[order(efftabls)], 5)  # 5 used to be the number requested
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top