Closed jashapiro closed 3 months ago
Tagging @allyhawkins & @sjspielman for comments...
I think we seem to be moving toward the vars()
in advanced single cell, but we should decide on |>
as soon as possible so we can all get in the right habit!
I am on board with moving to vars
and also using the |>
pipe. Although I have a terrible time remembering to use it in scpcaTools
, maybe using it in training will help fix that.
I don't think we need to change select
? I thought you could use helpers inside the function, but you don't need to?
I have no strong feelings about purrr
so I'll leave that one up to you guys.
I'm on board with all of this.
@allyhawkins the all_of
stuff is needed, but it didn't used to be so newer dplyr
versions complain. I assume that's what we mean here?
Part of the immediate purrr
decision is whether we want to bump renv
for this training, or wait for next?
@allyhawkins the
all_of
stuff is needed, but it didn't used to be so newerdplyr
versions complain. I assume that's what we mean here?
Yes, that is what I am referring to. It really only matters in cases where you have an external vector of the columns you want select:
dplyr::select(my_cols)
used to work just fine, but now you need dplyr::select(all_of(my_cols))
. I don't know if we use that anywhere, but I kind of suspect we do somewhere...
Part of the immediate
purrr
decision is whether we want to bumprenv
for this training, or wait for next?
I think these are independent. We can use the \(x)
syntax with the current version or ~
with 1.0: it is only the examples/recommendations that have changed.
I think we mostly ended up taking care of this. We have done:
|>
\(x)
vars
We probably want to come back and get rid of the vector/quotes here, though, and just rely on the magic of tidyeval. Low stakes and not going to be updated for June 2023, but next time! So I'll leave this issue open. https://github.com/AlexsLemonade/training-modules/blob/bbcc758f573f60e8967bc80936519740df3a7977/scRNA-seq/03-normalizing_scRNA.Rmd#L85-L91
I think this issue can be considered pretty well closed. It has at least outlived its usefulness as an issue.
We have all been around a while, so we are using a few "old" conventions when writing our R code. I wonder if it isn't time to try to adopt the current practices in a few places.
Here are my current thoughts on changes we could make:
move from
%>%
to|>
removing explicitmagrittr
dependency. We rarely use the more advanced features ofmagrittr
, like replacing a non-first argument, so this should be pretty easy.for ggplot2 faceting, we can use the recommended
vars()
syntax.there may be some places with
dplyr::select()
where we should addall_of()
or similar, though I haven't looked specifically.I don't know how often we use
~
withpurrr
, but we do use it in some other notebooks, and apparently the new recommendation is to use\(x)...
syntax. https://www.tidyverse.org/blog/2022/12/purrr-1-0-0/#documentation...
, which I don't know if I like eitherMost of these changes are relatively small and should be quick to implement. If we do this, I think it makes sense to pilot this in the advanced single cell notebooks, and update all the others as we next teach them.
If there are other modernizations we should think about, please add them as comments below.