Vignettes are long form documentation commonly included in packages. Because they are part of the distribution of the package, they need to be as compact as possible. The html_pretty output format in package prettydoc , an alternative to html_document and html_vignette contained in the rmarkdown package, is able to generate small and nice HTML pages.
下載資料
## ID Response_Time Position
## 1 S01 51 1
## 2 S01 36 2
## 3 S01 50 3
## 4 S01 35 4
## 5 S01 42 5
## 6 S02 27 1
## [1] "ID" "Response_Time" "Position"
將資料由單行轉多行
## X1 X2 X3 X4 X5
## 1 51 36 50 35 42
## 2 27 20 26 17 27
## 3 37 22 41 37 30
## 4 42 36 32 34 27
## 5 27 18 33 14 29
## 6 43 32 43 35 40
## 7 41 22 36 25 38
## 8 38 21 31 20 16
## 9 36 23 27 25 28
## 10 26 31 31 32 36
## 11 29 20 25 26 25
##將資料重新命名
colnames(dta.1) <- c("Pos_1", "Pos_2", "Pos_3", "Pos_4", "Pos_5")
rownames(dta.1) <- c("S01", "S02", "S03", "S04", "S05", "S06", "S07", "S08", "S09", "S10", "S11")
str(dta.1)## 'data.frame': 11 obs. of 5 variables:
## $ Pos_1: int 51 27 37 42 27 43 41 38 36 26 ...
## $ Pos_2: int 36 20 22 36 18 32 22 21 23 31 ...
## $ Pos_3: int 50 26 41 32 33 43 36 31 27 31 ...
## $ Pos_4: int 35 17 37 34 14 35 25 20 25 32 ...
## $ Pos_5: int 42 27 30 27 29 40 38 16 28 36 ...