Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update check as-cran and default landing page #115

Merged
merged 8 commits into from
Feb 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/workflows/check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ jobs:
secrets:
REPO_GITHUB_TOKEN: ${{ secrets.REPO_GITHUB_TOKEN }}
with:
additional-env-vars: |
_R_CHECK_CRAN_INCOMING_REMOTE_=false
additional-r-cmd-check-params: --as-cran
coverage:
name: Coverage 📔
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/docs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,5 @@ jobs:
uses: insightsengineering/r.pkg.template/.github/workflows/pkgdown.yaml@main
secrets:
REPO_GITHUB_TOKEN: ${{ secrets.REPO_GITHUB_TOKEN }}
with:
default-landing-page: latest-tag
2 changes: 2 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ jobs:
uses: insightsengineering/r.pkg.template/.github/workflows/pkgdown.yaml@main
secrets:
REPO_GITHUB_TOKEN: ${{ secrets.REPO_GITHUB_TOKEN }}
with:
default-landing-page: latest-tag
validation:
name: R Package Validation report 📃
needs: release
Expand Down
1 change: 1 addition & 0 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ Imports:
grid,
gridExtra,
gtable,
methods,
rlang,
stats,
stringr,
Expand Down
1 change: 1 addition & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,6 @@ export(stream_filter_convwhere)
export(stream_filter_index)
import(dplyr)
import(ggplot2)
importFrom(methods,is)
importFrom(rlang,":=")
importFrom(rlang,.data)
1 change: 1 addition & 0 deletions R/osprey.R
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#'
#' @import dplyr ggplot2
#' @importFrom rlang .data :=
#' @importFrom methods is
#' @docType package
#' @name osprey
#' @keywords internal
Expand Down
8 changes: 2 additions & 6 deletions R/stream_filter.R
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
stream_filter <- function(slref = NULL, anl = NULL, filters, suffix, slref_keep = NULL, usubjid = "USUBJID") {
actual_suffix <- NULL

if (is.null(anl) & is.null(slref)) {
if (is.null(anl) && is.null(slref)) {
stop("At least one of anl= or slref= must be provided")
}

Expand Down Expand Up @@ -96,7 +96,7 @@ stream_filter <- function(slref = NULL, anl = NULL, filters, suffix, slref_keep
silent = TRUE
)

if ("try-error" %in% class(new_df)) {
if (is(new_df, "try-error")) {
# failed - retain original dataset
warning(paste("\nFilter ID=", this_filter, "was NOT applied.", msg1, "\n Error message:", new_df))
cat(paste("\nFilter ID=", this_filter, "was NOT applied.", msg1, "\n Error message:", new_df))
Expand Down Expand Up @@ -192,8 +192,6 @@ stream_filter_index <- function(string1, string2) {
#' stream_filter_convwhere(x = "where X in (1 2 3 4) and Y gt 4 ")
#' stream_filter_convwhere(x = "where X = \"fred\" and Y gt 4 ")
stream_filter_convwhere <- function(x) {


# convert double quotes to single quotes. May fail if quoted values exist.
this_rclause <- gsub("\"", "'", x, fixed = TRUE)

Expand All @@ -205,7 +203,6 @@ stream_filter_convwhere <- function(x) {
inquotes <- rep(c(0, 1), length.out = length(this_rclause_quotes))

for (j in seq_along(inquotes)) {

# try and convert logic outside quotes
if (inquotes[j] == 0) {
this_rclause_quotes[j] <- toupper(this_rclause_quotes[j])
Expand All @@ -231,7 +228,6 @@ stream_filter_convwhere <- function(x) {

# if contains an in statement need to ensure commas exist
if (grepl(" %in% c", this_rclause, fixed = TRUE)) {

# get the clause (assume only 1 per filter...)
temp1_str <- strsplit(this_rclause, split = " %in% c(", fixed = TRUE) %>%
unlist()
Expand Down
7 changes: 3 additions & 4 deletions R/utils.R
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ grobs2pdf <- function(grobs,
logtext <- paste(mget(ls(pattern = "log")), collapse = "\n")

## Make the grobs
if (class(grobs) != "list") {
if (!is.list(grobs)) {
grobs <- list(grobs)
}

Expand All @@ -176,7 +176,6 @@ grobs2pdf <- function(grobs,
grobs = grobs,
titles = titles,
footnotes = paste(footnotes, logtext, sep = "\n\n"),
# outer_margins = grid::unit(c(bottom.margin, left.margin, top.margin, right.margin), "inches"),
outer_margins = grid::unit(c(0, 0, 0, 0), "lines"),
padding = grid::unit(0.5, "lines"),
gp_titles = grid::gpar(fontsize = fontsize + 1, fontface = 2, lineheight = 1),
Expand Down Expand Up @@ -336,9 +335,9 @@ grob_part <- function(gplot_grob, part) {
grob_parts <- function(gplot, parts) {
stopifnot("gplot must inherit from class 'ggplot' or 'grob'" = inherits(gplot, c("ggplot", "grob")))

if ("ggplot" %in% class(gplot)) {
if (is(gplot, "ggplot")) {
gplot_grob <- ggplotGrob(gplot)
} else if ("grob" %in% class(gplot)) {
} else if (is(gplot, "grob")) {
gplot_grob <- gplot
}
ret <- lapply(parts, grob_part, gplot = gplot_grob)
Expand Down