-
Notifications
You must be signed in to change notification settings - Fork 2
/
LectureRPackage.Rmd
307 lines (244 loc) · 5.76 KB
/
LectureRPackage.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
---
title: "My Experiences:"
subtitle: "Release and Maintain CRAN Packages"
author:
- "Keon-Woong Moon"
date: '`r Sys.Date()`'
output:
xaringan::moon_reader:
lib_dir: libs
css: xaringan-themer.css
nature:
highlightStyle: github
highlightLines: true
countIncrementalSlides: false
---
```{r setup, include=FALSE}
options(htmltools.dir.version = FALSE)
knitr::opts_chunk$set(echo = TRUE,message=FALSE,comment=NA,dpi=200)
```
```{r xaringan-themer, include=FALSE, warning=FALSE}
library(xaringanthemer)
style_duo_accent(
primary_color = "#1381B0",
secondary_color = "#FF961C",
inverse_header_color = "#FFFFFF"
)
```
## 소개
문건웅
- 가톨릭대학교 의과대학 교수
- 성빈센트병원 순환기내과 재직
- 11 CRAN packages (CRAN)
- mycor, moonBook, ztable(2014)
- ggiraphExtra(2016)
- dplyrAssist, editData, ggplotAssist(2017)
- rrtable (2018)
- predict3d, processR (2019)
- webr(2020)
- Web-R.org 운영(2015-)
---
- Books
- 의학논문 작성을 위한 R통계와 그래프(2015, 한나래)
- 2015년 대한민국 학술원 우수학술도서
- 웹에서 클릭만으로 하는 R 통계분석(2015, 한나래)
- Learn ggplot2 Using Shiny App(2017, Springer)
- R을 이용한 조건부과정분석(2019,학지사)
```{r,echo=FALSE,out.width="25%",fig.show="hold",fig.align="default",message=FALSE}
require(knitr)
include_graphics("figures/book1.jpg")
include_graphics("figures/book2.jpg")
include_graphics("figures/book3.jpg")
include_graphics("figures/book4.jpg")
```
---
class: inverse, center, middle
# 논문 출판과 CRAN 등록
---
![article](figures/article.png)
---
[![R package moonBook](figures/moonBook.png)](https://cran.r-project.org/web/packages/moonBook/index.html)
---
## R 패키지를 만드는 이유는?
- An R package is a good method for distributing functions to users.
- R Packages require documentation and the package structure allows you to distribute functions and documentation together.
---
### Which of the following files and folders are required in an R package?
- An inst/ directory.
- A NAMESPACE file.
- A DESCRIPTION file.
- The R/ directory.
- The man/ directory.
- A README.md file.
---
### 참고문헌 : R package
- Manual : [Writing R Extensions](https://cran.r-project.org/doc/manuals/r-release/R-exts.html)
- [R packages](https://r-pkgs.org/)
- [Mastering Software Development in R](https://bookdown.org/rdpeng/RProgDA/)
- [Coursera - Building R packages](https://www.coursera.org/learn/r-packages/home/welcome)
---
class: inverse, center, middle
# The First CRAN package - mycor(2014)
---
# 개발동기
상관관계분석
```{r}
cor(mtcars[1:5])
```
```{r,error=TRUE}
cor(iris)
```
---
# 회귀분석
.pull-left[
```{r}
fit=lm(mpg~wt,data=mtcars)
fit
```
]
.pull-right[
```{r,echo=FALSE,message=FALSE}
require(predict3d)
ggPredict(fit,se = TRUE)
```
]
---
```{r}
require(mycor)
result=mycor(iris)
result
```
---
```{r,fig.width=6,fig.asp=1,out.width="70%",fig.align="center"}
plot(result)
```
---
```{r,fig.width=6,fig.asp=1,out.width="70%",fig.align="center"}
plot(result,groups=species,main="Test of mycor::plot")
```
---
```{r,fig.width=6,fig.asp=1,out.width="70%",fig.align="center"}
plot(result,type=4)
```
---
### Pre-release check
```{r,eval=FALSE}
devtools::check_win()
```
![alt text](figures/check1.png)
---
### CRAN submission
![alt text](figures/submission1.png)
---
![alt text](figures/email1.png)
---
![alt text](figures/submission2.png)
---
![alt text](figures/reply2.png)
---
![alt text](figures/submission3.png)
---
### On CRAN now
![alt text](figures/Brian.jpeg)
![alt text](figures/reply3.png)
---
class: inverse, center, middle
# The 2nd CRAN package - moonBook(2014)
---
[![R package moonBook](figures/moonBook.png)](https://cran.r-project.org/web/packages/moonBook/index.html)
---
### The First Trial - package "mytest"
```{r,out.width="70%",echo=FALSE}
knitr::include_graphics("figures/mytest1.png")
```
---
```{r,out.width="70%",echo=FALSE}
knitr::include_graphics("figures/mytest2.png")
```
---
### The 2nd Trial - package "mytable"
```{r,echo=FALSE}
knitr::include_graphics("figures/mytable1.png")
```
---
```{r,echo=FALSE}
knitr::include_graphics("figures/mytable2.png")
```
---
.pull-left[
```{r,echo=FALSE}
knitr::include_graphics("figures/mytable3.png")
```
]
.pull-right[
```{r,echo=FALSE}
knitr::include_graphics("figures/mytable4.png")
```
]
---
```{r,echo=FALSE}
knitr::include_graphics("figures/mytable5.png")
```
---
```{r,echo=FALSE}
knitr::include_graphics("figures/mytable6.png")
```
---
```{r,echo=FALSE}
knitr::include_graphics("figures/mytable7.png")
```
---
### The 3nd Trial - package "moonBook"
```{r,echo=FALSE,out.width="70%"}
knitr::include_graphics("figures/moonBook1.png")
```
---
```{r,echo=FALSE}
knitr::include_graphics("figures/moonBook2.png")
```
---
```{r,echo=FALSE}
knitr::include_graphics("figures/moonBook3.png")
```
---
```{r,echo=FALSE}
knitr::include_graphics("figures/moonBook4.png")
```
---
```{r,echo=FALSE}
knitr::include_graphics("figures/moonBook5.png")
```
---
```{r,echo=FALSE}
knitr::include_graphics("figures/moonBook6.png")
```
---
class: inverse, center, middle
# Maintenance of CRAN packages
---
### CRAN 패키지를 업데이트 해야 하는 경우
- Bug fix
- 새로운 함수, 데이터 추가
- dependent package가 업데이트 되는 경우
- CRAN 정책이 바뀐 경우
- R버전의 엡데이트에 따른 호환성을 유지하기 위해
---
```{r,echo=FALSE}
knitr::include_graphics("figures/maintain1.png")
```
---
```{r,echo=FALSE}
knitr::include_graphics("figures/maintain2.png")
```
---
```{r,echo=FALSE}
knitr::include_graphics("figures/maintain3.png")
```
---
```{r,echo=FALSE}
knitr::include_graphics("figures/maintain4.png")
```
---
```{r,echo=FALSE}
knitr::include_graphics("figures/maintain5.png")
```