<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>useful functions on Maëlle Salmon&#39;s personal website</title>
    <link>https://masalmon.eu/tags/useful-functions/</link>
    <description>Recent content in useful functions on Maëlle Salmon&#39;s personal website</description>
    <generator>Hugo -- gohugo.io</generator>
    <language>en-us</language>
    <copyright>Licence: &lt;a href=&#34;https://creativecommons.org/licenses/by-sa/2.0/&#34;&gt;CC BY-SA&lt;/a&gt;</copyright>
    <lastBuildDate>Wed, 25 Jun 2025 00:00:00 +0000</lastBuildDate>
    
	<atom:link href="https://masalmon.eu/tags/useful-functions/index.xml" rel="self" type="application/rss+xml" />
    
    
    <item>
      <title>How to open files, folders, websites in R</title>
      <link>https://masalmon.eu/2025/06/25/open-files-folders-websites/</link>
      <pubDate>Wed, 25 Jun 2025 00:00:00 +0000</pubDate>
      
      <guid>https://masalmon.eu/2025/06/25/open-files-folders-websites/</guid>
      <description>Coming to you from France, a post about Mise en place for R projects. In a less francophone phrasing: to get to work on something you have to open that thing, be it a script or a project or a website. The easier that is, the faster you get to work. In this post I&amp;rsquo;ll show a roundup of R functions and related tools for opening scripts, projects and websites for yourself or on behalf of the users of your code.</description>
    </item>
    
    <item>
      <title>Useful functions for dealing with object names</title>
      <link>https://masalmon.eu/2023/11/06/functions-dealing-with-names/</link>
      <pubDate>Mon, 06 Nov 2023 00:00:00 +0000</pubDate>
      
      <guid>https://masalmon.eu/2023/11/06/functions-dealing-with-names/</guid>
      <description>My sticky note filled up quickly after I only added setNames() on it, with related functions for dealing with object names, in base R and beyond!
(Un)Setting object names: stats::setNames(), unname() and rlang::set_names() I noticed a function ending with something like this:
blop &amp;lt;- function() &amp;#123;    # code creating the df data.frame  # ...    names(df) &amp;lt;- c(&#34;col1&#34;, &#34;col2&#34;)  df &amp;#125;  It struck me as simplifiable by:</description>
    </item>
    
    <item>
      <title>3 (actually 4) neat R functions</title>
      <link>https://masalmon.eu/2023/10/20/three-neat-functions/</link>
      <pubDate>Fri, 20 Oct 2023 00:00:00 +0000</pubDate>
      
      <guid>https://masalmon.eu/2023/10/20/three-neat-functions/</guid>
      <description>Time for me to throw away my sticky note after sharing what I wrote on it!
