Nama : Shindy Millati Rachma NIM : 19090139 kelas : 3A

#Deskripsi : Data yang digunakan adalah data hasil panen bawang di Kabupaten Brebes. LPDH (Luas Panen Dibongkar Habis), PDH (Produksi Dibongkar Habis), dan LPBH (Luas Panen Belum Habis) data ini digunakan untuk menggunakan prediksi hasil panen ditahun berikutnya.

#gabungkan baris data menjadi vektor, gunakan fungsi t(matrix transpose) agar nilai urut.

r = c(t(as.matrix(data)))
r
##  [1]   357 36503   102   460 55755   103    51  6654   120   137 15572   106
## [13]   334 33003    97     0     0     0

#buat variabel baru untuk kategori, level traetment, dan treatment.

f = c("LPDH", "PDH", "LPBH")
k = 3 #treatment levels
n = 6 #data tiap treatment

#buat faktor level sesuai anggota variabel r, gunakan fungsi gl.

tm = gl(k, 1, n*k, factor(f))
tm
##  [1] LPDH PDH  LPBH LPDH PDH  LPBH LPDH PDH  LPBH LPDH PDH  LPBH LPDH PDH  LPBH
## [16] LPDH PDH  LPBH
## Levels: LPDH PDH LPBH

#gunakan fungsi aov untuk uji anova, kemudian print out hasilnya menggunakan summary.

av = aov(r~tm)
summary(av)
##             Df    Sum Sq   Mean Sq F value  Pr(>F)   
## tm           2 2.386e+09 1.193e+09   8.166 0.00399 **
## Residuals   15 2.192e+09 1.461e+08                   
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

#Referensi = [Data yang diginakan] https://drive.google.com/file/d/1LPLB_pmkIRImXQH57HFKr8klAKATKFdn/view?usp=sharing

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:

summary(cars)
##      speed           dist       
##  Min.   : 4.0   Min.   :  2.00  
##  1st Qu.:12.0   1st Qu.: 26.00  
##  Median :15.0   Median : 36.00  
##  Mean   :15.4   Mean   : 42.98  
##  3rd Qu.:19.0   3rd Qu.: 56.00  
##  Max.   :25.0   Max.   :120.00

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.