library(readxl) library(ggpubr) Loading required package: ggplot2 A5Q1 <- read_excel(“C:/Users/Jasmine/Desktop/AA5221_Week5/A5Q1.xlsx”) Error:
pathdoes not exist: ‘C:/Users/Jasmine/Desktop/AA5221_Week5/A5Q1.xlsx’
A5Q1 <- read_excel(“C:/Users/Jasmine/Desktop/AA5221_Week5”) Error in file(con, “rb”) : cannot open the connection In addition: Warning message: In file(con, “rb”) : cannot open file ‘C:5221_Week5’: Permission denied
A5Q1 <- read_excel(“C:/Users/Jasmine/Desktop/AA5221_Week5/A5Q1-1.xlsx”) observed <- table(A5Q1$flavor) observed
Chocolate Mango Strawberry Vanilla 87 32 57 74 > barplot(observed, + main = “flavor”, + xlab = “flavor”, + ylab = “Count”, + col = rainbow(length(observed))) > barplot(observed, + main = “flavor”, + xlab = “flavor”, + ylab = “Count”, + col = rainbow(length(observed))) > expected <- c(.20, .20, .20, .40) > chi_result <- chisq.test(x = observed, p = expected) > chi_result
Chi-squared test for given probabilities
data: observed X-squared = 41.6, df = 3, p-value = 4.878e-09
chi_result <- chisq.test(x = observed, p = expected) chi_result
Chi-squared test for given probabilities
data: observed X-squared = 41.6, df = 3, p-value = 4.878e-09
w <- sqrt(as.numeric(chi_result$statistic) / sum(observed)) w [1] 0.4079216 A Chi-Square Goodness of Fit test was conducted to determine if there was a difference between the observed [categorical variable] frequencies and the expected frequencies.
The results showed that there [was / was not] a difference between the observed and expected frequencies, χ²(df) = xx.xx, p = .xxx.
The difference was [weak / moderate / strong], (Cohen’s W = .xx) A Chi-Square Goodness of Fit test was conducted to determine if there was a difference between the observed flavors frequencies and the expected frequencies.
The results showed that there [was] a difference between the observed and expected frequencies, χ²(3) = 41.6, p = 0.000000004878.
The difference was [moderate], (Cohen’s W = .41) install.packages(“rmarkdown”) Installing package into ‘C:/Users/Jasmine/AppData/Local/R/win-library/4.6’ (as ‘lib’ is unspecified) trying URL ‘https://cran.rstudio.com/bin/windows/contrib/4.6/rmarkdown_2.31.zip’ Content type ‘application/zip’ length 2702490 bytes (2.6 MB) downloaded 2.6 MB
package ‘rmarkdown’ successfully unpacked and MD5 sums checked
The downloaded binary packages are in C:5YKY_packages > library(rmarkdown)