-
Notifications
You must be signed in to change notification settings - Fork 31
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
fix issues associated with apply_theme() function #411
Conversation
@SHAESEN2 i think i can review later tonight. in the meantime, the R CMD Checks are not passing. Do you want to take a look before it's reviewed? |
There is an error being thrown in the Styling_KM_Plots.Rmd vignette running the chunk on line 135
Error in apply_theme(.) : object 'skipcolor' not found
|
Ok. If I understand the example its apply an empty theme expecting to revert to the default theme. I'm not sure the example makes a lot of sense. Why would you apply_theme() that is null. Maybe the "fix" here is a warning if no user supplied theme is provided as an arguement. |
It is to be able to apply sensible defaults as per good visualization practices. However I feel that we should implement them directly rather than making this complex function. |
I think we should add experimental to the function + documentation is still pending |
Agree. This seems like a nice to have for now. |
I added a test that covers the behaviour when not enough colours are given and "grey50" is substituted. I'll let Codecov tell me if there's more untested behaviour, but other than that it looks good! Edit: Now testing for two more use-cases you covered: a) Use visR palette when theme has no info on strata used in plot (-> had to set |
I think this warning can never be triggered because the required situation (more colours than in the visR palette) is caught here and the Hey Tim, I had one situation for which I needed to write that code: ## strata not present but there are too many compared to colors defined
survobj<-
survival::lung %>%
dplyr::mutate(sex = as.factor(ifelse(sex == 1, "Male", "Female"))) %>%
dplyr::mutate(status = status - 1) %>%
dplyr::rename(Age = "age", Sex = "sex", Status = "status", Days = "time") %>%
visR::estimate_KM(strata = c("Age", "pat.karno"), CNSR = "Status", AVAL = "Days")
(gg<-survobj%>%
visR::visr()) %>%
apply_theme(theme) |
Thanks for taking the time!!! I'll go through the testing and let you review it once again. |
PR should be finalized. Can someone review? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good - I'll push a couple of minor changes to the document strings then merge the PR
Move lifecycle badges to under description Add questioning badge to tabelone
What changes are proposed in this pull request?
Ensure that only the strata present in the theme are displayed.
Other strata are greyed out and legend title is aligned with theme.
Which files are involved in this pull request and what changes were made?
Did you include unit tests for the proposed change/bug fix (https://testthat.r-lib.org/)?
Pending
If there is an GitHub issue associated with this pull request, please provide link.
#388
Checklist for PR reviewer
_pkgdown.yml
pkgdown::build_site()
. Check the R console for errors, and review the rendered website.withr::with_envvar(new = c("NOT_CRAN" = "true"), covr::report())
. Before you run, begin a fresh R session without any packages loaded.usethis::use_spell_check()
runs with no spelling errors in documentationNEWS.md
been updated with the changes from this pull request under the heading indicating the latest version. If there is an issue associated with the pull request, reference it in parentheses at the end update (seeNEWS.md
for examples).usethis::use_version(which = "dev")