메뉴 건너뛰기

웹에서 하는 R 통계

Simple is beautiful

pptxList: A Shiny Module for Reproducible Research

Keon-Woong Moon

2018-03-07

If you  are a data scientist or a researcher, you will certainly be interested in reproducible research. I have developed several functions to make reports with variable formats from R code.

Package Installation

install.packages("devtools")
devtools::install_github("cardiomoon/webr")

Package Loading

You can load the webr package with the folowing R command.

require(webr)
require(moonBook) # for data acs and mytable()
Loading required package: webr

Sample Data

Sample data sampleData2 is included in webr package. You can see the sampleData2 by folllowing R command.

str(sampleData2)
'data.frame':   5 obs. of  3 variables:
 $ type : chr  "mytable" "table" "plot" "ggplot" ...
 $ title: chr  "mytable" "iris[1:10,]" "plot" "ggplot" ...
 $ code : chr  "mytable(sex~.,data=acs)" "df2FlexTable(iris[1:10,])" "plot(iris)" "ggplot(iris,aes(x=Sepal.Length,y=Sepal.Width,color=Species))+geom_point()" ...

Or you can make a table of this data

df2FlexTable(sampleData2)

type

title

code

1

mytable

mytable

mytable(sex~.,data=acs)

2

table

iris[1:10,]

df2FlexTable(iris[1:10,])

3

plot

plot

plot(iris)

4

ggplot

ggplot

ggplot(iris,aes(x=Sepal.Length,y=Sepal.Width,color=Species))+geom_point()

5

Rcode

Regression Analysis

summary(mtcars)
fit=lm(mpg~wt*hp,data=mtcars)

summary(fit)

Make a Report As a Powerpoint Format.

You can make report with a powerpoint format.

data2pptx(sampleData2)

Make a Report As a MS-Word Format.

You can make report with a docx format.

data2word(sampleData2)

Make a Report As a HTML Format.

You can make report with a HTML format.

data2HTML(sampleData2)

Make a Report As a pdf Format.

You can make report with a pdf format. A LaTex should be installed to your computer to get ‘pdf’ file.

data2pdf(sampleData2)

Make a zipped plot file

You can get a zipped plot file. Available format is ‘PNG’,‘SVG’ and ‘PDF’.

data2plotzip(sampleData2,format="PNG")

You can set the width, height, resolution, units of your plots. You can see the manual of this function by entering the following command.

?data2plotzip

The Shiny Module ‘pptxList’ for developer

If you are a shiny app develper, you can use my ‘pptxList’ shiny module in your app. Please try the sample shiny app.

shiny::runApp(system.file('pptxList',package='webr'))

After loading the shiny app, please click the ‘load sample Data’ button. You can edit the sample data by clicking ‘edit Data’ button. You can download report as a “HTML” or “docx” or “pptx” format. You can download report as a ‘pdf’ file(You have to set the LaTex in your computer).

The followings are the source codes of this app. The source file is very simple. After loading a required package, only three rows of R code make a shiny app. You can use this module in your app freely.

library(shiny)
library(moonBook)
library(webr)

ui=fluidPage(
    pptxListInput("pptxlist")
)
server=function(input,output,session){
     mydf=callModule(pptxList,"pptxlist")
}
shinyApp(ui,server)

번호 제목 글쓴이 날짜 조회 수
공지 웹에서 하는 R 메타분석 [1] cardiomoon 2015.11.11 4444
공지 웹에서 하는 R 통계 게시판입니다. cardiomoon 2015.03.26 1138
82 moonBook 패키지 업데이트 안내 cardiomoon 2018.05.26 225
81 Make a Heatmap Table using ztable cardiomoon 2018.05.23 92
80 moonBook 패키지 업데이트 안내 cardiomoon 2018.05.18 1673
79 ztable 패키지 업데이트 안내 cardiomoon 2018.05.13 121
» pptxList: A Shiny Module for Reproducible Research cardiomoon 2018.03.07 208
77 Nightingale's Rose Plot file cardiomoon 2017.11.16 269
76 Plot for distribution of common statistics and p-value cardiomoon 2017.11.11 401
75 R package gglotAssist cardiomoon 2017.11.11 451
74 설문조사데이터 cardiomoon 2017.10.14 677
73 R에서 데이터 편집을 하자 - editData 패키지 [1] cardiomoon 2017.09.25 1182
72 dplyrAssist 패키지 : RStudio Addin으로 dplyr을 쉽게 배우기 [1] cardiomoon 2017.09.03 282
71 "틀리지않는법" 강의슬라이드(문건웅) cardiomoon 2017.08.31 977
70 연속형변수를 기준으로 같은 크기를 갖는 여러 개의 그룹으로 나누기 cardiomoon 2017.06.19 525
69 3D visualization of multiple regression analysis file cardiomoon 2017.06.15 318
68 Visualize multiple regression model cardiomoon 2017.06.12 589
67 Longest common substring cardiomoon 2017.05.29 531
66 파일을 업로드 했는데 예제데이터에서 대체가 안됩니다. [2] guriguribangbang 2017.05.16 671
65 샤이니 앱 : interactive ggplot [1] file cardiomoon 2017.02.28 1423
64 Procedural Programming vs Functional Programming(I) cardiomoon 2017.02.27 145
63 함수곡선 아래의 면적 구하기 cardiomoon 2016.12.22 611