1. æ¦è¦
summarytoolsã¯ãã¼ã¿æ¢ç´¢ã¨ç°¡åãªå ±åãä¸å¿ã¨ããä¸è²«ããæ©è½ã»ãããæä¾ããããã®ä¸æ ¸ã«ã¯ä»¥ä¸ã®4ã¤ã®é¢æ°ãåå¨ããï¼
é¢æ°èª¬æ
freq()
åæ°ãæ¯çãç´¯ç©çµ±è¨éãããã³æ¬ æãã¼ã¿ã®å ±åãç¹å¾´ã¨ãã度æ°è¡¨
ctable()
é¢æ£å¤æ°/ã«ãã´ãªã¼å¤æ°ã®ãã¢éã®ã¯ãã¹éè¨ (çµå度æ°)ã
descr()
æ°å¤ãã¼ã¿ã®è¨è¿°çµ±è¨ (åå¤é)ã
dfSummary()
ãã¹ã¦ã®å¤æ°ã®ååºæã®æ
å ±ãç¹å¾´ã¨ãããã¼ã¿ã»ãã¬ã¼ã ã»ãµããªã¼ï¼åå¤éçµ±è¨éããã³/ã¾ãã¯åº¦æ°åå¸ãæ£ã°ã©ãã¾ãã¯ãã¹ãã°ã©ã ãããã³æ¬ æãã¼ã¿ã®ã«ã¦ã³ãã¨å²åãç´ æ©ãç°å¸¸ãæ¤åºããä¸ç®ã§å¾åãç¹å®ããã®ã«é常ã«ä¾¿å©
2. 度æ°è¡¨: freq()
freq()é¢æ°ã¯ãè¨æ°ãå²åãæ¬ æãã¼ã¿æ
å ±ãå«ã度æ°è¡¨ãçæããã
ä½è«: ãã®ããã±ã¼ã¸ã®ã¢ã¤ãã¢ã¯ããã¼ã¹ã¨ãªãRã«ãã®ãããªé¢æ°ããªãã£ããã¨ã«ç±æ¥ãã¦ããã
freq(iris$Species, plain.ascii = FALSE, style = "rmarkdown")
Freq | % Valid | % Valid Cum. | % Total | % Total Cum. | |
---|---|---|---|---|---|
setosa | 50 | 33.33 | 33.33 | 33.33 | 33.33 |
versicolor | 50 | 33.33 | 66.67 | 33.33 | 66.67 |
virginica | 50 | 33.33 | 100.00 | 33.33 | 100.00 |
\<NA> | 0 | 0.00 | 100.00 | ||
Total | 150 | 100.00 | 100.00 | 100.00 | 100.00 |
ãã®æåã®ä¾ã§ã¯ãplain.asciiã¨styleå¼æ°ãæå®ããã¦ãããããããst_options()ã使ã£ã¦ãã®ææ¸ã«å¯¾ãã¦ã°ãã¼ãã«ã«å®ç¾©ããã®ã§ãåé·ã§ããã以å¾çç¥ããï¼ã»ã¯ã·ã§ã³16ã«ãã®ã´ã£ãããã®è¨å®ã®è©³ç´°ãªèª¬æãããï¼ã
2.1 æ¬ è½ãã¼ã¿
summarytoolsã®ä¸»ãªç®çã®1ã¤ã¯ããããªãåæã®ããã®ãã¼ã¿ã®ã¯ãªã¼ãã³ã°ã¨æºåãæ¯æ´ãããã¨ã§ãããããããç¶æ³ã«ãã£ã¦ã¯ãæ¬ æãã¼ã¿ã«é¢ããæ å ±ãå¿ è¦ã¨ããªãï¼ãããã¯æ¢ã«æã£ã¦ããï¼å ´åããããreport.nas = FALSEã使ç¨ããã¨ãåºå表ã¯1è¡2åã¨å°ãããªãï¼
freq(iris$Species, report.nas = FALSE, headings = FALSE)
Freq % % Cum.
setosa 50 33.33 33.33
versicolor 50 33.33 66.67
virginica 50 33.33 100.00
Total 150 100.00 100.00
headings = FALSE ãã©ã¡ã¼ã¿ã¼ã¯è¦åºãã»ã¯ã·ã§ã³ãæå¶ããã
2.2 æãåç´ãªå¼ ãã¹ã¦ã®ãªãã·ã§ã³è¦ç´ ã "ãªã "ã«ãããã¨ã§ãããã·ã³ãã«ãªè¡¨ãåºæ¥ä¸ããï¼
freq(iris$Species, report.nas = FALSE, totals = FALSE, cumul = FALSE, headings = FALSE)
Freq %
setosa 50 33.33
versicolor 50 33.33
virginica 50 33.33
åºåã¯ããªãç°¡ç¥åããã¦ããããæ§æã¯ãããªã£ã¦ããªããTeslerã®è¤éãä¿åã®æ³åã®ãããã§ããï¼ããããããã¨ã«ãst_options()ãã¿ããªã®å¥½ã¿ã«ã¢ã³ã¢ãã¼ã·ã§ã³ãã¦ãããï¼ããã±ã¼ã¸ã»ãªãã·ã§ã³ã®ã»ã¯ã·ã§ã³ãåç §ï¼ã
2.3 ä¸åº¦ã«è¤æ°ã®åº¦æ°è¡¨
ãã¼ã¿ãã¬ã¼ã å ã®ãã¹ã¦ã®å¤æ°ã®åº¦æ°è¡¨ãçæããããã«ãlapply() ã使ç¨ãããã¨ãã§ããï¼åæã®ãã¼ã¸ã§ã³ã§ã¯å¿ è¦ã§ãã£ãï¼ãããããfreq() ã¯ãã¼ã¿ãã¬ã¼ã ã主å¼æ°ã¨ãã¦åãåãã®ã§ãããã¯å¿ è¦ãªãã
freq(tobacco)
Variable(s) ignored: age, BMI, cigs.per.day Frequencies tobacco$gender Type: Factor Freq % Valid % Valid Cum. % Total % Total Cum. ----------- ------ --------- -------------- --------- -------------- F 489 50.00 50.00 48.90 48.90 M 489 50.00 100.00 48.90 97.80 <NA> 22 2.20 100.00 Total 1000 100.00 100.00 100.00 100.00 tobacco$age.gr Type: Factor Freq % Valid % Valid Cum. % Total % Total Cum. ----------- ------ --------- -------------- --------- -------------- 18-34 258 26.46 26.46 25.80 25.80 35-50 241 24.72 51.18 24.10 49.90 51-70 317 32.51 83.69 31.70 81.60 71 + 159 16.31 100.00 15.90 97.50 <NA> 25 2.50 100.00 Total 1000 100.00 100.00 100.00 100.00 tobacco$smoker Type: Factor Freq % Valid % Valid Cum. % Total % Total Cum. ----------- ------ --------- -------------- --------- -------------- Yes 298 29.80 29.80 29.80 29.80 No 702 70.20 100.00 70.20 100.00 <NA> 0 0.00 100.00 Total 1000 100.00 100.00 100.00 100.00 tobacco$diseased Type: Factor Freq % Valid % Valid Cum. % Total % Total Cum. ----------- ------ --------- -------------- --------- -------------- Yes 224 22.40 22.40 22.40 22.40 No 776 77.60 100.00 77.60 100.00 <NA> 0 0.00 100.00 Total 1000 100.00 100.00 100.00 100.00 tobacco$disease Type: Character Freq % Valid % Valid Cum. % Total % Total Cum. --------------------- ------ --------- -------------- --------- -------------- Cancer 34 15.32 15.32 3.40 3.40 Cholesterol 21 9.46 24.77 2.10 5.50 Diabetes 14 6.31 31.08 1.40 6.90 Digestive 12 5.41 36.49 1.20 8.10 Hearing 14 6.31 42.79 1.40 9.50 Heart 20 9.01 51.80 2.00 11.50 Hypertension 36 16.22 68.02 3.60 15.10 Hypotension 11 4.95 72.97 1.10 16.20 Musculoskeletal 19 8.56 81.53 1.90 18.10 Neurological 10 4.50 86.04 1.00 19.10 Other 2 0.90 86.94 0.20 19.30 Pulmonary 20 9.01 95.95 2.00 21.30 Vision 9 4.05 100.00 0.90 22.20 <NA> 778 77.80 100.00 Total 1000 100.00 100.00 100.00 100.00 tobacco$samp.wgts Type: Numeric Freq % Valid % Valid Cum. % Total % Total Cum. ----------------------- ------ --------- -------------- --------- -------------- 0.861423220973783 267 26.70 26.70 26.70 26.70 1.04417670682731 249 24.90 51.60 24.90 51.60 1.04938271604938 324 32.40 84.00 32.40 84.00 1.0625 160 16.00 100.00 16.00 100.00 <NA> 0 0.00 100.00 Total 1000 100.00 100.00 100.00 100.00
çµæãä¹±éã«ãªãã®ãé¿ããããã25以ä¸ã®æ確ãªå¤ãæã¤æ°å¤åã¯ç¡è¦ãããããã®ãããå¤25ã¯ãst_options()
ã使ã£ã¦å¤æ´ãããã¨ãã§ãããä¾ãã°ã10ã«å¤æ´ããã«ã¯ãst_options(freq.ignore.threshold = 10)
ã使ãã
ã¿ãã³ã®ãã¼ã¿ãã¬ã¼ã ã¯ã·ãã¥ã¬ã¼ãããããã¼ã¿ãå«ã¿ãããã±ã¼ã¸ã«å«ã¾ãã¦ããããã1ã¤ã®ã·ãã¥ã¬ã¼ãããããã¼ã¿ãã¬ã¼ã ã¯è©¦é¨ã ãã©ã¡ãããã©ã³ã¹èªçï¼tabagisme, examensï¼ãããã
2.4 度æ°è¡¨ã®ãµãã»ããåï¼ãã£ã«ã¿ãªã³ã°)
rowsãã©ã¡ã¼ã¿ã¯ã度æ°è¡¨ããµãã»ãããããã¨ãã§ããï¼
-è¡ã®åºç¾é åºã§ãã£ã«ã¿ãªã³ã°ããã«ã¯ãæ°å¤ãã¯ãã«ã使ç¨ãã¾ã; rows = 1:10 ã¯ãæåã®10åã®å¤ã®åº¦æ°ã®ã¿ã表示ããã表示ãããªãå¤ã®åº¦æ°ãèæ
®ããããã«ã"(Other) "è¡ãèªåçã«è¿½å ããã¾ãã
-ååã«ãã£ã¦è¡ããã£ã«ã¿ãªã³ã°ããã«ã¯ã次ã®ããããã使ç¨ã§ããã
-- ä¿æããããã¹ã¦ã®è¡åãæå®ããæåãã¯ãã«ã
-- æ£è¦è¡¨ç¾ã¨ãã¦ä½¿ç¨ãããåä¸ã®æååï¼ãã®ãããã¯ã®è©³ç´°ã«ã¤ãã¦ã¯ã?regex
ãåç
§ï¼ã
æãä¸è¬çãªä¾¡å¤è¦³ã示ã
orderãã©ã¡ã¼ã¿ã¨rowsãã©ã¡ã¼ã¿ãçµã¿åããããã¨ã§ãçµæãç°¡åã«ãã£ã«ã¿ãªã³ã°ãã¦ãä¾ãã°å åã®ä¸ã§æãä¸è¬çãª5ã¤ã®å¤ã表示ãããã¨ãã§ããï¼
freq(tobacco$disease, order = "freq", rows = 1:5, headings = FALSE)
Freq % Valid % Valid Cum. % Total % Total Cum. ------------------ ------ --------- -------------- --------- -------------- Hypertension 36 16.22 16.22 3.60 3.60 Cancer 34 15.32 31.53 3.40 7.00 Cholesterol 21 9.46 40.99 2.10 9.10 Heart 20 9.01 50.00 2.00 11.10 Pulmonary 20 9.01 59.01 2.00 13.10 (Other) 91 40.99 100.00 9.10 22.20 <NA> 778 77.80 100.00 Total 1000 100.00 100.00 100.00 100.00
freq "ã®ä»£ããã«"-freq "ã使ãã°ãé åºãéã«ããé »åº¦ã®ä½ããã®ããé«ããã®ã¸ã¨ã©ã³ã¯ä»ããããçµæãå¾ããã¨ãã§ããã
â(Other)âã®è¡ã«æ³¨ç®ãããã¯èªåçã«çæãããã
2.5 æãããã¿å¯è½ãªã»ã¯ã·ã§ã³
html çµæãçæããå ´åãcollapse = TRUE å¼æ°ã print() ã¾ã㯠view() / stview()ã§ä½¿ç¨ããæãããã¿å¯è½ãªã»ã¯ã·ã§ã³ãå¾ãã
view(freq(tobacco), collapse = TRUE)
3. ã¯ãã¹éè¨ï¼ ctable()
ctable()
ã¯ãã«ãã´ãªå¤æ°ã®ãã¢ã®ã¯ãã¹éè¨ï¼çµå度æ°ï¼ãçæããã
ã¿ãã³ã®ã·ãã¥ã¬ã¼ããã¼ã¿ãã¬ã¼ã ãç¨ãã¦ã2ã¤ã®ã«ãã´ãªã¼å¤æ°smokerã¨diseasedãã¯ãã¹éè¨ããã
ctable(x = tobacco$smoker, y = tobacco$diseased, prop = "r") # è¡ã®æ¯çã表示ãã
Cross-Tabulation, Row Proportions smoker * diseased Data Frame: tobacco -------- ---------- ------------- ------------- --------------- diseased Yes No Total smoker Yes 125 (41.9%) 173 (58.1%) 298 (100.0%) No 99 (14.1%) 603 (85.9%) 702 (100.0%) Total 224 (22.4%) 776 (77.6%) 1000 (100.0%) -------- ---------- ------------- ------------- ---------------
ã覧ã®ããã«ããã¼ã¯ãã¦ã³ã¯è¤æ°è¡ã®è¡¨è¦åºããå®å ¨ã«ãµãã¼ããã¦ããªããããpanderã¯ãã®ç¹æ®ãªã¿ã¤ãã®è¡¨ã表示ããããã«ã§ãããã¨ãè¡ããããè¯ãçµæãå¾ãããã«ã¯ã"render "ã¡ã½ãããæ¨å¥¨ããã次ã®ä¾ã§ä½¿ç¨ãããã
3.1 è¡ãåãã¾ãã¯å ¨ä½ã®å²å
è¡ã®æ¯çã¯ããã©ã«ãã§è¡¨ç¤ºããããåã¾ãã¯åè¨ã®æ¯çã表示ããã«ã¯ããããã prop = "c" ã¾ã㯠prop = "t" ã使ç¨ãããæ¯çãå®å ¨ã«çç¥ããã«ã¯ãprop = "n "ã使ç¨ããã
3.2 æå°éã®ã¯ãã¹éè¨
with(tobacco, print(ctable(x = smoker, y = diseased, prop = 'n', totals = FALSE, headings = FALSE), method = "render") )
diseased | ||
---|---|---|
smoker | Yes | No |
Yes | 125 | 173 |
No | 99 | 603 |
Generated by summarytools 1.0.1 (R version 4.3.1)
2023-09-28
3.3 ã«ã¤äºä¹ï¼ð2ï¼ããªããºæ¯ããªã¹ã¯æ¯
ã«ã¤2ä¹çµ±è¨éã表示ããã«ã¯ãchisq = TRUEã¨è¨å®ããã2Ã2ã®è¡¨ã§ã¯ããªããºæ¯ã¨ãªã¹ã¯æ¯ï¼ç¸å¯¾ãªã¹ã¯ã¨ãããï¼ã表示ããããã«ãããããORã¨RRã使ç¨ããããããã¯TRUEã«è¨å®ã§ãããã®å ´åã¯95%ä¿¡é ¼åºéã表示ããã; ç°ãªãä¿¡é ¼æ°´æºã使ç¨ããã«ã¯ãä¾ãã°OR = .90ã使ç¨ããã
library(magrittr) tobacco %$% # Acts like with(tobacco, ...) ctable(x = smoker, y = diseased, chisq = TRUE, OR = TRUE, RR = TRUE, headings = FALSE) %>% print(method = "render")
diseased | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
smoker | Yes | No | Total | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Yes | 125 | ( | 41.9% | ) | 173 | ( | 58.1% | ) | 298 | ( | 100.0% | ) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
No | 99 | ( | 14.1% | ) | 603 | ( | 85.9% | ) | 702 | ( | 100.0% | ) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Total | 224 | ( | 22.4% | ) | 776 | ( | 77.6% | ) | 1000 | ( | 100.0% | ) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Χ2 = 91.7088 df = 1 p = .0000 O.R. (95% C.I.) = 4.40 (3.22 - 6.02) R.R. (95% C.I.) = 2.97 (2.37 - 3.73) |
Generated by summarytools 1.0.1 (R version 4.3.1)
2023-09-28
4. è¨è¿°çµ±è¨éï¼ descr()
descr()
ã¯ãè¨è¿°çµ±è¨é/åå¤éçµ±è¨éãããªãã¡ä¸è¬çãªä¸å¿å¾åçµ±è¨éã¨åæ£å°ºåº¦ãçæãããå¾è
ã®å ´åãæ°å¤ä»¥å¤ã®åã¯ãã¹ã¦ç¡è¦ããããã®æ¨ã®ã¡ãã»ã¼ã¸ã表示ãããã
descr(iris)
Non-numerical variable(s) ignored: Species Descriptive Statistics iris N: 150 Petal.Length Petal.Width Sepal.Length Sepal.Width ----------------- -------------- ------------- -------------- ------------- Mean 3.76 1.20 5.84 3.06 Std.Dev 1.77 0.76 0.83 0.44 Min 1.00 0.10 4.30 2.00 Q1 1.60 0.30 5.10 2.80 Median 4.35 1.30 5.80 3.00 Q3 5.10 1.80 6.40 3.30 Max 6.90 2.50 7.90 4.40 MAD 1.85 1.04 1.04 0.44 IQR 3.50 1.50 1.30 0.50 CV 0.47 0.64 0.14 0.14 Skewness -0.27 -0.10 0.31 0.31 SE.Skewness 0.20 0.20 0.20 0.20 Kurtosis -1.42 -1.36 -0.61 0.14 N.Valid 150.00 150.00 150.00 150.00 Pct.Valid 100.00 100.00 100.00 100.00
å¤æ°åã¡ãã»ã¼ã¸ããªãã«ããã«ã¯ãsilent = TRUEã使ç¨ããããã®ãªãã·ã§ã³ã¯ã°ãã¼ãã«ã«è¨å®ãããã¨ãå¯è½ã§ãããã§ã¯ãããè¡ãã®ã§ããã®ããããã®æ®ãã®é¨åã§ã¯è¡¨ç¤ºãããªãã
st_options(descr.silent = TRUE)
5. ãã¼ã¿ãã¬ã¼ã ã®è¦ç´: dfSummary()
dfSummary() ã¯ããã¼ã¿ãã¬ã¼ã å ã®ãã¹ã¦ã®å¤æ°ã®çµ±è¨ã度æ°ãã°ã©ããå«ãè¦ç´è¡¨ãä½æããã表示ãããæ å ±ã¯ãåï¼æåãå åãæ°å¤ãæ¥ä»ï¼ã«åºæã§ãããæ確ãªå¤ã®æ°ã«ãã£ã¦ãç°ãªãã
RStudio ã®ãã¥ã¼ã¢ï¼ã¾ãã¯ä»ã® IDE ãã¿ã¼ããã«ã¦ã£ã³ãã¦ã§ä½æ¥ãã¦ããå ´åã¯ããã©ã«ãã® Web ãã©ã¦ã¶ï¼ã§çµæã表示ããã«ã¯ãview() é¢æ°ã使ç¨ããããååã競åããå ´åã¯ãã®ååã® stview() ã使ç¨ããï¼
view(dfSummary(iris))
Vieweræ¬ã«HTMLã§åºåããã
View()
ã§ã¯ãªã view()
ã使ãããã«æ³¨æãããã¨ãå¾è
ã使ç¨ããã¨ãçµæããã¼ã¿ã»ãã¥ã¼ã¯ã«è¡¨ç¤ºããã¦ãã¾ãã¾ãã
ã¾ããããã±ã¼ã¸ããã¼ããããé çªã«ã注æãã¦ãã ãããä¸é¨ã®ããã±ã¼ã¸ã¯view()
ãåå®ç¾©ãã¦View()
ãæãããã«ããããããã®ããã±ã¼ã¸ã®å¾ã«summarytoolsããã¼ãããã¨ãããèªèº«ã®view()
ãæ£ããåä½ããããã«ãªããããã§ãªããã°ãstview()
ã¯å¸¸ã«ç¢ºå®ãªä»£æ¿æ段ã¨ãã¦åå¨ããã
5.1 R Markdownææ¸ã§ã®dfSummary()ã®ä½¿ç¨
Rã®Markdownããã¥ã¡ã³ãã§dfSummary()ã使ç¨ããå ´åããã¼ã¸ã³ã®ãªã¼ãã¼ããã¼ãé¿ããããã«ãä¸è¬çã«1ã¤ã2ã¤ã®ã«ã©ã ãé¤å¤ããã®ãè¯ãã¢ã¤ãã¢ã§ãããValidåã¨Missingåã¯åé·ãªã®ã§ãã©ã¡ããä¸æ¹ãåé¤ããã°ããã
dfSummary(tobacco, plain.ascii = FALSE, style = "grid", graph.magnif = 0.75, valid.col = FALSE, tmp.img.dir = "/tmp")
+----+---------------+--------------------------+---------------------+-------------------------+---------+ | No | Variable | Stats / Values | Freqs (% of Valid) | Graph | Missing | +====+===============+==========================+=====================+=========================+=========+ | 1 | gender\ | 1\. F\ | 489 (50.0%)\ | ![](/tmp/ds0001.png) | 22\ | | | [factor] | 2\. M | 489 (50.0%) | | (2.2%) | +----+---------------+--------------------------+---------------------+-------------------------+---------+ | 2 | age\ | Mean (sd) : 49.6 (18.3)\ | 63 distinct values | ![](/tmp/ds0002.png) | 25\ | | | [numeric] | min < med < max:\ | | | (2.5%) | | | | 18 < 50 < 80\ | | | | | | | IQR (CV) : 32 (0.4) | | | | +----+---------------+--------------------------+---------------------+-------------------------+---------+ | 3 | age.gr\ | 1\. 18-34\ | 258 (26.5%)\ | ![](/tmp/ds0003.png) | 25\ | | | [factor] | 2\. 35-50\ | 241 (24.7%)\ | | (2.5%) | | | | 3\. 51-70\ | 317 (32.5%)\ | | | | | | 4\. 71 + | 159 (16.3%) | | | +----+---------------+--------------------------+---------------------+-------------------------+---------+ | 4 | BMI\ | Mean (sd) : 25.7 (4.5)\ | 974 distinct values | ![](/tmp/ds0004.png) | 26\ | | | [numeric] | min < med < max:\ | | | (2.6%) | | | | 8.8 < 25.6 < 39.4\ | | | | | | | IQR (CV) : 5.7 (0.2) | | | | +----+---------------+--------------------------+---------------------+-------------------------+---------+ | 5 | smoker\ | 1\. Yes\ | 298 (29.8%)\ | ![](/tmp/ds0005.png) | 0\ | | | [factor] | 2\. No | 702 (70.2%) | | (0.0%) | +----+---------------+--------------------------+---------------------+-------------------------+---------+ | 6 | cigs.per.day\ | Mean (sd) : 6.8 (11.9)\ | 37 distinct values | ![](/tmp/ds0006.png) | 35\ | | | [numeric] | min < med < max:\ | | | (3.5%) | | | | 0 < 0 < 40\ | | | | | | | IQR (CV) : 11 (1.8) | | | | +----+---------------+--------------------------+---------------------+-------------------------+---------+ | 7 | diseased\ | 1\. Yes\ | 224 (22.4%)\ | ![](/tmp/ds0007.png) | 0\ | | | [factor] | 2\. No | 776 (77.6%) | | (0.0%) | +----+---------------+--------------------------+---------------------+-------------------------+---------+ | 8 | disease\ | 1\. Hypertension\ | 36 (16.2%)\ | ![](/tmp/ds0008.png) | 778\ | | | [character] | 2\. Cancer\ | 34 (15.3%)\ | | (77.8%) | | | | 3\. Cholesterol\ | 21 ( 9.5%)\ | | | | | | 4\. Heart\ | 20 ( 9.0%)\ | | | | | | 5\. Pulmonary\ | 20 ( 9.0%)\ | | | | | | 6\. Musculoskeletal\ | 19 ( 8.6%)\ | | | | | | 7\. Diabetes\ | 14 ( 6.3%)\ | | | | | | 8\. Hearing\ | 14 ( 6.3%)\ | | | | | | 9\. Digestive\ | 12 ( 5.4%)\ | | | | | | 10\. Hypotension\ | 11 ( 5.0%)\ | | | | | | [ 3 others ] | 21 ( 9.5%) | | | +----+---------------+--------------------------+---------------------+-------------------------+---------+ | 9 | samp.wgts\ | Mean (sd) : 1 (0.1)\ | 0.86!: 267 (26.7%)\ | ![](/tmp/ds0009.png) \ | 0\ | | | [numeric] | min < med < max:\ | 1.04!: 249 (24.9%)\ | \ | (0.0%) | | | | 0.9 < 1 < 1.1\ | 1.05!: 324 (32.4%)\ | | | | | | IQR (CV) : 0.2 (0.1) | 1.06!: 160 (16.0%)\ | | | | | | | ! rounded | | | +----+---------------+--------------------------+---------------------+-------------------------+---------+
tmp.img.dirãã©ã¡ã¼ã¿ã¯ãhtmlã¬ã³ããªã³ã°ãé¤ããR Markdownããã¥ã¡ã³ãã§dfSummariesãçæããéã«ã¯å¿ é ã§ãããããã«ã¤ãã¦ã®èª¬æã¯å¾è¿°ããã
è¦åãã£ã³ã¯ãªãã·ã§ã³ãFALSEã«è¨å®ãããã¨ã§ãè¦åãåé¿ãããã¨ãã§ããã{r chunk_name, results="asis", warning=FALSE}.
5.2 ãªãã·ã§ã³ã®çµ±è¨
ãã®æ©è½ã¯ããã±ã¼ã¸ããªãªã¼ã¹ããã¦ä»¥æ¥ãä½åº¦ãè¦æããã£ããã®ã§ããããã¼ã¸ã§ã³1.0.0ã§å°å ¥ãããStats/Valuesåã«ã©ã®çµ±è¨éã表示ããããã³ã³ããã¼ã«ã§ããããã«ãªã£ããããªãã¡ãIQR (CV)ã表示ãã3è¡ç®ã¯ãRã§å©ç¨å¯è½ãªçµ±è¨éã表示ããããã«å¤æ´ãããã¨ãã§ããããã®æ©è½ã使ç¨ããã«ã¯ãst_options()ã使ç¨ãã¦ã次ã®ããã«dfSummary.custom.1ããã³/ã¾ãã¯dfSummary.custom.2ãå®ç¾©ããã³ã¼ããexpression()å ã«ã«ãã»ã«åããï¼
st_options( dfSummary.custom.1 = expression( paste( "Q1 - Q3 :", round( quantile(column_data, probs = .25, type = 2, names = FALSE, na.rm = TRUE), digits = 1 ), " - ", round( quantile(column_data, probs = .75, type = 2, names = FALSE, na.rm = TRUE), digits = 1 ) ) ) ) print( dfSummary(iris, varnumbers = FALSE, na.col = FALSE, style = "multiline", plain.ascii = FALSE, headings = FALSE, graph.magnif = .8), method = "render" )
ããdfSummary.custom.1ã®ä»£ããã«dfSummary.custom.2ã使ç¨ãã¦ããããããã©ã«ãã®IQR(CV)è¡ã®ä¸ã«4è¡ç®ã追å ããã¦ããã ããã
round()ã®ä»£ããã«ãå é¨å¤æ°format_number()ã使ç¨ãããã¨ãå¯è½ã§ãããã¨ã«æ³¨æãã¦ã»ããããã®format_number()ã¯ãæå®ããããã¹ã¦ã®å¼æ°ï¼åæ¨äºå ¥ã®æ¡æ°ãå°æ°ç¹ãã¼ã¯ãåã®ä½ãã¼ã¯ãªã©ï¼ã«å¾ã£ã¦æ°å¤ããã©ã¼ãããããããã¨ãä¿è¨¼ãããst_options("round.digits")ã®å¤ãæ ¼ç´ããå é¨å¤æ°round.digitsã使ç¨ã§ãããããã¯ãããã©ã«ãIQR (CV)ãã©ã®ããã«å®ç¾©ããã¦ãããã§ãã - ããã§ã¯ãæåã®ã«ã¹ã¿ã statãããã©ã«ãå¤ã«æ»ãããã®å®ç¾©ã表示ããï¼formatR::tidy_source()ã¯ãå¼ããã©ã¼ããã/ã¤ã³ãã³ãããããã«ä½¿ç¨ãããï¼ï¼
library(formatR) st_options(dfSummary.custom.1 = "default") formatR::tidy_source( text = deparse(st_options("dfSummary.custom.1")), indent = 2, args.newline = TRUE )
expression( paste( paste0( trs("iqr"), " (", trs("cv"), ") : " ), format_number( IQR(column_data, na.rm = TRUE), round.digits ), " (", format_number( sd(column_data, na.rm = TRUE)/mean(column_data, na.rm = TRUE), round.digits ), ")", collapse = "", sep = "" ) )
ãã®ãã©ã¡ã¼ã¿ã使ç¨ãããã¹ã¦ã®é¢æ°ï¼Rã®åºæ¬é¢æ°ã®ã»ã¨ãã©ï¼ã§na.rm = TRUEãæå®ãããã¨ãå¿ããªãã§ã»ããã
5.3 ãã®ä»ã®æ³¨ç®ãã¹ãæ©è½
dfSummary()
é¢æ°ã«ã¯ã以ä¸ã®æ©è½ãããã
- è¦åºãã»ã¯ã·ã§ã³ã§éè¤ã¬ã³ã¼ãã®æ°ãå ±åãã
- UPC/EAN ã³ã¼ã (ãã¼ã³ã¼ãçªå·) ãæ¤åºãããããã«ç¡é¢ä¿ãªçµ±è¨ã¯è¨ç®ããªãã
- æå¹ãªã¢ãã¬ã¹ã¨ç¡å¹ãªã¢ãã¬ã¹ã®å²åãåè¨ãã㨠100%ã«ãªããã¨ã«æ³¨æãã¦æ¬²ãããéè¤ã®å²åã¯ç¬èªã«è¨ç®ããããããæ£ã°ã©ã (html ãã¼ã¸ã§ã³)ã§ã¯ãã®ã«ãã´ãªã®æ£ã°ã©ãã¯å¥ã®è²ã§è¡¨ç¤ºãããã
max.tbl.height
ãã©ã¡ã¼ã¿ã使ç¨ãããã¨ã§ã"windowed "çµæã表示ãããã¨ãã§ãã;ããã¯ãåæããããã¼ã¿ãã¬ã¼ã ãå¤æ°ã®å¤æ°ãæã¤å ´åã«ç¹ã«ä¾¿å©ã§ãã; 詳細ã¯vignette("rmarkdown", package = "summarytools")
ãåç §ã
5.4 åã®é¤å¤
ã»ã¨ãã©ã®ã«ã©ã ã¯é¢æ°ã®ãã©ã¡ã¼ã¿ã使ã£ã¦é¤å¤ãããã¨ãã§ãããã以ä¸ã®ã·ã³ã¿ãã¯ã¹ã使ã£ã¦ã«ã©ã ãåé¤ãããã¨ãå¯è½ã§ããï¼çµæã¯ç¤ºãã¦ããªãï¼ï¼
dfs <- dfSummary(iris) dfs$Variable <- NULL # ãã㯠"Variable "ã«ã©ã ãåé¤ãã
6. ã°ã«ã¼ãåãããçµ±è¨ï¼ stby()
æé©ãªçµæãçæããããã«ãsummarytoolsã¯ãã¼ã¹ã¨ãªãby()é¢æ°ã®ç¬èªã®ãã¼ã¸ã§ã³ãæã£ã¦ãã¾ããããã¯stby()
ã¨å¼ã°ããby()
ã¨å
¨ãåãããã«ä½¿ç¨ããï¼
(iris_stats_by_species <- stby(data = iris, INDICES = iris$Species, FUN = descr, stats = "common", transpose = TRUE))
Descriptive Statistics iris Group: Species = setosa N: 50 Mean Std.Dev Min Median Max N.Valid Pct.Valid ------------------ ------ --------- ------ -------- ------ --------- ----------- Petal.Length 1.46 0.17 1.00 1.50 1.90 50.00 100.00 Petal.Width 0.25 0.11 0.10 0.20 0.60 50.00 100.00 Sepal.Length 5.01 0.35 4.30 5.00 5.80 50.00 100.00 Sepal.Width 3.43 0.38 2.30 3.40 4.40 50.00 100.00 Group: Species = versicolor N: 50 Mean Std.Dev Min Median Max N.Valid Pct.Valid ------------------ ------ --------- ------ -------- ------ --------- ----------- Petal.Length 4.26 0.47 3.00 4.35 5.10 50.00 100.00 Petal.Width 1.33 0.20 1.00 1.30 1.80 50.00 100.00 Sepal.Length 5.94 0.52 4.90 5.90 7.00 50.00 100.00 Sepal.Width 2.77 0.31 2.00 2.80 3.40 50.00 100.00 Group: Species = virginica N: 50 Mean Std.Dev Min Median Max N.Valid Pct.Valid ------------------ ------ --------- ------ -------- ------ --------- ----------- Petal.Length 5.55 0.55 4.50 5.55 6.90 50.00 100.00 Petal.Width 2.03 0.27 1.40 2.00 2.50 50.00 100.00 Sepal.Length 6.59 0.64 4.90 6.50 7.90 50.00 100.00 Sepal.Width 2.97 0.32 2.20 3.00 3.80 50.00 100.00
6.1 stby()ã«ããdescr()ã®ç¹æ®ã±ã¼ã¹
stby()ã¯ãåä¸å¤æ°ã®åå²ã°ã«ã¼ãçµ±è¨éãçæããããã«ä½¿ç¨ããã¨ãä¸é£ã®1åã®è¡¨ã表示ãã代ããã«ããã¹ã¦ã1ã¤ã®è¡¨ã«ã¾ã¨ããã
with(tobacco, stby(data = BMI, INDICES = age.gr, FUN = descr, stats = c("mean", "sd", "min", "med", "max")) )
Descriptive Statistics BMI by age.gr Data Frame: tobacco N: 258 18-34 35-50 51-70 71 + ------------- ------- ------- ------- ------- Mean 23.84 25.11 26.91 27.45 Std.Dev 4.23 4.34 4.26 4.37 Min 8.83 10.35 9.01 16.36 Median 24.04 25.11 26.77 27.52 Max 34.84 39.44 39.21 38.37
6.2 stby() 㨠ctable() ã®ä½µç¨
ãã®çµã¿åããã§ã¯æ§æãå°ãé£ããã®ã§ã以ä¸ã«ä¾ã示ãï¼
stby(data = list(x = tobacco$smoker, y = tobacco$diseased), INDICES = tobacco$gender, FUN = ctable) # or equivalently with(tobacco, stby(data = list(x = smoker, y = diseased), INDICES = gender, FUN = ctable))
Cross-Tabulation, Row Proportions smoker * diseased Data Frame: tobacco Group: gender = F -------- ---------- ------------- ------------- -------------- diseased Yes No Total smoker Yes 62 (42.2%) 85 (57.8%) 147 (100.0%) No 49 (14.3%) 293 (85.7%) 342 (100.0%) Total 111 (22.7%) 378 (77.3%) 489 (100.0%) -------- ---------- ------------- ------------- -------------- Group: gender = M -------- ---------- ------------- ------------- -------------- diseased Yes No Total smoker Yes 63 (44.1%) 80 (55.9%) 143 (100.0%) No 47 (13.6%) 299 (86.4%) 346 (100.0%) Total 110 (22.5%) 379 (77.5%) 489 (100.0%) -------- ---------- ------------- ------------- -------------- Cross-Tabulation, Row Proportions smoker * diseased Data Frame: tobacco Group: gender = F -------- ---------- ------------- ------------- -------------- diseased Yes No Total smoker Yes 62 (42.2%) 85 (57.8%) 147 (100.0%) No 49 (14.3%) 293 (85.7%) 342 (100.0%) Total 111 (22.7%) 378 (77.3%) 489 (100.0%) -------- ---------- ------------- ------------- -------------- Group: gender = M -------- ---------- ------------- ------------- -------------- diseased Yes No Total smoker Yes 63 (44.1%) 80 (55.9%) 143 (100.0%) No 47 (13.6%) 299 (86.4%) 346 (100.0%) Total 110 (22.5%) 379 (77.5%) 489 (100.0%) -------- ---------- ------------- ------------- --------------
7. ã°ã«ã¼ãåãããçµ±è¨: group_by()
freq()
ãdescr()
ãã¾ãã¯dfSummary()
ã使ç¨ãã¦ã°ã«ã¼ãåãããçµ±è¨éãä½æããããã«ãstby()ã®ä»£æ¿ã¨ãã¦dplyrã®group_by()
ã使ç¨ãããã¨ãå¯è½ã§ãããæ§æã®éãã¯ãã¦ããã1ã¤ã®éè¦ãªéãã¯ãgroup_by()
ããforcats::fct_explicit_na
ã使ç¨ãã¦å æ°ã§NAãæ示ãããã¨ã示åããè¦åã¯ãããã®ã®ãã°ã«ã¼ãåå¤æ°ã®NAå¤ãæå¹ãªã«ãã´ãªã¨ã¿ãªããã¨ã§ãããã®ã¢ããã¤ã¹ã«å¾ãã¨
library(dplyr) tobacco$gender %<>% forcats::fct_explicit_na() tobacco %>% group_by(gender) %>% descr(stats = "fivenum")
tobacco Group: gender = F N: 489 age BMI cigs.per.day samp.wgts ------------ ------- ------- -------------- ----------- Min 18.00 9.01 0.00 0.86 Q1 34.00 22.98 0.00 0.86 Median 50.00 25.87 0.00 1.04 Q3 66.00 29.48 10.50 1.05 Max 80.00 39.44 40.00 1.06 Group: gender = M N: 489 age BMI cigs.per.day samp.wgts ------------ ------- ------- -------------- ----------- Min 18.00 8.83 0.00 0.86 Q1 34.00 22.52 0.00 0.86 Median 49.50 25.14 0.00 1.04 Q3 66.00 27.96 11.00 1.05 Max 80.00 36.76 40.00 1.06 Group: gender = (Missing) N: 22 age BMI cigs.per.day samp.wgts ------------ ------- ------- -------------- ----------- Min 19.00 20.24 0.00 0.86 Q1 36.00 24.97 0.00 1.04 Median 55.50 27.16 0.00 1.05 Q3 64.00 30.23 10.00 1.05 Max 80.00 32.43 28.00 1.06
8. æ´é ããããã¼ãã« : tb()
freq()
ã¾ãã¯descr()
ãã¼ãã«ãçæããéãtb()é¢æ°ï¼tbãtibbleã®ç縮形ã¨èããï¼ã使ç¨ãããã¨ã§ãçµæããæ´ç¶ã¨ããããã¼ãã«ã«ãããã¨ãå¯è½ã§ãããä¾ãã°
library(magrittr) iris %>% descr(stats = "common") %>% tb()
# A tibble: 4 Ã 8 variable mean sd min med max n.valid pct.valid <chr> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> 1 Petal.Length 3.76 1.77 1 4.35 6.9 150 100 2 Petal.Width 1.20 0.762 0.1 1.3 2.5 150 100 3 Sepal.Length 5.84 0.828 4.3 5.8 7.9 150 100 4 Sepal.Width 3.06 0.436 2 3 4.4 150 100
iris$Species %>% freq(cumul = FALSE, report.nas = FALSE) %>% tb()
# A tibble: 3 Ã 3 Species freq pct <fct> <dbl> <dbl> 1 setosa 50 33.3 2 versicolor 50 33.3 3 virginica 50 33.3
å®ç¾©ã«ãããåè¨è¡ã¯æ´é ããã表ã®ä¸é¨ã§ã¯ãªããè¡åã¯é常ã®åã«å¤æããã¾ãã
rmarkdownã使ç¨ãã¦tibblesã表示ããå ´åãknitrã®ãã£ã³ã¯ãªãã·ã§ã³ã®çµæã'asis'ã§ã¯ãªã'markup'ã«è¨å®ããå¿ è¦ãããã
8.1 æ´ç¶ã¨ããã¹ããªããã»ã°ã«ã¼ãçµ±è¨
stby()
ã¾ãã¯group_by()
ã使ç¨ãã¦ä½æããããªã¹ãããã©ã®ããã«æ´é ãããtibblesã«å¤æããããã示ãããã¤ãã®ä¾ã示ãã¾ãã
grouped_descr <- stby(data = exams, INDICES = exams$gender, FUN = descr, stats = "common") grouped_descr %>% tb()
# A tibble: 12 Ã 9 gender variable mean sd min med max n.valid pct.valid <fct> <chr> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> 1 Girl economics 72.5 7.79 62.3 70.2 89.6 14 93.3 2 Girl english 73.9 9.41 58.3 71.8 93.1 14 93.3 3 Girl french 71.1 12.4 44.8 68.4 93.7 14 93.3 4 Girl geography 67.3 8.26 50.4 67.3 78.9 15 100 5 Girl history 71.2 9.17 53.9 72.9 86.4 15 100 6 Girl math 73.8 9.03 55.6 74.8 86.3 14 93.3 7 Boy economics 75.2 9.40 60.5 71.7 94.2 15 100 8 Boy english 77.8 5.94 69.6 77.6 90.2 15 100 9 Boy french 76.6 8.63 63.2 74.8 94.7 15 100 10 Boy geography 73 12.4 47.2 71.2 96.3 14 93.3 11 Boy history 74.4 11.2 54.4 72.6 93.5 15 100 12 Boy math 73.3 9.68 60.5 72.2 93.2 14 93.3
orderãã©ã¡ã¼ã¿ã¯è¡ã®é åºãå¶å¾¡ããï¼
grouped_descr %>% tb(order = 2)
# A tibble: 12 Ã 9 gender variable mean sd min med max n.valid pct.valid <fct> <chr> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> 1 Girl economics 72.5 7.79 62.3 70.2 89.6 14 93.3 2 Boy economics 75.2 9.40 60.5 71.7 94.2 15 100 3 Girl english 73.9 9.41 58.3 71.8 93.1 14 93.3 4 Boy english 77.8 5.94 69.6 77.6 90.2 15 100 5 Girl french 71.1 12.4 44.8 68.4 93.7 14 93.3 6 Boy french 76.6 8.63 63.2 74.8 94.7 15 100 7 Girl geography 67.3 8.26 50.4 67.3 78.9 15 100 8 Boy geography 73 12.4 47.2 71.2 96.3 14 93.3 9 Girl history 71.2 9.17 53.9 72.9 86.4 15 100 10 Boy history 74.4 11.2 54.4 72.6 93.5 15 100 11 Girl math 73.8 9.03 55.6 74.8 86.3 14 93.3 12 Boy math 73.3 9.68 60.5 72.2 93.2 14 93.3
order = 3ã«è¨å®ããã¨ãorder = 2ã¨ã¾ã£ããåãããã«ã½ã¼ãå¤æ°ã®é åºãå¤ããããåã®é åºãå¤ããï¼
grouped_descr %>% tb(order = 3)
# A tibble: 12 Ã 9 variable gender mean sd min med max n.valid pct.valid <chr> <fct> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> 1 economics Girl 72.5 7.79 62.3 70.2 89.6 14 93.3 2 economics Boy 75.2 9.40 60.5 71.7 94.2 15 100 3 english Girl 73.9 9.41 58.3 71.8 93.1 14 93.3 4 english Boy 77.8 5.94 69.6 77.6 90.2 15 100 5 french Girl 71.1 12.4 44.8 68.4 93.7 14 93.3 6 french Boy 76.6 8.63 63.2 74.8 94.7 15 100 7 geography Girl 67.3 8.26 50.4 67.3 78.9 15 100 8 geography Boy 73 12.4 47.2 71.2 96.3 14 93.3 9 history Girl 71.2 9.17 53.9 72.9 86.4 15 100 10 history Boy 74.4 11.2 54.4 72.6 93.5 15 100 11 math Girl 73.8 9.03 55.6 74.8 86.3 14 93.3 12 math Boy 73.3 9.68 60.5 72.2 93.2 14 93.3
詳ããã¯ã?tb
åç
§ã®ãã¨ã
8.2 ä»ã®ããã±ã¼ã¸ã¸ã®æ©æ¸¡ã
summarytoolsãªãã¸ã§ã¯ãã¯ãformattableãkableExtraã®ãããªãã¼ãã«ãã©ã¼ãããã«ç¦ç¹ãå½ã¦ãããã±ã¼ã¸ã¨ã¯å¿
ãããäºææ§ãããã¨ã¯éãã¾ãããããããªãããtb()
ã¯ãfreq()
ã¨descr()
ãªãã¸ã§ã¯ãããã©ã®ããã±ã¼ã¸ã§ãæ±ããã¨ãã§ããåç´ãªè¡¨ã«å¤æããä¸éã¹ãããã§ãã "ããªã㸠"ã¨ãã¦ä½¿ç¨ãããã¨ãã§ããã以ä¸ã¯ kableExtra ã使ã£ãä¾ã§ããï¼
library(kableExtra) library(magrittr) stby(data = iris, INDICES = iris$Species, FUN = descr, stats = "fivenum") %>% tb(order = 3) %>% kable(format = "html", digits = 2) %>% collapse_rows(columns = 1, valign = "top")
9. ãã¡ã¤ã«ã¸ã®åºå
print()ã¾ãã¯view()/stview()ã§fileå¼æ°ã使ç¨ããã¨ãhtmlãRmdãmdããããã¯åãªããã¬ã¼ã³ã»ããã¹ã(txt)ãªã©ã®ãã¡ã¤ã«ã«åºåãæ¸ãåºããã¨ãã§ããããã¡ã¤ã«æ¡å¼µåã¯ãæ¸ãåºãã³ã³ãã³ãã®ã¿ã¤ãã決å®ããããã«ããã±ã¼ã¸ã使ç¨ããã
view(iris_stats_by_species, file = "~/iris_stats_by_species.html") view(iris_stats_by_species, file = "~/iris_stats_by_species.md")
PDFææ¸ã«é¢ãã注æ
summarytoolsã§PDFãã¡ã¤ã«ãä½æããç´æ¥çãªæ¹æ³ã¯ããã¾ãããä¸ã¤ã®æ¹æ³ã¯ãhtmlãã¡ã¤ã«ãçæããPandocã¾ãã¯WKTOpdfã使ç¨ãã¦PDFã«å¤æãããã¨ã§ããï¼å¾è ã¯dfSummary()åºåã§Pandocããè¯ãçµæãä¸ããï¼ã
ããä¸ã¤ã®æ¹æ³ã¯ãPDFãåºåãã©ã¼ãããã¨ãã¦Rmdããã¥ã¡ã³ããä½æãããã¨ã§ããé²ãæ¹ã®è©³ç´°ã¯vignette("rmarkdown", package = "summarytools")ãåç §ãã¦ã»ããã
9.1 åºåãã¡ã¤ã«ã®è¿½å
appendå¼æ°ã¯summarytoolsãçæããæ¢åã®ãã¡ã¤ã«ã«å 容ã追å ãããã¨ãã§ãããããã¯ã1ã¤ã®ãã¡ã¤ã«ã«è¤æ°ã®çµ±è¨è¡¨ãå«ãããå ´åã«ä¾¿å©ã ãããã¯ãRmdããã¥ã¡ã³ããä½æããè¿ éãªä»£æ¿æ¹æ³ã§ããã
10. ããã±ã¼ã¸ãªãã·ã§ã³
以ä¸ã®ãªãã·ã§ã³ã¯ st_options() ã§ã°ãã¼ãã«ã«è¨å®ã§ããï¼
10.1 ä¸è¬ãªãã·ã§ã³
Option name | Default | Note |
---|---|---|
style (1) | âsimpleâ | .Rmdææ¸ã§ã¯ "rmarkdown "ã«è¨å®ãã |
plain.ascii | TRUE | .Rmdææ¸ã§ã¯FALSEã«è¨å® |
round.digits (2) | 2 | 表示ããå°æ°ã®æ° |
headings | TRUE | 以å㯠"omit.headings" |
footnote | âdefaultâ | ã«ã¹ã¿ãã¤ãºããããçç¥ããå ´åã¯NAã«è¨å® |
display.labels | TRUE | è¦åºãã«å¤æ°/ãã¼ã¿ãã¬ã¼ã ã®ã©ãã«ã表示ãã |
bootstrap.css (3) | TRUE | htmlåºåãã¡ã¤ã«ã«Bootstrap 4 CSSãå«ãã |
custom.css | NA | ç¬èªã®CSSãã¡ã¤ã«ã¸ã®ãã¹ |
escape.pipe | FALSE | ããã¤ãã®Pandocå¤æã«ä¾¿å© |
char.split (4) | 12 | åè¦åºãã®æ¹è¡ã®ãããå¤ |
subtitle.emphasis | TRUE | è¦åºããã©ã¼ãããã®ã³ã³ããã¼ã« |
lang | âenâ | è¨èª (常ã«2æåã®å°æå) |
1 ç¬èªã® style ãªãã·ã§ã³ãæ㤠dfSummary() ã«ã¯é©ç¨ã ããªã (次ã®è¡¨ãåç
§)ã
2 ç¬èªã® round.digits ãªãã·ã§ã³ãæ㤠ctable() ã«ã¯é©ç¨ãããªãï¼æ¬¡ã®è¡¨ãåç
§ï¼ã
3 Shinyã¢ããªã§ã¯FALSEã«è¨å®ã
4 descr()ã¨ctable()ã®htmlåºåã«ã®ã¿å½±é¿ããã
10.2 æ©è½å¥ãªãã·ã§ã³
Option name | Default | Note |
---|---|---|
freq.cumul | TRUE | freq() ã§ç´¯ç©æ¯çã表示ãã |
freq.totals | TRUE | freq() ã§åè¨è¡ã表示ãã |
freq.report.nas | TRUE | è¡ã¨ "æå¹ãª" åã表示 |
freq.ignore.threshold (1) | 25 | ç¡è¦ãããã¼ã決å®ããããã«ä½¿ç¨ |
freq.silent | FALSE | ã³ã³ã½ã¼ã«ã»ã¡ãã»ã¼ã¸ãé ã |
ctable.prop | ârâ | ããã©ã«ãã§è¡ã®æ¯çã表示 |
ctable.totals | TRUE | éçåè¨ã®è¡¨ç¤º |
ctable.round.digits | 1 | ctable() ã§è¡¨ç¤ºããå°æ°ã®æ°ã |
descr.stats | âallâ | "fivenum"ã"common" ã¾ãã¯çµ±è¨ã®ãã¯ãã« |
descr.transpose | FALSE | çµ±è¨éãè¡ã§ã¯ãªãåã§è¡¨ç¤ºãã |
descr.silent | FALSE | ã³ã³ã½ã¼ã«ã»ã¡ãã»ã¼ã¸ã®é表示 |
dfSummary.style | âmultilineâ | 代æ¿ã¨ã㦠"grid "ã«è¨å®å¯è½ |
dfSummary.varnumbers | TRUE | 1åç®ã«å¤æ°çªå·ã表示 |
dfSummary.labels.col | TRUE | å¤æ°ã©ãã«ãããå ´åã¯è¡¨ç¤º |
dfSummary.graph.col | TRUE | ã°ã©ãã®è¡¨ç¤º |
dfSummary.valid.col | TRUE | æå¹åãåºåã«å«ãã |
dfSummary.na.col | TRUE | åºåã«æ¬ è½åãå«ãã |
dfSummary.graph.magnif | 1 | æ£ã°ã©ãã¨ãã¹ãã°ã©ã ã®æ¡å¤§ç |
dfSummary.silent | FALSE | ã³ã³ã½ã¼ã«ã¡ãã»ã¼ã¸ã®é表示 |
tmp.img.dir (2) | NA | ä¸æç»åãä¿åãããã£ã¬ã¯ã㪠|
use.x11 (3) | TRUE | Base64ã¨ã³ã³ã¼ããããã°ã©ãã®ä½æã許å¯ãã |
1 詳細ã¯2.3ç¯ãåç
§
2 dfSummary()ã«ã®ã¿é©ç¨ããã¾ãã
3 ããã¹ãã®ã¿ã®ç°å¢ã§ã¯ FALSE ã«è¨å®ãã
st_options() # ãã¹ã¦ã®ã°ãã¼ãã«ãªãã·ã§ã³å¤ã表示ãã st_options('round.digits') # ç¹å®ã®ãªãã·ã§ã³ã®å¤ã表示ãã st_options(style = 'rmarkdown', # 1ã¤ã¾ãã¯è¤æ°ã®ãªãã·ã§ã³ã®å¤ãè¨å®ãã footnote = NA) # ãã¹ã¦ã®htmlåºåã®è注ããªãã«ãã
11. ãã©ã¼ãããå±æ§
summarytoolsãªãã¸ã§ã¯ããä½æãããã¨ãããã®ãã©ã¼ãããå±æ§ã¯ãã®ä¸ã«æ ¼ç´ã ãããããããprint() ã¾ã㯠view() ã使ç¨ããã¨ãããããã®ã»ã¨ãã©ããªã¼ãã¼ã©ã¤ãã§ããã
11.1 é¢æ°åºæã®å¼æ°ã®ãªã¼ãã¼ã©ã¤ã
以ä¸ã®è¡¨ã¯ãprint() ã view() ã§æ¸å¼å±æ§ãä¸æ¸ãããããã«ä½¿ç¨ã§ããå¼æ°ã示ãã¦ãã¾ãããã¼ã¹Rã®format()é¢æ°ã®å¼æ°ã使ç¨ãããã¨ãã§ããï¼ããã«ã¯ãªã¹ãããã¦ããªããï¼ã
- pander ãªãã·ã§ã³
11.2 è¦åºãã®å 容ãä¸æ¸ããã
è¦åºãé¨åã«è¡¨ç¤ºãããæ å ±ãå¤æ´ããã«ã¯ãprint() ã¾ã㯠view() ã§ä»¥ä¸ã®å¼æ°ã使ç¨ããï¼
ä¾
次ã®ä¾ã§ã¯ãfreq()ãªãã¸ã§ã¯ããä½æãã¦è¡¨ç¤ºãããããåã³è¡¨ç¤ºãã¦ãä»åº¦ã¯ãã®ãã©ã¼ãããå±æ§ã®3ã¤ã¨è¦åºãå±æ§ã®1ã¤ããªã¼ãã¼ã©ã¤ãããã
(age_stats <- freq(tobacco$age.gr))
Frequencies tobacco$age.gr Type: Factor Freq % Valid % Valid Cum. % Total % Total Cum. ----------- ------ --------- -------------- --------- -------------- 18-34 258 26.46 26.46 25.80 25.80 35-50 241 24.72 51.18 24.10 49.90 51-70 317 32.51 83.69 31.70 81.60 71 + 159 16.31 100.00 15.90 97.50 <NA> 25 2.50 100.00 Total 1000 100.00 100.00 100.00 100.00
print(age_stats, report.nas = FALSE, totals = FALSE, display.type = FALSE, Variable.label = "Age Group")
Frequencies tobacco$age.gr Label: Age Group Freq % % Cum. ----------- ------ ------- -------- 18-34 258 26.46 26.46 35-50 241 24.72 51.18 51-70 317 32.51 83.69 71 + 159 16.31 100.00
11.3 ãã©ã¡ã¼ã¿ï¼ãªãã·ã§ã³ã®åªå é ä½
- print() ã¾ã㯠view() ãã©ã¡ã¼ã¿ãåªå ãããï¼ãªã¼ãã¼ã©ã¤ãæ©è½ï¼ã
- freq() / ctable() / descr() / dfSummary() ãã©ã¡ã¼ã¿ã¯ 2 çªç®ã
- st_options() ã§è¨å®ãããã°ãã¼ãã«ã»ãªãã·ã§ã³ã¯ 3 çªç®ã«åªå ãããããã©ã«ãã¨ãã¦åä½ããã
æ§ã ãªãã©ã¡ã¼ã¿å¤ã®è©ä¾¡ãã¸ãã¯ãã¾ã¨ããã¨ã以ä¸ã®ããã«ãªãï¼
ããå¼æ°ãé¢æ°å¼ã³åºãã®ä¸ã§æ示çã«ä¾çµ¦ããããªãããã®å¼æ°ã¯ãã©ã¡ã¼ã¿ã«æ ¼ç´ããã¦ããå¤ãããåªå ãããï¼æ ¼ç´ããã¦ããå¤ã¨ã¯ãsummarytoolsã®ã°ãã¼ãã«ãªãã·ã§ã³ãªã¹ãã«æ ¼ç´ããã¦ããå¤ã¨åæ§ã«ãã³ã¢é¢æ°ã使ç¨ããã¨ãã«ãªãã¸ã§ã¯ãã®å±æ§ã«æ¸ãè¾¼ã¾ããå¤ã§ããï¼ã
ã³ã¢é¢æ°ã¨printã¾ãã¯viewé¢æ°ã®ä¸¡æ¹ãåæã«å¼ã³åºãããç¸åãããã©ã¡ã¼ã¿å¤ãæã¤å ´åãprint/viewãåªå ã ããï¼ãããã¯å¸¸ã«è°è«ã«åã¤ï¼ï¼ã
é¢æ°å¼ã³åºãã§ãã©ã¡ã¼ã¿å¤ãè¦ã¤ãããªãå ´åãä¿åããã¦ããããã©ã«ãå¤ï¼st_options()ã§å¤æ´ããããããã±ã¼ã¸èªã¿è¾¼ã¿æã®ã¾ã¾ï¼ãé©ç¨ã ããã
12. è¦ãç®ã®å¾®èª¿æ´ : CSS
htmlã¬ãã¼ããä½æããå ´åãããã©ã«ãã§Bootstrapã®CSSã¨summarytools.cssã®ä¸¡æ¹ãå«ã¾ãã¾ããhtmlã³ã³ãã³ãã®è¦ãç®ãããã³ã³ããã¼ã«ããããã«ãã«ã¹ã¿ã CSSãã¡ã¤ã«ã«ã¯ã©ã¹å®ç¾©ã追å ãããã¨ãå¯è½ã ã
ä¾
dfSummary()ãå«ãåç´ãªhtmlã¬ãã¼ãã«ãé常ã«å°ããªãã©ã³ãã»ãµã¤ãºã使ç¨ããå¿
è¦ãããã¾ãããã®ããã«ã以ä¸ã®ã¯ã©ã¹å®ç¾©ãå«ã.cssãã¡ã¤ã«ï¼ä»»æã®ååï¼ãä½æããï¼
.tiny-text { font-size: 8px; }
次ã«ãprint()ã®custom.csså¼æ°ã使ã£ã¦ãæ°ããä½æããCSSãã¡ã¤ã«ã®å ´æãæå®ããï¼çµæã¯ç¤ºãã¦ããªãï¼ï¼
print(dfSummary(tobacco), custom.css = 'path/to/custom.css', table.classes = 'tiny-text', file = "tiny-tobacco-dfSummary.html")
13. Shiny Apps
Shynyã¢ããªã«summarytoolsé¢æ°ããã¾ãçµã¿è¾¼ãã
- htmlã¬ã³ããªã³ã°ã使ç¨ãã
- ã¢ããªã®ã¬ã¤ã¢ã¦ãã¨ã®ç¸äºä½ç¨ãé¿ããããã«ãbootstrap.css = FALSEãè¨å®ããã
- åé¡ãçºçããå ´åã«åãã¦ãheadings = FALSEãè¨å®ããã
- graph.magnifãã©ã¡ã¼ã¿ã¾ãã¯dfSummary.graph.magnifã°ãã¼ãã«ã»ãªãã·ã§ã³ã§ã°ã©ãã»ãµã¤ãºã調æ´ããã
- dfSummary()ã®è¡¨ãåºãããå ´åã¯ã1åã2åãçç¥ããï¼valid.colã¨varnumbersãªã©ï¼ã
- ããã§ãæºè¶³ã®ããçµæãå¾ãããªãå ´åã¯ãcol.widths ãã©ã¡ã¼ã¿ã§åå¹ ãæåã§è¨å®ããã
- col.widthsãgraph.magnigããã¾ããããªãããã§ããã°ãdfSummary()ã§ã¯ãªããprint()ã®ãã©ã¡ã¼ã¿ã¨ãã¦ä½¿ç¨ãã¦ã¿ãã
print(dfSummary(somedata, varnumbers = FALSE, valid.col = FALSE, graph.magnif = 0.8), method = 'render', headings = FALSE, bootstrap.css = FALSE)
14. Rãã¼ã¯ãã¦ã³ã«ãããã°ã©ã
ãã¼ã¯ãã¦ã³ã»ã¹ã¿ã¤ã«ã使ç¨ããRmdããã¥ã¡ã³ãã§dfSummary()ã使ç¨ããå ´åï¼htmlã¬ã³ããªã³ã°ã¨ã¯å¯¾ç §çï¼ãpngã°ã©ããé©åã«è¡¨ç¤ºããã«ã¯3ã¤ã®è¦ç´ ãå¿ è¦ï¼
1 - plain.asciiãFALSEã«è¨å®ããã 2 - styleã "grid "ã«è¨å®ããã 3 - tmp.img.dirãå®ç¾©ãããå¹ ãæ大5æåã§ãããã¨ã
ãã¼ã¸ã§ã³0.9.9ã§ã¯ãmethod = "render "ã使ç¨ããå ´åãtmp.img.dirãè¨å®ããå¿ è¦ã¯ãªããªããNAã®ã¾ã¾ã«ãã¦ãããã¨ãã§ãã¾ããä¸å³ã®ããã«ãä¸éæ§ã®ãã¼ã¯ãã¦ã³ã»ãã¼ãã«ãä½æããå ´åã«ã®ã¿å®ç¾©ããå¿ è¦ããããã¬ã³ããªã³ã°ãããåã®å¹ ã¯ãç»åèªä½ã®å¹ ã§ã¯ãªããã»ã«å ã®æåæ°ã«ãã£ã¦æ±ºå®ãããããã ï¼
+---------------+--------|----------------------+---------+ | Variable | stats | Graph | Valid | +===============+========|======================+=========+ | age\ | ... | ![](/tmp/ds0001.png) | 978\ | | [numeric] | ... | | (97.8%) | +---------------+--------+----------------------+---------+
CRANããªã·ã¼ã¯ãã¦ã¼ã¶ã¼ã»ãã£ã¬ã¯ããªãRã®ãã³ãã©ãªã»ã¾ã¼ã³ã®å¤å´ã«ã³ã³ãã³ããæ¸ãè¾¼ããã¨ã«é¢ãã¦ã¯ï¼æ£å½ãªçç±ããã£ã¦ï¼æ¬å½ã«å³ããããã®ãããã¦ã¼ã¶ã¼ã¯ãã®ä¸æçãªå ´æãèªåã§è¨å®ããå¿ è¦ããããRã®ãããããå®ç¾©ãããä¸æçãªã¾ã¼ã³ã®å¤ã«ã³ã³ãã³ããæ¸ãè¾¼ããã¨ã«åæãããã¨ã«ãªãã
Mac OSã¨Linuxã§ã¯ã"/tmp "ã使ããã¨ã¯é常ã«çã«ããªã£ã¦ãããWindowsã§ã¯ããã®ãããªä¾¿å©ãªãã£ã¬ã¯ããªã¯ãªãã®ã§ã絶対ãã¹ï¼"/tmp"ï¼ãç¸å¯¾ãã¹ï¼"img"ãã¾ãã¯åã«"."ï¼ãé¸ã¶å¿ è¦ãããã
15. è¨èªã¨ç¨èªã®ã«ã¹ã¿ãã¤ãº
Rã³ãã¥ããã£ã®åªåã«ãããè±èªï¼ããã©ã«ãï¼ã®ä»ã«ä»¥ä¸ã®è¨èªã使ç¨ã§ããï¼
ãã©ã³ã¹èª (fr) ãã«ãã¬ã«èª (pt) ãã·ã¢èª (ru) ã¹ãã¤ã³èª (es) ãã«ã³èª (tr) è¨èªãåãæ¿ããã«ã¯
st_options(lang = "fr")
ã³ã¢ãã¡ã³ã¯ã·ã§ã³ããã®åºåã¯ãã¹ã¦ãã®è¨èªã使ç¨ããï¼
freq(iris$Species)
Tableau de fréquences iris$Species Type: Facteur Fréq. % Valide % Valide cum. % Total % Total cum. ---------------- -------- ---------- --------------- --------- -------------- setosa 50 33.33 33.33 33.33 33.33 versicolor 50 33.33 66.67 33.33 66.67 virginica 50 33.33 100.00 33.33 100.00 <NA> 0 0.00 100.00 Total 150 100.00 100.00 100.00 100.00
15.1 éUTF-8ãã±ã¼ã«
ã»ã¨ãã©ã®Windowsã·ã¹ãã ã§ã¯ãæåã»ãããã·ã¹ãã ã®ããã©ã«ããã±ã¼ã«ã«å«ã¾ãã¦ããªãå ´åããã±ã¼ã«è¨å®ã®LC_CTYPEè¦ç´ ãå¤æ´ããå¿ è¦ãããã¾ããä¾ãã°ã"latin1 "ç°å¢ã§ãã·ã¢èªã§è¯ãçµæãå¾ãã«ã¯ã以ä¸ã®è¨å®ã使ç¨ããï¼
Sys.setlocale("LC_CTYPE", "russian") st_options(lang = 'ru')
ããã©ã«ãè¨å®ã«æ»ãã«ã¯
Sys.setlocale("LC_CTYPE", "") st_options(lang = "en")
15.2 ã«ã¹ã¿ã ç¨èªã®å®ç¾©ã¨ä½¿ç¨
use_custom_lang()é¢æ°ã使ç¨ããã¨ãç¬èªã®ç¿»è¨³ã»ããããã¼ã½ãã©ã¤ãºãããç¨èªã追å ãããã¨ãã§ããããããå®ç¾ããã«ã¯ãcsvãã³ãã¬ã¼ããåå¾ãã1ã¤ãå¤æ°ãã¾ãã¯+/- 70ã®ç¨èªã®ãã¹ã¦ãã«ã¹ã¿ãã¤ãºããç·¨éããcsvãã³ãã¬ã¼ãã¸ã®ãã¹ãå¯ä¸ã®å¼æ°ã¨ãã¦ä¸ãã¦ãuse_custom_lang()ãå¼ã³åºãã¾ãããã®ãããªã«ã¹ã¿ã è¨èªè¨å®ã¯ãRã®ã»ãã·ã§ã³ãã¾ããã§ãä¿æãããªããã¨ã«æ³¨æãã¦æ¬²ãããã¤ã¾ãããã®csvãã¡ã¤ã«ã常ã«æå ã«ç½®ãã¦ããå¿ è¦ãããã
15.3 ç¹å®ã®ãã¼ã¯ã¼ãã ããå®ç¾©ãã
define_keywords()ã使ç¨ããã¨ã1ã¤ã¾ãã¯å°æ°ã®ç¨èªãç°¡åã«å¤æ´ã§ããããã¨ãã°ãfreq() ãã¼ãã«ã®ã¿ã¤ãã«è¡ã§ã"Freq" ã§ã¯ãªã "N" ã "Count" ã使ç¨ãããå ´åãªã©ã§ããããããã¯ã表ã®ã¿ã¤ãã«ãè¦åºãã»ã¯ã·ã§ã³ã¨ãã¦ä½¿ç¨ããããã¥ã¡ã³ããçæããããããããªãã
ãã®å ´åãdefine_keywords() ãå¼ã³åºããå¤æ´ãããç¨èª (å®ç¾©æ¸ã¿ã®å¤æ°ã«æ ¼ç´ã§ãã) ãå ¥åãããããã§ã¯ãfreq.titleã¨freq.titleãå¤æ´ããï¼
section_title <- "**Species of Iris**" define_keywords(title.freq = section_title, freq = "N") freq(iris$Species)
**Species of Iris** iris$Species Type: Factor N % Valid % Valid Cum. % Total % Total Cum. ---------------- ----- --------- -------------- --------- -------------- setosa 50 33.33 33.33 33.33 33.33 versicolor 50 33.33 66.67 33.33 66.67 virginica 50 33.33 100.00 33.33 100.00 <NA> 0 0.00 100.00 Total 150 100.00 100.00 100.00 100.00
define_keywords()ãå¼æ°ãªãã§å¼ã³åºãã¨ãã°ã©ãã£ã«ã«ã»ããã¤ã¹ããµãã¼ããã¦ããã·ã¹ãã ï¼ã¤ã¾ã大å¤æ°ï¼ã§ã¯ãã¦ã£ã³ãã¦ã表示ããããããããã¹ã¦ã®ç¨èªãç·¨éãããã¨ãã§ããã
ç·¨éã¦ã£ã³ãã¦ãéããå¾ããã¤ã¢ãã°ããã¯ã¹ãæ°ããä½æããã«ã¹ã¿ã è¨èªãcsvãã¡ã¤ã«ã«ä¿åãããªãã·ã§ã³ãæä¾ãã¾ãï¼ããã¤ãã®ãã¼ã¯ã¼ããå¤æ´ããã ãã§ããããã±ã¼ã¸ã¯ç¨èªãå ¨ä½ã¨ãã¦èæ ®ãã¾ãï¼ãå¾ã§use_custom_lang("path-to-custom-language-file.csv")ãå¼ã³åºããã¨ã§ãã«ã¹ã¿ã è¨èªãã¡ã¤ã«ãã¡ã¢ãªã«åãã¼ããããã¨ãã§ããã
ããã±ã¼ã¸å ã®ã«ã¹ã¿ãã¤ãºå¯è½ãªãã¹ã¦ã®ç¨èªã®ãªã¹ãã«ã¤ãã¦ã¯ã?define_keywordsãåç §ãã¦ã»ããã
ãã¹ã¦ã®å¤æ´ãå ã«æ»ãã«ã¯ãåç´ã«st_options(lang = "en")ã使ç¨ããã
15.4 è¦åºãã®ãã¯ã¼èª¿æ´
print()é¢æ°ã«å¼æ°ã追å ãããã¨ã§ãè¦åºããããã«ã«ã¹ã¿ãã¤ãºãããã¨ãã§ãããããã§ã¯ãVariableã®å¤ãä¸æ¸ãããããã«ç©ºã®æååã使ç¨ãã¦ããï¼ããã¯è¦åºãã®2è¡ç®ãå®å ¨ã«æ¶ãã¦ãã¾ãã
define_keywords(title.freq = "Types and Counts, Iris Flowers") print( freq(iris$Species, display.type = FALSE), # Variable type won't be displayed... Variable = "" # and neither will the variable name )
Types and Counts, Iris Flowers N % Valid % Valid Cum. % Total % Total Cum. ---------------- ----- --------- -------------- --------- -------------- setosa 50 33.33 33.33 33.33 33.33 versicolor 50 33.33 66.67 33.33 66.67 virginica 50 33.33 100.00 33.33 100.00 <NA> 0 0.00 100.00 Total 150 100.00 100.00 100.00 100.00
16. ã´ã£ãããè¨å®
ãã®ãããããã©ã®ããã«è¨å®ããã¦ããããç¥ããã¨ã¯ãR Markdownææ¸ã§summarytoolsã使ãå§ããã®ã«å½¹ç«ã¤ã
16.1 YAMLã»ã¯ã·ã§ã³
åºåè¦ç´ ãéè¦ã
--- output: rmarkdown::html_vignette: css: - !expr system.file("rmarkdown/templates/html_vignette/resources/vignette.css", package = "rmarkdown") ---
16.2 è¨å®ãã£ã³ã¯
library(knitr) opts_chunk$set(results = 'asis', # Can also be set at chunk level comment = NA, prompt = FALSE, cache = FALSE) library(summarytools) st_options(plain.ascii = FALSE, # Always use in Rmd documents style = "rmarkdown", # Always use in Rmd documents subtitle.emphasis = FALSE) # Improves layout w/ some themes
16.3 summarytoolsã®CSSãã¤ã³ã¯ã«ã¼ããã
å¿ è¦ãªCSSã¯ãfileå¼æ°ã§print()ã¾ãã¯view()ã使ç¨ãã¦ä½æãããhtmlãã¡ã¤ã«ã«èªåçã«è¿½å ã ãããããããR Markdownããã¥ã¡ã³ãã§ã¯ãYAMLãããã¼ã®ç´å¾ã®ã»ããã¢ãããã£ã³ã¯ã§ï¼ã¾ãã¯knitrã¨summarytoolsãªãã·ã§ã³ãæå®ããæåã®ã»ããã¢ãããã£ã³ã¯ã®å¾ã§ï¼æ示çã«è¡ãå¿ è¦ãããï¼
st_css(main = TRUE, global = TRUE)
17. çµè«
ãã®ããã±ã¼ã¸ã«ã¯ä½ã®ä¿è¨¼ããªããç¾å¨é²è¡å½¢ã§ããããã£ã¼ãããã¯ã¯ãã¤ã§ãæè¿ããããã°ãè¦ã¤ãããæ©è½è¦æãåºãããå ´åã¯ãGitHubã«issueãç»é²ãã¦æ¬²ããã