grep(...) not which(grepl(...)) Recently I caught myself using which(grepl(...)),
animals &amp;lt;- c(&#34;cat&#34;, &#34;bird&#34;, &#34;dog&#34;, &#34;fish&#34;) which(grepl(&#34;i&#34;, animals)) #&amp;gt; [1] 2 4   when the simpler alternative is
animals &amp;lt;- c(&#34;cat&#34;, &#34;bird&#34;, &#34;dog&#34;, &#34;fish&#34;) grep(&#34;i&#34;, animals) #&amp;gt; [1] 2 4   And should I need the values instead of the indices, I know I shouldn&amp;rsquo;t write</description>
    </item>
    
    <item>
      <title>3 R functions that I enjoy</title>
      <link>https://masalmon.eu/2023/09/29/three-functions/</link>
      <pubDate>Fri, 29 Sep 2023 00:00:00 +0000</pubDate>
      
      <guid>https://masalmon.eu/2023/09/29/three-functions/</guid>
      <description>Straight from my sticky note, three functions that I like a lot, despite their not being new at all&amp;hellip; But maybe new to some of you?
sprintf(), the dependency-free but less neat &amp;ldquo;glue&amp;rdquo; Imagine I want to tell you who I am.
I could write
name &amp;lt;- whoami::fullname() github_username &amp;lt;- whoami::gh_username() glue::glue(&#34;My name is &amp;#123;name&amp;#125; and you&#39;ll find me on GitHub as &amp;#123;github_username&amp;#125;!&#34;) #&amp;gt; My name is Maëlle Salmon and you&#39;ll find me on GitHub as maelle!</description>
    </item>
    
    <item>
      <title>R functions that shorten/filter stuff: less is more</title>
      <link>https://masalmon.eu/2023/08/31/three-shorten/</link>
      <pubDate>Thu, 31 Aug 2023 00:00:00 +0000</pubDate>
      
      <guid>https://masalmon.eu/2023/08/31/three-shorten/</guid>
      <description>My sticky note is full! And luckily all functions on it can be squeezed into a similar topic: making things smaller!
Make lists smaller with purrr::compact(), purrr::keep(), purrr::discard() Once upon a time there was a list (isn&amp;rsquo;t this the beginning of all R scripts?!)
my_list &amp;lt;- list(  name = &#34;Maëlle&#34;,  city = &#34;Nancy&#34;,  r_problems_encountered = Inf,  python_skills = NULL )  Imagine you want to get rid of NULL elements.</description>
    </item>
    
    <item>
      <title>Three (four?) R functions I enjoyed this week</title>
      <link>https://masalmon.eu/2023/08/30/three-r-functions/</link>
      <pubDate>Wed, 30 Aug 2023 00:00:00 +0000</pubDate>
      
      <guid>https://masalmon.eu/2023/08/30/three-r-functions/</guid>
      <description>There are already three functions of note on a piece of paper on my desk, so it&amp;rsquo;s time to blog about them!
This post was featured on the R Weekly podcast by Eric Nantz and Mike Thomas.
How does this package depend on this other package? pak::pkg_deps_explain() The pak package by Gábor Csárdi makes installing packages easier. If I need to start working on a package, I clone it, then run pak::pak() to install and update its dependencies.</description>
    </item>
    
    <item>
      <title>Reducing my for loop usage with purrr::reduce()</title>
      <link>https://masalmon.eu/2023/07/26/reduce/</link>
      <pubDate>Wed, 26 Jul 2023 00:00:00 +0000</pubDate>
      
      <guid>https://masalmon.eu/2023/07/26/reduce/</guid>
      <description>I (only! but luckily!) recently got introduced to the magic of purrr::reduce(). Thank you, Tobias! I was told about it right as I was unhappily using many for loops in a package1, for lack of a better idea. In this post I&amp;rsquo;ll explain how purrr::reduce() helped me reduce my for loop usage. I also hope that if I&amp;rsquo;m doing something wrong, someone will come forward and tell me!
This post was featured on the R Weekly podcast by Eric Nantz and Mike Thomas.</description>
    </item>
    
    <item>
      <title>Three useful (to me) R notions</title>
      <link>https://masalmon.eu/2023/07/24/basic-notions/</link>
      <pubDate>Mon, 24 Jul 2023 00:00:00 +0000</pubDate>
      
      <guid>https://masalmon.eu/2023/07/24/basic-notions/</guid>
      <description>Following my recent post on three useful (to me) R patterns, I&amp;rsquo;ve written down three other things on a tiny sticky note. This post will allow me to throw away this beaten down sticky note, and maybe to show you one element you didn&amp;rsquo;t know?
nzchar(): &amp;ldquo;a fast way to find out if elements of a character vector are non-empty strings&amp;rdquo; One of my favorite testing technique is the escape hatch strategy, about which I wrote a post on the R-hub blog: you make part of your code responsive to an environment variable, and you locally set that environment variable in your tests.</description>
    </item>
    
    <item>
      <title>Three useful (to me) R patterns</title>
      <link>https://masalmon.eu/2023/06/06/basic-patterns/</link>
      <pubDate>Tue, 06 Jun 2023 00:00:00 +0000</pubDate>
      
      <guid>https://masalmon.eu/2023/06/06/basic-patterns/</guid>
      <description>This post was featured on the R Weekly highlights podcast hosted by Eric Nantz and Mike Thomas.
I&amp;rsquo;m happy to report that I thought &amp;ldquo;oh but I know a better way to write that code!&amp;rdquo; a few times lately when reading old scripts of mine, or scripts by others. It&amp;rsquo;s a good feeling because it shows progress! I&amp;rsquo;ve tooted about all three things I&amp;rsquo;ll present in this post: After reading Julia Evans&amp;rsquo; post about blogging, I decided to train the blogging muscle a bit using these low-hanging fruits/toots1.</description>
    </item>
    
  </channel>
</rss>