0
$\begingroup$

I'm creating a function in R for plotting and calculate an ANOVA model (because I have to repeat this operation a lot of time). I wrote this function:

response_vars = c(
  'ANSIA',
  'DEPRESSIONE',
  'ESAURIMENTO.EMOTIVO',
  'DEPERSONALIZZAZIONE',
  'GRATIFICAZIONE.PERSONALE',
  'STRESS.TOTALE'
)
var_plots <- function(df, var) {
  print(table(df[, var]))
  barplot(table(df[, var]))
  par(mfrow=c(2,3))
  for (resp_var in response_vars) {
    boxplot(df[, resp_var]~df[, var], xlab = var, ylab = resp_var)
    summary_aov <- summary(aov(df[, resp_var]~df[, var]))
    print(summary_aov)
  }
  par(mfrow=c(1,1))
}

But when I execute the code the summary table is like this:

enter image description here

Can I change the label of df[, var] rows?

$\endgroup$

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Browse other questions tagged or ask your own question.