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

addMapping() to support future multi-model plotting #7

Merged
merged 3 commits into from
Nov 9, 2021

Conversation

curadomr
Copy link
Contributor

@curadomr curadomr commented Nov 3, 2021

Modifications to implement addMapping functionality, including tests and checks.
mapping object must be a list, with each element consisting in a vector of strings corresponding to the features found in a model, and named with the same name of the model.

@jdblischak jdblischak changed the base branch from dev to main November 3, 2021 14:34
@jdblischak jdblischak self-requested a review November 3, 2021 14:39
@jdblischak
Copy link
Contributor

@curadomr Thanks for the PR! Overall this looks good. We'll need to remove the app files in inst/build/ from the commit.

I assume the GitHub Actions jobs aren't running because they are only triggered by a PR to "main", and this was originally opened against "dev".

pull_request:
branches:
- main

I'm going to close and re-open the PR in an attempt to trigger GitHub Actions 🤞

@jdblischak jdblischak closed this Nov 3, 2021
@jdblischak jdblischak reopened this Nov 3, 2021
@jdblischak
Copy link
Contributor

Alright, re-opening triggered the jobs. The good news is that it looks like all the failures are related to the files in inst/build/. Once those are removed, the checks should pass.

@jdblischak
Copy link
Contributor

The Windows and macOS jobs with R 4.1.2 passed.

The Ubuntu job with R 3.4.4 failed to build the vignettes. It doesn't like this line from checkMapping():

Error : vapply(mappingdf, is.character, logical(1)) are not all TRUE

@jdblischak
Copy link
Contributor

The vignette builds fine on my local Ubuntu with R 4.1.1. It's likely an issue with the older R version (3.4.4), as opposed to an issue with Ubuntu.

- AddMapping accepts a list obj
- checkMapping checks if mapping obj is a list, if entries are strings, and for overlapping features across models
- validateMapping checks whether results features match with features present in mapping object and model names match model names from results table
@jdblischak
Copy link
Contributor

R CMD check passed locally for me both for 1) R 4.0.5 on Windows, and 2) R 4.1.1 on Ubuntu.

R/check.R Outdated
listMaxLength <- max(sapply(mapping, length))
mapping <- lapply(lapply(mapping, unlist), "length<-", listMaxLength)

mappingdf <- as.data.frame(mapping)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I figured out the error that only occurs with R 3.4.4. In R3, strings are always automatically coerced to factors by default (stringsAsFactors=TRUE). This default behavior was changed (for the better) in R4. Please update this line to explicitly keep the strings as charactor vectors when converting to a data frame.

 mappingdf <- as.data.frame(mapping, stringsAsFactors = FALSE)

R/check.R Outdated
featAligned <- any(sum(!sapply(tempModel, is.na)) > 1)
}

if (isFALSE(featAligned)) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, isFALSE() was added in (R 3.5.0](https://cran.r-project.org/doc/manuals/r-release/NEWS.3.html). Could you please change this to !featAligned? If you are worried about NAs, you can make it more robust with something like !is.na(featAligned) && !featAligned

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just implemented in most recent commit. Thanks!

@jdblischak jdblischak merged commit 32d8745 into abbvie-external:main Nov 9, 2021
@jdblischak jdblischak changed the title Multi model addMapping() to support future multi-model plotting Nov 19, 2021
@curadomr curadomr deleted the multiModel branch November 30, 2021 14:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants