Skip to content

Commit 9849490

Browse files
authored
Merge pull request #19 from pfizer-opensource/news-files
contributing.md added
2 parents 407c12e + 801ca85 commit 9849490

26 files changed

Lines changed: 157 additions & 88 deletions

CONTRIBUTING.md

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
# Contributing to {carver}
2+
3+
This outlines how to propose a change to {carver}.
4+
5+
## Making Changes
6+
7+
If you want to make a change, it's a good idea to first file an issue and make sure someone from the team agrees that it’s needed.
8+
Per pfizer-opensource policies, only those listed as collaborators can raise issues.
9+
If you’ve found a bug, please email the maintainer (`smriti.anand@pfizer.com`) illustrating the bug with a minimal
10+
[reprex](https://www.tidyverse.org/help/#reprex) (this will also help you write a unit test, if needed).
11+
Alternatively if you have access to the COSA community Slack channel for {carver}, you can raise it there.
12+
See guide on [how to create a great issue](https://code-review.tidyverse.org/issues/) for more advice.
13+
14+
### Pull request process
15+
16+
* Fork the package and clone onto your computer.
17+
18+
* If needed, install all development dependencies with `devtools::install_dev_deps()`, and then make sure the package passes R CMD check by running `devtools::check()`.
19+
If R CMD check doesn't pass cleanly, it's a good idea to ask for help before continuing.
20+
* Create a Git branch for your pull request (PR).
21+
22+
* Make your changes, commit to git, and then create a PR.
23+
The title of your PR should briefly describe the change.
24+
The body of your PR should contain `Closes #issue-number`.
25+
26+
* For user-facing changes, add a bullet to the top of `NEWS.md` (i.e. just below the first header). Follow the style described in <https://style.tidyverse.org/news.html>.
27+
28+
### Code Style
29+
30+
* New code should follow the tidyverse [style guide](https://style.tidyverse.org).
31+
You can use the [styler](https://CRAN.R-project.org/package=styler) package to apply these styles, but please don't restyle code that has nothing to do with your PR.
32+
33+
* To apply the appropriate style with styler please use `styler:::style_active_pkg()` or `styler::style_file()`
34+
35+
* We use [roxygen2](https://cran.r-project.org/package=roxygen2), with [Markdown syntax](https://cran.r-project.org/web/packages/roxygen2/vignettes/rd-formatting.html), for documentation.
36+
37+
* We use [testthat](https://cran.r-project.org/package=testthat) for unit tests.
38+
Contributions with test cases included are easier to accept.
39+
40+
* All helper/non-exported functions are documented with roxygen2 as indicated above.
41+
Include `#' @keywords internal` to mark the function as internal.
42+
Any helper functions that appear in examples will need to use the `carver:::`
43+
prefix.
44+
45+
### Error Handling
46+
47+
TBD
48+
49+
### Package Dependencies
50+
51+
Additional package dependencies should be considered after exhausting other possibilities. If you do need to add one,
52+
email the maintainer or collaborators/start a discussion to make a decision on the necessity of it.
53+
Once agreed upon, the dependency can be added to the package via the relevant files.
54+
55+
## Scope
56+
57+
The {carver} package will be an open-source tool and package to enable generation of
58+
common analysis reports (tables and interactive plots) for clinical
59+
review and direct inclusion in submission for regulatory agencies
60+
61+
## Deprecation Cycle
62+
63+
TBD
64+
65+
## Code of Conduct
66+
67+
Please note that the carver project is released with a
68+
[Contributor Code of Conduct](CODE_OF_CONDUCT.md). By contributing to this
69+
project you agree to abide by its terms.

R/ae_forestplot.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ ae_forest_plot <-
246246
)
247247
})
248248
# Return single level list
249-
return(flatten(nested_plots))
249+
flatten(nested_plots)
250250
}
251251

252252
#' Highlight Significant p-value points in forest plot

R/ae_pre_processor.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ ae_pre_processor <- function(datain,
166166
################### ENDax SEV/CTC##############
167167

168168
# Return processed dataframe and filter conditions
169-
return(list(data = ungroup(data_pro), a_subset = filters))
169+
list(data = ungroup(data_pro), a_subset = filters)
170170
}
171171

172172
#' Create filter condition for Adverse Events from keyword

R/ae_volcano_plot.R

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ ae_volcano_plot <- function(datain,
194194
)
195195
)
196196
}
197-
return(gplot)
197+
gplot
198198
}
199199

200200
#' Volcano Plot axis Options
@@ -276,8 +276,8 @@ Favors {trt2_label} (N={N2}) --->\n{statistic}"
276276
}
277277
refval <- ifelse(grepl("Ratio", statistic), 1, 0)
278278
xref <- c(refval, refval - xref_offset, refval + xref_offset)
279-
return(list(
279+
list(
280280
xaxis_label = xlab, yaxis_label = ylab,
281281
ylinearopts = ylinearopts, yaxis_scale = ytrans, xref = xref
282-
))
282+
)
283283
}

