{"id":1099,"date":"2019-09-10T16:23:49","date_gmt":"2019-09-10T14:23:49","guid":{"rendered":"http:\/\/perso.ens-lyon.fr\/lise.vaudor\/?p=1099"},"modified":"2019-09-10T16:23:49","modified_gmt":"2019-09-10T14:23:49","slug":"certains-packages-sont-comme-des-fleurs","status":"publish","type":"post","link":"https:\/\/perso.ens-lyon.fr\/lise.vaudor\/certains-packages-sont-comme-des-fleurs\/","title":{"rendered":"Certains packages sont comme des fleurs"},"content":{"rendered":"<p><img decoding=\"async\" src=\"..\/..\/lise.vaudor\/Rfigures\/flowrpowr\/Lise_Vaudor_headband-1.png\" alt=\"\" \/><\/p>\n<p><em>Hello folks! For once I write a post in English&#8230; it actually corresponds to the vignette of a small package (<strong>flowrpowr<\/strong>) I wrote to celebrate my being back to work ;-). You might find that package quite superfluous, but my visual brains and I have been hoping for something like this for a while now :-). You can install this package from &#91;my github repo&#93;&#91;1&#93;, and I hope you will find it useful, fun, and not too flawed&#8230;<\/em><\/p>\n<p>The <strong>convention for naming functions and functions\u2019 arguments<\/strong> of packages in the tidyverse is such that these functions and arguments\u2019 names help understand their <strong>purpose and construction<\/strong>.<\/p>\n<pre><code>#options(download.file.method = \"libcurl\")\n#devtools::install_github(\"lvaudor\/flowrpowr\")\n#devtools::install_github(\"thomasp85\/ggforce\")\nlibrary(flowrpowr)\n<\/code><\/pre>\n<p>The <code>flowrpowr<\/code> package exploits that characteristic to produce <strong>graphs which intend to facilitate the exploration and understanding of a package\u2019s content and of functions\u2019 arguments<\/strong>.<\/p>\n<h2>Package\u2019s functions<\/h2>\n<p>Let\u2019s explore, for instance, the <code>stringr<\/code> package:<\/p>\n<pre><code>flowr_package(\"stringr\")\n<\/code><\/pre>\n<p><img decoding=\"async\" src=\"..\/..\/lise.vaudor\/Rfigures\/flowrpowr\/flowr_stringr-1.png\" alt=\"\" \/><\/p>\n<p>This graph lets us understand that many functions in this package will start with prefix \u201cstr_\u201d and then lists all possible combinations (all functions of type <code>str_*()<\/code>, for instance <code>str_c()<\/code> and <code>str_*_*()<\/code> -for instance <code>str_replace_all()<\/code>-).<\/p>\n<p>In the case of <code>stringr<\/code> the common root <code>str_<\/code>for many functions makes a tree-like layout easily readable:<\/p>\n<pre><code>flowr_package(\"stringr\", layout=\"sugiyama\")\n<\/code><\/pre>\n<p><img decoding=\"async\" src=\"..\/..\/lise.vaudor\/Rfigures\/flowrpowr\/flowr_stringr_sugiyama-1.png\" alt=\"\" \/><\/p>\n<p>Some packages gather many functions, which makes it preferable to display only some functions in the graph. For instance, the <code>ggraph<\/code> package is quite big to be displayed in a single graph:<\/p>\n<pre><code>flowr_package(\"ggraph\")\n<\/code><\/pre>\n<p><img decoding=\"async\" src=\"..\/..\/lise.vaudor\/Rfigures\/flowrpowr\/flowr_ggraph-1.png\" alt=\"\" \/><\/p>\n<p>So it might be useful to display <strong>only part of the graph<\/strong> making use of an <strong>element of interest<\/strong>. For instance, if I\u2019m looking, specifically, for some function regarding the edges:<\/p>\n<pre><code>flowr_package(\"ggraph\", \"edge\")\n<\/code><\/pre>\n<p><img decoding=\"async\" src=\"..\/..\/lise.vaudor\/Rfigures\/flowrpowr\/flowr_ggraph_edge-1.png\" alt=\"\" \/><\/p>\n<h1>Functions\u2019 arguments<\/h1>\n<p>It is also possible to explore the <strong>arguments to one or several functions<\/strong>. Examining several functions at once help understand the arguments they have <strong>in common<\/strong> and the ones that are <strong>specific<\/strong> to each.<\/p>\n<p>A few functions mean a few distinct roots, which might be well suited to a Sugiyama layout:<\/p>\n<pre><code>flowr_function(c(\"geom_violin\",\"geom_point\",\"geom_boxplot\"),\n               layout=\"sugiyama\")\n<\/code><\/pre>\n<p><img decoding=\"async\" src=\"..\/..\/lise.vaudor\/Rfigures\/flowrpowr\/flowr_functions-1.png\" alt=\"\" \/><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Hello folks! For once I write a post in English&#8230; it actually corresponds to the vignette of a small package (flowrpowr) I wrote to celebrate my being back to work ;-). You might find that package quite superfluous, but my visual brains and I have been hoping for something like this for a while now :-). You can install this package from &#91;my github repo&#93;&#91;1&#93;, and I hope you will.. <a href=\"https:\/\/perso.ens-lyon.fr\/lise.vaudor\/certains-packages-sont-comme-des-fleurs\/\">Read More<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5],"tags":[],"class_list":["post-1099","post","type-post","status-publish","format-standard","hentry","category-tous-les-posts"],"_links":{"self":[{"href":"https:\/\/perso.ens-lyon.fr\/lise.vaudor\/wp-json\/wp\/v2\/posts\/1099","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/perso.ens-lyon.fr\/lise.vaudor\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/perso.ens-lyon.fr\/lise.vaudor\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/perso.ens-lyon.fr\/lise.vaudor\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/perso.ens-lyon.fr\/lise.vaudor\/wp-json\/wp\/v2\/comments?post=1099"}],"version-history":[{"count":12,"href":"https:\/\/perso.ens-lyon.fr\/lise.vaudor\/wp-json\/wp\/v2\/posts\/1099\/revisions"}],"predecessor-version":[{"id":1111,"href":"https:\/\/perso.ens-lyon.fr\/lise.vaudor\/wp-json\/wp\/v2\/posts\/1099\/revisions\/1111"}],"wp:attachment":[{"href":"https:\/\/perso.ens-lyon.fr\/lise.vaudor\/wp-json\/wp\/v2\/media?parent=1099"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/perso.ens-lyon.fr\/lise.vaudor\/wp-json\/wp\/v2\/categories?post=1099"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/perso.ens-lyon.fr\/lise.vaudor\/wp-json\/wp\/v2\/tags?post=1099"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}