-
Notifications
You must be signed in to change notification settings - Fork 113
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
tidyverse style compliance #489
Comments
Do you have any examples? |
I applied styler to the 2020 posts in lorenzwalthert@d861f38, but the diff is not so useful since it mostly contains end of line space formatting and other artifacts. Reviewing the last 18 posts superficially manually, here is what I found: I think the most prominent example is with indention and line breaks: model <-
nearest_neighbor(neighbors = tune(), weight_func = tune(),
dist_power = tune() wide_reviews <- tidy_reviews %>%
select(product, word, tf_idf) %>%
pivot_wider(names_from = word, names_prefix = "word_",
values_from = tf_idf, values_fill = 0) impairment_spec <-
boost_tree(trees = tune(), min_n = tune(), tree_depth = tune(), learn_rate = tune(),
loss_reduction = tune(), sample_size = tune()) Or things like glmnet_grid <- tidyr::crossing(penalty = 10^seq(-6, -1, length.out = 20), mixture = c(0.05,
0.2, 0.4, 0.6, 0.8, 1)) in https://www.tidyverse.org/blog/2020/09/usemodels-0-0-1/ Then, there is minor ones like 1 %>% identity() %>% invisible() %>% identity() in https://www.tidyverse.org/blog/2020/11/magrittr-2-0-is-here/ and others. Obviously the world has bigger problems, but implementing one of my suggestions seem a reasonable cost/benefit ratio. In addition, when authors know styling is taken care of, they can spend their attention on the text and what the code does, not what it looks like. |
I have noted a few times that code in articles does not correspond to the tidyverse style guide. I can't find any note on the style guide to use in the
README.md
either. I think we could improve on coding style in various ways:{styler}
.tidy = 'styler'
in R code chunks in.Rmd
files or set in the first chunk for all subsequent R chunks, i.g.knitr::opts_chunk$set(tidy = 'styler')
.index.Rmd
template that is created withhugodown::use_tidy_post("short-name")
(not sure the issue should be transferred to the{hugodown}
repo then).The text was updated successfully, but these errors were encountered: