ARTool icon indicating copy to clipboard operation
ARTool copied to clipboard

How to get rownames from anova()

Open steveharoz opened this issue 3 years ago • 2 comments

When rownames_to_column() is called on the anova results, the text is replaced with numbers.

# make some data
expand.grid(
  aaa = LETTERS[1:4],
  bbb = LETTERS[1:4],
  subject = 1:10
) %>% 
  mutate_all(factor) %>% 
  mutate(measure = rnorm(n())) %>% 
  
# ART ANOVA
art(measure ~ aaa * bbb + Error(subject/bbb), .) %>% 
  anova() %>% 
  
# get row names as a column
  rownames_to_column()

There are numbers instead of text: image

steveharoz avatar Nov 29 '22 15:11 steveharoz

Workaround: Calling ... %>% cbind(.) will put the rowname in a column named Term.

steveharoz avatar Nov 29 '22 18:11 steveharoz

Yeah, it's admittedly a bit obscure, but that column is there already and can be referred to by name (pass the data structure to str() to see it)

mjskay avatar Nov 30 '22 01:11 mjskay