Round(chisq.test(data$cyl, data$am)$statistic, 3)), Round(tidy(aov(data$hp ~ data$cyl))$statistic, 3), Round(tidy(aov(data$wt ~ data$cyl))$statistic, 3), SummTests <- ame(Stat = c(round(tidy(aov(data$mpg ~ data$cyl))$statistic, 3), Perform some statistical tests for the table. Round(summTrans$Freq/sum(summTrans$Freq)*100,1)) Round(summTrans$Freq/sum(summTrans$Freq)*100,1), SummTrans$p <- c(round(summTrans$Freq/sum(summTrans$Freq)*100,1), SummTrans <- as.ame(table(data$am, data$cyl)) Summarise_each(funs(mad(., na.rm=TRUE))) %>% Summarise_each(funs(median(., na.rm=TRUE))) %>% Summarise_each(funs(mean(., na.rm=TRUE))) %>% # Overall counts and percentages for each cylinder Next, we’re going to summarise the data for our table. # The ggarrane function pastes the plots together for your output, from the ggpubr packer Xlab("Gross Horsepower") + ylab(" ") + labs(fill = "Cylinder") + Geom_density(aes(x = hp), inherit.aes = FALSE) + Geom_density(aes(x = wt), inherit.aes = FALSE) + Xlab("Miles/Gallon") + ylab(" ") + labs(fill = "Cylinder") + Geom_density(aes(x = mpg), inherit.aes = FALSE) +įacet_grid(cyl ~. The geom_boxploth function comes from the ggstance package # Check Counts of Transmission by Cylinder īefore summarising the data for the table, it’s good to check the variables formats and distributions.ĭata$cyl <- factor(data$cyl, ordered = TRUE)ĭata$am <- factor(data$am, labels = c("Automatic", "Manual")) Head(data) # mpg cyl disp hp drat wt qsec vs am gear carb First, we’ll assign the data to an object and check structure of the data frame. The first example will use the R dataset mtcars.
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |