|
| 1 | +# Copyright 2015 Observational Health Data Sciences and Informatics |
| 2 | +# |
| 3 | +# This file is part of DrugsInPeds |
| 4 | +# |
| 5 | +# Licensed under the Apache License, Version 2.0 (the "License"); |
| 6 | +# you may not use this file except in compliance with the License. |
| 7 | +# You may obtain a copy of the License at |
| 8 | +# |
| 9 | +# http://www.apache.org/licenses/LICENSE-2.0 |
| 10 | +# |
| 11 | +# Unless required by applicable law or agreed to in writing, software |
| 12 | +# distributed under the License is distributed on an "AS IS" BASIS, |
| 13 | +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 14 | +# See the License for the specific language governing permissions and |
| 15 | +# limitations under the License. |
| 16 | + |
| 17 | +createMockupsForProtocol <- function(){ |
| 18 | + library(ggplot2) |
| 19 | + |
| 20 | + #data <- expand.grid(c("CDARS","JMDC","NHIRD", "AUSOM","CCAE"), c("<2","2-11","12-18"), c("A","B","C","D","G","H","J","L","M","N","P")) |
| 21 | + data <- expand.grid(c("CDARS","JMDC","NHIRD", "AUSOM","CCAE"), c("<2","2-11","12-18"), c("Alimentary","Blood","Cardiovascular","Dermatological","Genitourinary","Hormonal","Anti-infectives","Antineoplastic","Muscoskeletal","Nervous system","Antiparasitic drugs")) |
| 22 | + colnames(data) <- c("Database","Age","Class") |
| 23 | + data$Prevalence <- runif(nrow(data),0,100) |
| 24 | + |
| 25 | + ggplot(data, aes(x = Age, y = Prevalence, group = Database, fill = Database)) + |
| 26 | + geom_bar(stat = "identity") + |
| 27 | + facet_grid(.~ Class) + |
| 28 | + theme(axis.text.x = element_text(angle=-90), |
| 29 | + strip.text.x = element_text(angle=-90)) |
| 30 | + |
| 31 | + ggsave("documents/mockup1.png", width = 9, height = 5, dpi= 200) |
| 32 | + |
| 33 | + data <- expand.grid(c("CDARS","JMDC","NHIRD", "AUSOM","CCAE"), c("Male","Female"), c("Alimentary","Blood","Cardiovascular","Dermatological","Genitourinary","Hormonal","Anti-infectives","Antineoplastic","Muscoskeletal","Nervous system","Antiparasitic drugs")) |
| 34 | + colnames(data) <- c("Database","Gender","Class") |
| 35 | + data$Prevalence <- runif(nrow(data),0,100) |
| 36 | + |
| 37 | + ggplot(data, aes(x = Gender, y = Prevalence, group = Database, fill = Database)) + |
| 38 | + geom_bar(stat = "identity") + |
| 39 | + facet_grid(.~ Class) + |
| 40 | + theme(axis.text.x = element_text(angle=-90), |
| 41 | + strip.text.x = element_text(angle=-90)) |
| 42 | + |
| 43 | + ggsave("documents/mockup2.png", width = 9, height = 5, dpi= 200) |
| 44 | + |
| 45 | + |
| 46 | + data <- expand.grid(c("CDARS","JMDC","NHIRD", "AUSOM","CCAE"), c("<2","2-11","12-18"), c("Alimentary","Blood","Cardiovascular","Dermatological","Genitourinary","Hormonal","Anti-infectives","Antineoplastic","Muscoskeletal","Nervous system","Antiparasitic drugs"), 2008:2014) |
| 47 | + colnames(data) <- c("Database","Age","Class", "Year") |
| 48 | + data$Prevalence <- runif(nrow(data),0,100) |
| 49 | + |
| 50 | + ggplot(data, aes(x = Year, y = Prevalence, group = Database, color = Database)) + |
| 51 | + geom_line() + |
| 52 | + facet_grid(Class ~ Age) + |
| 53 | + theme(axis.text.x = element_text(angle=-90), |
| 54 | + strip.text.y = element_text(angle=0)) |
| 55 | + |
| 56 | + ggsave("documents/mockup3.png", width = 7, height = 8, dpi= 200) |
| 57 | +} |
0 commit comments