-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCode.R
More file actions
146 lines (110 loc) · 4.63 KB
/
Code.R
File metadata and controls
146 lines (110 loc) · 4.63 KB
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
# creates description and namespace files
usethis::use_description()
usethis::use_namespace()
# Create R directory
base::dir.create("R")
# creates Package-level documentation so you can run ?nameofpackage
usethis::use_package_doc()
# created README.Rmd for Github landing page
# an .Rbuildignore file gets created
usethis::use_readme_rmd()
# creates license file
usethis::use_mit_license("Sahir Bhatnagar")
# creates news file
usethis::use_news_md()
# setup continuous integration via travis-ci
usethis::use_travis()
# sets up testing infrastructure
usethis::use_testthat()
## code to prepare `DATASET` dataset goes here
usethis::use_data(DATASET, overwrite = TRUE)
usethis::use_data_raw()
# load required packages ----
if (!require("pacman")) install.packages("pacman")
library("pacman")
pacman::p_load(magrittr, dplyr, usethis, data.table, here)
pacman::p_load(here)
### An MSM exapmle ####
library("msm")
library("mstate")
library("tidyverse")
head(cav)
# clean data ----
#ebmt data
ebmt <- read.csv("C:/Users/niksko/Desktop/mstate/jsonread/ebmt.csv",header=TRUE, sep=",")
# write data in correct format to data folder ----
usethis::use_data(ebmt, overwrite = TRUE)
# excel_input_file_ex
excel_input_file_ex <- read.csv("C:/Users/niksko/Desktop/mstate4/datasets/csv/csv_present/excel_input_file_example.csv",header=TRUE, sep=",")
# write data in correct format to data folder ----
usethis::use_data(excel_input_file_ex, overwrite = TRUE)
#cav data
library(msm)
# write data in correct format to data folder ----
usethis::use_data(cav, overwrite = TRUE)
#' Seizure Counts for Epileptics
#'
#' @description Thall and Vail (1990) give a data set on two-week
#' seizure counts for 59 epileptics. The number of seizures was
#' recorded for a baseline period of 8 weeks, and then patients
#' were randomly assigned to a treatment group or a control group.
#' Counts were then recorded for four successive two-week periods.
#' The subject's age is the only covariate.
#'
#' @format his data frame has 295 rows and the following 5 columns:
#' \describe{
#' \item{y}{the count for the 2-week period.}
#' \item{trt}{treatment, "placebo" or "progabide"}
#' \item{post}{post treatment. 0 for no, 1 for yes}
#' \item{subject}{subject id}
#' \item{tj}{time}
#' }
#' @source \url{https://cran.r-project.org/package=MASS}
"df_epil"
pacman::p_load(sinew)
sinew::makeOxyFile("C:/Users/niksko/Desktop/rpkg/R/msboxes_R.R")
sinew::makeOxyFile("C:/Users/niksko/Desktop/rpkg/R/freq_total.R")
sinew::makeOxyFile("C:/Users/niksko/Desktop/rpkg/R/freq_total_msm.R")
sinew::makeOxyFile("C:/Users/niksko/Desktop/rpkg/R/msmjson2.R")
sinew::makeOxyFile("C:/Users/niksko/Desktop/rpkg/R/flexjson2.R")
sinew::makeOxyFile("C:/Users/niksko/Desktop/rpkg/R/mstatejson2.R")
pacman::p_load(sinew)
sinew::makeOxyFile("C:/Users/niksko/Desktop/rpkg/R/runMSMplus.R")
usethis::use_package("survival", type = "Imports")
usethis::use_package("mstate", type = "Imports")
usethis::use_package("msm", type = "Imports")
usethis::use_package("stringi", type = "Imports")
usethis::use_package("RJSONIO", type = "Imports")
usethis::use_package("visNetwork", type = "Imports")
usethis::use_package("shinyjs", type = "Imports")
usethis::use_package("shiny", type = "Imports")
usethis::use_package("mstate", type = "Imports")
usethis::use_package("tidyverse", type = "Imports")
usethis::use_package("tidyr", type = "Imports")
usethis::use_package("ggplot2", type = "Imports")
usethis::use_package("DiagrammeR", type = "Imports")
usethis::use_package("stringr", type = "Imports")
usethis::use_package("dplyr", type = "Imports")
usethis::use_package("gapminder", type = "Imports")
usethis::use_package("plyr", type = "Imports")
usethis::use_package("viridis", type = "Imports")
usethis::use_package("cowplot", type = "Imports")
usethis::use_package("magick", type = "Imports")
usethis::use_package("StatMeasures", type = "Imports")
usethis::use_package("processx", type = "Imports")
usethis::use_package("webshot", type = "Imports")
usethis::use_package("htmlwidgets", type = "Imports")
usethis::use_package("raster", type = "Imports")
usethis::use_package("jsonlite", type = "Imports")
usethis::use_package("devtools", type = "Imports")
usethis::use_package("usethis", type = "Imports")
usethis::use_package("githubinstall", type = "Imports")
usethis::use_package("shinyMatrix", type = "Imports")
usethis::use_package("dlm", type = "Imports")
usethis::use_package("rsvg", type = "Imports")
usethis::use_package("miniUI", type = "Imports")
usethis::use_package("htmltools", type = "Imports")
usethis::use_package("webshot", type = "Imports")
devtools::check()
usethis::use_vignette(name = "MSMplus_application_input1")
rpkg::runMSMplus()