R/app_server.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ app_server <- function(input, output, session) {
6767
removeUI("#readData")
6868
runjs("Shiny.setInputValue('data_upload', true);")
6969
}
70-
}) %>%
70+
}) |>
7171
bindEvent(adam_read())
7272

7373
rep_inputs <- mod_report_selection_server(

R/bar_plot.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,5 +147,5 @@ bar_plot <- function(datain,
147147
g_plot <- g_plot + coord_flip()
148148
}
149149
message("Bar Plot Success")
150-
return(g_plot)
150+
g_plot
151151
}

R/box_plot.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,5 +183,5 @@ box_plot <- function(datain,
183183
)
184184
}
185185
message("Box Plot Success")
186-
return(g_plot)
186+
g_plot
187187
}

R/event_interval.R

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -55,14 +55,14 @@ interval_plot <- function(datain,
5555
xaxislab = "Start and End Study Day",
5656
yaxislab = "") {
5757
# Filter subject and get info
58-
ad_plot <- datain %>%
59-
filter(USUBJID == subjectid) %>%
58+
ad_plot <- datain |>
59+
filter(USUBJID == subjectid) |>
6060
mutate(Status = case_when(
6161
(is.na(get(startvar)) & get(endvar) >= 0) ~ "End Day",
6262
(is.na(get(endvar)) & get(startvar) >= 0) ~ "Start Day",
6363
(!is.na(get(startvar)) & !is.na(get(endvar))) ~ "Complete",
6464
TRUE ~ "Remove"
65-
)) %>%
65+
)) |>
6666
filter(Status != "Remove")
6767
# Check if no data left and return accordingly
6868
if (nrow(ad_plot) == 0) {
@@ -81,8 +81,8 @@ interval_plot <- function(datain,
8181
series_color <- g_seriescol(ad_plot, series_color, seriesvar)
8282
}
8383
# Hover Information:
84-
ad_plot <- ad_plot %>%
85-
select(all_of(c("USUBJID", startvar, endvar, yvar, seriesvar, "Status"))) %>%
84+
ad_plot <- ad_plot |>
85+
select(all_of(c("USUBJID", startvar, endvar, yvar, seriesvar, "Status"))) |>
8686
mutate(
8787
HOVER_TEXT = paste0(
8888
!!sym(yvar), "\n",
@@ -94,15 +94,15 @@ interval_plot <- function(datain,
9494
!!yvar := as.factor(!!sym(yvar))
9595
)
9696
# Use data with both dates present for segment plot
97-
segmentdata <- ad_plot %>%
97+
segmentdata <- ad_plot |>
9898
filter(Status == "Complete")
9999

100100
# Use data with either Start or end dates only for scatter plot
101-
scatterdata <- ad_plot %>%
102-
filter(Status != "Complete" | !!sym(startvar) == !!sym(endvar)) %>%
103-
tidyr::pivot_longer(all_of(c(startvar, endvar)), names_to = "key", values_to = "Value") %>%
104-
filter(!is.na(Value)) %>%
105-
select(-key) %>%
101+
scatterdata <- ad_plot |>
102+
filter(Status != "Complete" | !!sym(startvar) == !!sym(endvar)) |>
103+
tidyr::pivot_longer(all_of(c(startvar, endvar)), names_to = "key", values_to = "Value") |>
104+
filter(!is.na(Value)) |>
105+
select(-key) |>
106106
distinct(.keep_all = TRUE)
107107

108108
# Create ggplot object - segment plot for Complete intervals and scatter for incomplete
@@ -168,5 +168,5 @@ interval_plot <- function(datain,
168168
splotly$x$data[[i]]$legendgroup <- splotly$x$data[[i]]$name
169169
if (!legdf$is_first[[i]]) splotly$x$data[[i]]$showlegend <- FALSE
170170
}
171-
return(list(plot = gplot, ptly = splotly, rpt_data = ad_plot))
171+
list(plot = gplot, ptly = splotly, rpt_data = ad_plot)
172172
}

R/forest_plot.R

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ forest_plot_base <- function(datain,
135135
alpha = 0.5
136136
)
137137
}
138-
return(gplot)
138+
gplot
139139
}
140140

141141
#' Scatter plot to be included within forest plot
@@ -254,7 +254,7 @@ forest_plot_scatter <- function(datain,
254254
alpha = 0.5
255255
)
256256
}
257-
return(gplot)
257+
gplot
258258
}
259259

260260
#' Display combined Forest Plot
@@ -399,5 +399,5 @@ forest_display <- function(plot_list,
399399
rel_heights = c(0.85, 0.075, 0.075)
400400
)
401401
}
402-
return(combine_plot)
402+
combine_plot
403403
}

R/graph_utils.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -638,8 +638,8 @@ series_leg_lab <- function(datain,
638638
series_var = "TRTVAR",
639639
series_labelvar = "TRTTXT") {
640640
if (series_labelvar != series_var && is.factor(datain[[series_labelvar]])) {
641-
return(sort(unique(datain[[series_labelvar]])))
641+
sort(unique(datain[[series_labelvar]]))
642642
} else {
643-
return(waiver())
643+
waiver()
644644
}
645645
}

0 commit comments

Comments
 (0)