R Markdown

This is an R Markdown document. Markdown is a simple formatting syntax for authoring HTML, PDF, and MS Word documents. For more details on using R Markdown see http://rmarkdown.rstudio.com.

When you click the Knit button a document will be generated that includes both content as well as the output of any embedded R code chunks within the document. You can embed an R code chunk like this:

denim <- read.table("C:/Users/qurro/OneDrive/Documents/Semester_3/Rancangan Percobaan/denim_abrasion.txt")
colnames(denim) <- c("A", "B", "Y") 
denim$A <- factor(denim$A) 
denim$B <- factor(denim$B) 
str(denim)
## 'data.frame':    90 obs. of  3 variables:
##  $ A: Factor w/ 3 levels "1","2","3": 1 1 1 1 1 1 1 1 1 1 ...
##  $ B: Factor w/ 3 levels "1","2","3": 1 1 1 1 1 1 1 1 1 1 ...
##  $ Y: num  3.22 3.35 3.13 2.63 3.88 ...
mod <- aov(Y ~ A*B,data=denim) 
summary(mod) 
##             Df Sum Sq Mean Sq F value   Pr(>F)    
## A            2  4.271   2.136  12.423 1.97e-05 ***
## B            2 13.416   6.708  39.019 1.36e-12 ***
## A:B          4  1.330   0.332   1.934    0.113    
## Residuals   81 13.925   0.172                     
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
library(DescTools)
## Warning: package 'DescTools' was built under R version 4.3.3
PostHocTest(mod, method="duncan", conf.level = 0.95)
## 
##   Posthoc multiple comparisons of means : Duncan's new multiple range test 
##     95% family-wise confidence level
## 
## $A
##           diff     lwr.ci      upr.ci    pval    
## 2-1 -0.3556833 -0.5686938 -0.14267290  0.0013 ** 
## 3-1 -0.5223500 -0.7464853 -0.29821467 7.8e-06 ***
## 3-2 -0.1666667 -0.3796771  0.04634376  0.1234    
## 
## $B
##           diff     lwr.ci     upr.ci    pval    
## 2-1 -0.9446667 -1.1688020 -0.7205313 1.3e-11 ***
## 3-1 -0.4333367 -0.6463471 -0.2203262 0.00012 ***
## 3-2  0.5113300  0.2983196  0.7243404 7.8e-06 ***
## 
## $`A:B`
##                  diff      lwr.ci       upr.ci    pval    
## 2:1-1:1 -3.670200e-01 -0.73596489  0.001924889  0.0512 .  
## 3:1-1:1 -8.670300e-01 -1.26800932 -0.466050683 2.2e-05 ***
## 1:2-1:1 -1.200000e+00 -1.62334248 -0.776657519 2.4e-08 ***
## 2:2-1:1 -1.434030e+00 -1.86622792 -1.001832078 1.2e-10 ***
## 3:2-1:1 -1.434020e+00 -1.86216581 -1.005874191 1.0e-10 ***
## 1:3-1:1 -5.340200e-01 -0.92223378 -0.145806218  0.0070 ** 
## 2:3-1:1 -1.000020e+00 -1.41755171 -0.582488294 2.0e-06 ***
## 3:3-1:1 -1.000020e+00 -1.41032842 -0.589711578 1.6e-06 ***
## 3:1-2:1 -5.000100e-01 -0.88822378 -0.111796218  0.0115 *  
## 1:2-2:1 -8.329800e-01 -1.25051171 -0.415448294 6.5e-05 ***
## 2:2-2:1 -1.067010e+00 -1.49515581 -0.638864191 5.8e-07 ***
## 3:2-2:1 -1.067000e+00 -1.49034248 -0.643657519 5.1e-07 ***
## 1:3-2:1 -1.670000e-01 -0.53594489  0.201944889  0.3705    
## 2:3-2:1 -6.330000e-01 -1.04330842 -0.222691578  0.0022 ** 
## 3:3-2:1 -6.330000e-01 -1.03397932 -0.232020683  0.0018 ** 
## 1:2-3:1 -3.329700e-01 -0.73394932  0.068009317  0.1049    
## 2:2-3:1 -5.670000e-01 -0.98453171 -0.149468294  0.0070 ** 
## 3:2-3:1 -5.669900e-01 -0.97729842 -0.156681578  0.0062 ** 
## 1:3-3:1  3.330100e-01 -0.03593489  0.701954889  0.0762 .  
## 2:3-3:1 -1.329900e-01 -0.52120378  0.255223782  0.5041    
## 3:3-3:1 -1.329900e-01 -0.50193489  0.235954889  0.4753    
## 2:2-1:2 -2.340300e-01 -0.62224378  0.154183782  0.2388    
## 3:2-1:2 -2.340200e-01 -0.60296489  0.134924889  0.2106    
## 1:3-1:2  6.659800e-01  0.25567158  1.076288422  0.0012 ** 
## 2:3-1:2  1.999800e-01 -0.16896489  0.568924889  0.2840    
## 3:3-1:2  1.999800e-01 -0.18823378  0.588193782  0.3145    
## 3:2-2:2  1.000000e-05 -0.36893489  0.368954889  1.0000    
## 1:3-2:2  9.000100e-01  0.47666752  1.323352481 1.9e-05 ***
## 2:3-2:2  4.340100e-01  0.03303068  0.834989317  0.0336 *  
## 3:3-2:2  4.340100e-01  0.02370158  0.844318422  0.0378 *  
## 1:3-3:2  9.000000e-01  0.48246829  1.317531706 1.7e-05 ***
## 2:3-3:2  4.340000e-01  0.04578622  0.822213782  0.0284 *  
## 3:3-3:2  4.340000e-01  0.03302068  0.834979317  0.0336 *  
## 2:3-1:3 -4.660000e-01 -0.86697932 -0.065020683  0.0223 *  
## 3:3-1:3 -4.660000e-01 -0.85421378 -0.077786218  0.0186 *  
## 3:3-2:3  8.881784e-16 -0.36894489  0.368944889  1.0000    
## 
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Including Plots

You can also embed plots, for example:

Note that the echo = FALSE parameter was added to the code chunk to prevent printing of the R code that generated the plot.