mjskay / ARTool

R Package for Aligned Rank Transform for Nonparametric Factorial ANOVAs
56 stars 9 forks source link

How to get rownames from anova() #38

Open steveharoz opened 1 year ago

steveharoz commented 1 year ago

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 commented 1 year ago

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

mjskay commented 1 year ago

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)