<p><div><div><div><div data-show-faces="false" data-height="21" data-width="100" data-layout="button_count" data-send="true" data-href="https://www.r-bloggers.com/seventeen-minutes-from-tweet-to-package/"></div></div><div></div></div><div></div></div>
<div>
(This article was first published on <strong><a href="https://rud.is/b/2018/05/03/seventeen-minutes-from-tweet-to-package/"> R – rud.is</a></strong>, and kindly contributed to <a rel="nofollow" href="https://www.r-bloggers.com/">R-bloggers)</a> </div>
<p>Earlier today, <a rel="nofollow" href="http://twitter.com/noamross" target="_blank">@noamross</a> posted to Twitter:</p>
<blockquote class="twitter-tweet" data-lang="en">
<p lang="en" dir="ltr"><a rel="nofollow" href="https://twitter.com/hashtag/rstats?src=hash&ref_src=twsrc%5Etfw" target="_blank">#rstats</a> <a rel="nofollow" href="https://twitter.com/hashtag/lazyweb?src=hash&ref_src=twsrc%5Etfw" target="_blank">#lazyweb</a> What's the R/httr/curl equivalent of </p>
<p>curl -F &quot;file=<a rel="nofollow" href="https://twitter.com/somefile?ref_src=twsrc%5Etfw" target="_blank"><a rel="nofollow" href="http://twitter.com/somefile" target="_blank">@somefile</a></a>.html&quot; <a rel="nofollow" href="https://t.co/abbugLz9ZW" target="_blank">https://t.co/abbugLz9ZW</a></p>
<p>— Noam Ross (<a rel="nofollow" href="http://twitter.com/noamross" target="_blank">@noamross</a>) <a rel="nofollow" href="https://twitter.com/noamross/status/992054629331501057?ref_src=twsrc%5Etfw" target="_blank">May 3, 2018</a></p>
</blockquote>
<p></p>
<p>The answer was a 1:1 “file upload” <code>curl</code> to <code>httr</code> translation:</p>
<pre><code>httr::POST(
  url = &quot;https://file.io&quot;,
  encode = &quot;multipart&quot;,
  body = list(file = httr::upload_file(&quot;/some/path/to/file&quot;)),
)</code></pre>
<p>but I wanted to do more than that since Noam took 20 minutes out his day this week (with no advance warning) to speak to my intro-to-stats class about his work and R.</p>
<p>The Twitter request was (ultimately) a question on how to use R to post content to <a rel="nofollow" href="https://file.io/" target="_blank">https://file.io</a>. They have a really simple API, and the timespan from Noam’s request to the <a rel="nofollow" href="https://github.com/hrbrmstr/fileio/tree/7448e4e6125cc91aa46e9eedeebe3650e5b35d61" target="_blank">initial commit of a fully functional package</a> was roughly 17 minutes. The end product included the ability to post files, strings and R data (something that seemed like a good thing to add).</p>
<p>Not too long after came a <a rel="nofollow" href="https://github.com/hrbrmstr/fileio/releases/tag/v0.1.0" target="_blank">v0.1.0 release</a> complete with tests and passing CRAN checks on all platforms.</p>
<p>Noam also suggested I do a screencast:</p>
<blockquote class="twitter-tweet" data-lang="en">
<p lang="en" dir="ltr">You should do a screencast of your process for this.</p>
<p>— Noam Ross (<a rel="nofollow" href="http://twitter.com/noamross" target="_blank">@noamross</a>) <a rel="nofollow" href="https://twitter.com/noamross/status/992063905768837120?ref_src=twsrc%5Etfw" target="_blank">May 3, 2018</a></p>
</blockquote>
<p></p>
<p>I don’t normally do screencasts but had some conference call time so folks can follow along at home:</p>
<p><iframe width="450" allowfullscreen src="https://www.youtube.com/embed/usXZNnc0JK4"></iframe></p>
<p>That’s not the best screencast in the world, but it’s very representative of the workflow I used. A great deal of boilerplate package machinations is accomplished with <a rel="nofollow" href="https://gist.github.com/hrbrmstr/62d2346371e6cfca4bb7f48deb87bc62" target="_blank">this <code>bash</code> script</a>.</p>
<p>I wasn’t happy with the hurried function name choices I made nor was I thrilled with the package title, description, tests and basic docs, so I revamped all those into <a rel="nofollow" href="https://github.com/hrbrmstr/fileio/releases/tag/v0.2.0" target="_blank">another release</a>. That took a while, mostly due to constantly triggering API warnings about being rate-limited.</p>
<p>So, if you have a 5 GB or less file, character vector or in-memory R data you’d like to ephemerally share with others, take the <a rel="nofollow" href="https://github.com/hrbrmstr/fileio" target="_blank">fileio package</a> for a spin:</p>
<pre><code>devtools::install_github(&quot;hrbrmstr/fileio&quot;)

fileio::fi_post_text(&quot;TWFrZSBzdXJlIHRvIEAgbWUgb24gVHdpdHRlciBpZiB5b3UgZGVjb2RlIHRoaXM=&quot;)
##   success    key                   link  expiry
## 1    TRUE n18ZSB https://file.io/n18ZSB 14 days</code></pre>
<p>(bonus points if you can figure out what that seemingly random sequence of characters says).</p>
	<p>
<div>
<div>To <strong>leave a comment</strong> for the author, please follow the link and comment on their blog: <strong><a href="https://rud.is/b/2018/05/03/seventeen-minutes-from-tweet-to-package/"> R – rud.is</a></strong>.</div>
<hr>
<a rel="nofollow" href="https://www.r-bloggers.com/">R-bloggers.com</a> offers <strong><a rel="nofollow" href="https://feedburner.google.com/fb/a/mailverify?uri=RBloggers">daily e-mail updates</a></strong> about <a rel="nofollow" href="https://www.r-project.org/" title="The R Project for Statistical Computing">R</a> news and <a rel="nofollow" href="https://www.r-bloggers.com/search/tutorial" title="R tutorials">tutorials</a> on topics such as: <a rel="nofollow" href="https://www.r-bloggers.com/search/data%20science" title="Data science">Data science</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/Big%20Data" title="Big Data">Big Data, <a rel="nofollow" href="https://www.r-users.com/" title="R jobs">R jobs</a>, visualization (<a rel="nofollow" href="https://www.r-bloggers.com/search/ggplot2" title="ggplot and ggplot2 tutorials">ggplot2</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/boxplot" title="Boxplots using lattice and ggplot2 tutorials">Boxplots</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/map" title="Maps and gis">maps</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/animation" title="Animation in R">animation</a>), programming (<a rel="nofollow" href="https://www.r-bloggers.com/search/RStudio" title="RStudio IDE for R">RStudio</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/sweave" title="Sweave and literate programming">Sweave</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/LaTeX" title="LaTeX in R">LaTeX</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/SQL" title="SQL and databases">SQL</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/eclipse" title="Eclipse IDE for R">Eclipse</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/git" title="git and github, Version Control System">git</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/hadoop" title="Large data in R using Hadoop">hadoop</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/Web+Scraping" title="Web Scraping of google, facebook, yahoo, twitter and more using R">Web Scraping</a>) statistics (<a rel="nofollow" href="https://www.r-bloggers.com/search/regression" title="Regressions and ANOVA analysis tutorials">regression</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/PCA" title="principal component analysis tutorial">PCA</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/time+series" title="Time series">time series</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/trading" title="finance trading">trading</a>) and more...
<img width="1" alt="" src="http://feeds.feedburner.com/~r/RBloggers/~4/C8v7RuS0qiM" height="1"></a></div>