-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add 2 posts about progress bars and now
- Loading branch information
1 parent
ce8a972
commit 214c736
Showing
7 changed files
with
98 additions
and
2 deletions.
There are no files selected for viewing
14 changes: 14 additions & 0 deletions
14
_freeze/posts/2023-10-12_now/index/execute-results/html.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{ | ||
"hash": "6e511d463cb13866a65e5bbb842de0fe", | ||
"result": { | ||
"markdown": "---\ntitle: \"Extract only stable functions from a tidyverse package\"\nauthor: \"Layal C. Lettry\"\ndate: \"2023-10-12\"\ncategories: [tidyverse, deprecated, superseded, defunct, questioning, reexported]\nimage: \"image.jpg\"\n---\n\n\n# Package {now}\n\nThanks to [Antoine Fabri](https://x.com/antoine_fabri?s=20)'s [post](https://x.com/antoine_fabri/status/1712063122989547718?s=20), I discovered the package [now](https://github.com/moodymudskipper/now) which allows to remove deprecated, superseded, defunct, questioning or reexported functions from tidyverse packages.\n\nThe [README.md](https://github.com/moodymudskipper/now#readme) file is explains \nhow we can see how many functions remain after having removed all the\ndeprecated, superseded, defunct, questioning or reexported ones. See this table \nwhich comes from the [README.md](https://github.com/moodymudskipper/now#readme) .\n\n\n\n::: {.cell}\n\n```{.r .cell-code}\n# removing additionally all experimental and questioning features, along with reexports\nlibrary(tidyverse)\n\nbefore <- sapply(tidyverse_packages(), \\(pkg) length(getNamespaceExports(pkg)))\n\nnow::clean_up_tidyverse(c(\"experimental\", \"superseded\", \"deprecated\", \"defunct\", \"questioning\", \"reexports\"))\n\nafter <- sapply(tidyverse_packages(), \\(pkg) length(getNamespaceExports(pkg)))\n\nleft_join(enframe(before, value = \"before\"), enframe(after, value = \"after\"), \n by = \"name\") |> \n filter(after != before) |>\n mutate(keep_ratio = sprintf(\"%2.0f%%\", 100 * after / before)) |>\n arrange(keep_ratio) |>\n knitr::kable()\n```\n\n::: {.cell-output-display}\n|name | before| after|keep_ratio |\n|:-------------|------:|-----:|:----------|\n|tidyr | 70| 30|43% |\n|purrr | 189| 91|48% |\n|tibble | 46| 22|48% |\n|dplyr | 293| 148|51% |\n|rvest | 40| 23|58% |\n|ragg | 10| 6|60% |\n|pillar | 45| 28|62% |\n|broom | 9| 6|67% |\n|readxl | 13| 9|69% |\n|rlang | 440| 340|77% |\n|jsonlite | 28| 23|82% |\n|hms | 12| 10|83% |\n|googledrive | 87| 76|87% |\n|googlesheets4 | 53| 47|89% |\n|haven | 28| 26|93% |\n|readr | 115| 107|93% |\n|dbplyr | 162| 153|94% |\n|forcats | 39| 37|95% |\n|stringr | 59| 56|95% |\n|ggplot2 | 536| 512|96% |\n|lubridate | 205| 198|97% |\n|modelr | 34| 33|97% |\n:::\n:::\n\n\n I assign the copyright for the content of the code above to [Antoine Fabri](https://x.com/antoine_fabri?s=20).\n", | ||
"supporting": [], | ||
"filters": [ | ||
"rmarkdown/pagebreak.lua" | ||
], | ||
"includes": {}, | ||
"engineDependencies": {}, | ||
"preserve": {}, | ||
"postProcess": true | ||
} | ||
} |
14 changes: 14 additions & 0 deletions
14
_freeze/posts/2023-10-12_progress-bars/index/execute-results/html.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{ | ||
"hash": "d042ee2a54fcf3f8fe3e005cc3f627bc", | ||
"result": { | ||
"markdown": "---\ntitle: \"Progress bars\"\nauthor: \"Layal C. Lettry\"\ndate: \"2023-10-12\"\ncategories: [openxlsx, date, datetime]\nimage: \"image.jpg\"\n---\n\n\n# Progress bars\n\nSometimes, you want to include a progress bar in your pipeline, to see how much\ncode has been executed and how much is left. \n\nHere are some possibilities to do that.\n\n## The \\{purrr\\} package\n\n\n::: {.cell}\n\n```{.r .cell-code}\npurrr::walk(1:3, Sys.sleep, .progress = TRUE)\n```\n:::\n\n\n## The \\{cli\\} package\n\nYou can also create a progress bar with the \\{cli\\} package. Please refer to [this article](https://cli.r-lib.org/articles/progress.html) presents several possibilities to create a progress bar. \n", | ||
"supporting": [], | ||
"filters": [ | ||
"rmarkdown/pagebreak.lua" | ||
], | ||
"includes": {}, | ||
"engineDependencies": {}, | ||
"preserve": {}, | ||
"postProcess": true | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
--- | ||
title: "Extract only stable functions from a tidyverse package" | ||
author: "Layal C. Lettry" | ||
date: "2023-10-12" | ||
categories: [tidyverse, deprecated, superseded, defunct, questioning, reexported] | ||
image: "image.jpg" | ||
--- | ||
|
||
# Package {now} | ||
|
||
Thanks to [Antoine Fabri](https://x.com/antoine_fabri?s=20)'s [post](https://x.com/antoine_fabri/status/1712063122989547718?s=20), I discovered the package [now](https://github.com/moodymudskipper/now) which allows to remove deprecated, superseded, defunct, questioning or reexported functions from tidyverse packages. | ||
|
||
The [README.md](https://github.com/moodymudskipper/now#readme) file is explains | ||
how we can see how many functions remain after having removed all the | ||
deprecated, superseded, defunct, questioning or reexported ones. See this table | ||
which comes from the [README.md](https://github.com/moodymudskipper/now#readme) . | ||
|
||
|
||
```{r} | ||
#| label: clean_package | ||
#| message: false | ||
#| warning: false | ||
# removing additionally all experimental and questioning features, along with reexports | ||
library(tidyverse) | ||
before <- sapply(tidyverse_packages(), \(pkg) length(getNamespaceExports(pkg))) | ||
now::clean_up_tidyverse(c("experimental", "superseded", "deprecated", "defunct", "questioning", "reexports")) | ||
after <- sapply(tidyverse_packages(), \(pkg) length(getNamespaceExports(pkg))) | ||
left_join(enframe(before, value = "before"), enframe(after, value = "after"), | ||
by = "name") |> | ||
filter(after != before) |> | ||
mutate(keep_ratio = sprintf("%2.0f%%", 100 * after / before)) |> | ||
arrange(keep_ratio) |> | ||
knitr::kable() | ||
``` | ||
|
||
I assign the copyright for the content of the code above to [Antoine Fabri](https://x.com/antoine_fabri?s=20). |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
--- | ||
title: "Progress bars" | ||
author: "Layal C. Lettry" | ||
date: "2023-10-12" | ||
categories: [openxlsx, date, datetime] | ||
image: "image.jpg" | ||
--- | ||
|
||
# Progress bars | ||
|
||
Sometimes, you want to include a progress bar in your pipeline, to see how much | ||
code has been executed and how much is left. | ||
|
||
Here are some possibilities to do that. | ||
|
||
## The \{purrr\} package | ||
|
||
```{r} | ||
#| label: purrr_walk | ||
#| message: false | ||
#| warning: false | ||
purrr::walk(1:3, Sys.sleep, .progress = TRUE) | ||
``` | ||
|
||
## The \{cli\} package | ||
|
||
You can also create a progress bar with the \{cli\} package. Please refer to [this article](https://cli.r-lib.org/articles/progress.html) presents several possibilities to create a progress bar. |