<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>R on Harlan D. Harris</title><link>https://harlanh.tech/tags/r/</link><description>Recent content in R on Harlan D. Harris</description><generator>Hugo -- gohugo.io</generator><language>en</language><managingEditor>harlan@harris.name (Harlan Harris)</managingEditor><webMaster>harlan@harris.name (Harlan Harris)</webMaster><lastBuildDate>Sun, 11 Mar 2018 00:00:00 +0000</lastBuildDate><atom:link href="https://harlanh.tech/tags/r/index.xml" rel="self" type="application/rss+xml"/><item><title>On moving my blog from Wordpress to Blogdown</title><link>https://harlanh.tech/2018/03/on-moving-my-blog-from-wordpress-to-blogdown/</link><pubDate>Sun, 11 Mar 2018 00:00:00 +0000</pubDate><author>harlan@harris.name (Harlan Harris)</author><guid>https://harlanh.tech/2018/03/on-moving-my-blog-from-wordpress-to-blogdown/</guid><description>
&lt;p&gt;This is my first new post on &lt;a href="https://harlanh.tech"&gt;harlan.harris.name&lt;/a&gt; for a while. The occasion is a change of scenery. For about 10 years, my primary blog has been on WordPress, more recently supplemented by Medium. But WordPress and Medium are limited for technical writing, and the trend among data people recently has been to publish static sites built with Blogdown and Hugo. So that’s what this is.&lt;/p&gt;
&lt;p&gt;The technology I’m using (more on it below) lets me do fun things like trivially embed math: &lt;span class="math inline"&gt;\(\sum_i a^2_i\)&lt;/span&gt;, or generate plots with embedded code:&lt;/p&gt;</description></item><item><title>On How and When to Teach Layers of Abstraction in Programming</title><link>https://harlanh.tech/2017/10/on-how-and-when-to-teach-layers-of-abstraction-in-programming/</link><pubDate>Thu, 05 Oct 2017 00:00:00 +0000</pubDate><author>harlan@harris.name (Harlan Harris)</author><guid>https://harlanh.tech/2017/10/on-how-and-when-to-teach-layers-of-abstraction-in-programming/</guid><description>
&lt;p&gt;&lt;em&gt;&lt;a href="https://medium.com/@HarlanH/on-how-and-when-to-teach-layers-of-abstraction-in-programming-d220c4b5e5b9"&gt;This post was originally published on Medium&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;There’s recently been some interesting opinionated writing in the R statistical programming community about how and when to teach the abstracted, easy-to-use approaches to solving problems, versus the underlying nitty-gritty. David Robinson, Data Scientist at Stack Overflow, wrote a blog post recently called Don’t teach students the hard way first. The primary example was on the data-manipulation tools in the tidyverse, versus the underlying methods in base R, but the discussion was mostly about principles in pedagogy. Some highlight quotes from the original article (which I recommend reading!):&lt;/p&gt;</description></item><item><title>Patterns for Connecting Predictive Models to Software Products</title><link>https://harlanh.tech/2016/07/patterns-for-connecting-predictive-models-to-software-products/</link><pubDate>Tue, 12 Jul 2016 00:00:00 +0000</pubDate><author>harlan@harris.name (Harlan Harris)</author><guid>https://harlanh.tech/2016/07/patterns-for-connecting-predictive-models-to-software-products/</guid><description>
&lt;p&gt;&lt;em&gt;&lt;a href="https://medium.com/@HarlanH/patterns-for-connecting-predictive-models-to-software-products-f9b6e923f02d"&gt;This post was originally published on Medium&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;You’re a data scientist, and you’ve got a predictive model — great work! Now what? In many cases, you need to hook it up to some sort of large, complex software product so that users can get access to the predictions. Think of LinkedIn’s People You May Know, which mines your professional graph for unconnected connections, or Hopper’s flight price predictions. Those started out as prototypes on someone’s laptop, and are now running at scale, with many millions of users.&lt;/p&gt;</description></item><item><title>Simulating Rent Stabilization Policy at the National Day of Civic Hacking</title><link>https://harlanh.tech/2016/06/simulating-rent-stabilization-policy-at-the-national-day-of-civic-hacking/</link><pubDate>Sun, 05 Jun 2016 00:00:00 +0000</pubDate><author>harlan@harris.name (Harlan Harris)</author><guid>https://harlanh.tech/2016/06/simulating-rent-stabilization-policy-at-the-national-day-of-civic-hacking/</guid><description>
&lt;p&gt;&lt;em&gt;&lt;a href="https://medium.com/@HarlanH/simulating-rent-stabilization-policy-at-the-national-day-of-civic-hacking-4f44b808387c"&gt;This post was originally published on Medium&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;Yesterday was the 2016 National Day of Civic Hacking, a Code for America event that encourages people with technology and related skills to explore projects related to civil society and government. My friend Josh Tauberer wrote a thoughtful post earlier about the event called Why We Hack —on what the value of this sort of event might be — please read it.&lt;/p&gt;
&lt;p&gt;For my part, this year I worked on one of the projects he discusses, understanding the impact of DC’s rent stabilization laws and what potential policy changes might yield. As Josh noted, we discovered that it’s a hard problem. Much of the most relevant data (such as the list of properties under rent stabilization and their current and historical rents) are not available, and have to be estimated. Getting to a realistic understanding of the impact of law and policy on rents seems incredibly valuable, but hard.&lt;/p&gt;</description></item><item><title>Thoughts on Managing Data Science Team Workstreams (and a Shiny app)</title><link>https://harlanh.tech/2016/01/thoughts-on-managing-data-science-team-workstreams-and-a-shiny-app/</link><pubDate>Thu, 28 Jan 2016 00:00:00 +0000</pubDate><author>harlan@harris.name (Harlan Harris)</author><guid>https://harlanh.tech/2016/01/thoughts-on-managing-data-science-team-workstreams-and-a-shiny-app/</guid><description>
&lt;p&gt;&lt;em&gt;&lt;a href="https://medium.com/@HarlanH/thoughts-on-managing-data-science-team-workstreams-and-a-shiny-app-f2b25549946f"&gt;This post was originally published on Medium&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;
&lt;a href="https://x.com/josh_wills/status/198093512149958656"&gt;
View this post on X (josh_wills)
&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;There are different types of data scientists, with different backgrounds and career paths. With Sean Murphy and Marck Vaisman, I wrote an article about this for O’Reilly a few years back, based on survey research we’d done. &lt;a href="http://shop.oreilly.com/product/0636920029014.do"&gt;Download a copy&lt;/a&gt;, if you haven’t read it. This idea is now pretty well established, but I want to talk about a related issue, which is that the &lt;em&gt;type of work&lt;/em&gt;that Data Science teams do varies a lot, and that managing those types of work can be an interesting challenge.&lt;/p&gt;</description></item><item><title>Parameterizable Reproducible Research</title><link>https://harlanh.tech/2014/11/parameterizable-reproducible-research/</link><pubDate>Thu, 20 Nov 2014 00:00:00 +0000</pubDate><author>harlan@harris.name (Harlan Harris)</author><guid>https://harlanh.tech/2014/11/parameterizable-reproducible-research/</guid><description>
&lt;p&gt;&lt;em&gt;The below is a public version of a post originally posted on an internal blog at the &lt;a href="http://eab.com" target="_blank"&gt;Education Advisory Board&lt;/a&gt; (EAB), my current employer. We don’t yet have a public tech blog, but I got permission to edit and post it here, along with the referenced code. &lt;/em&gt;&lt;/p&gt;
Data Science teams get asked to do a lot of different sorts of things. Some of what the team that I’m part of builds is enterprise-scale predictive analytics, such as the Student Risk Model that’s part of the &lt;a href="http://www.eab.com/technology/student-success-collaborative" target="_blank"&gt;Student Success Collaborative&lt;/a&gt;. That’s basically software development with a statistical twist and machine-learning core. Sometimes we get asked to do quick-and-dirty, one-off sorts of things, to answer a research question. We have a variety of tools and processes for that task. But there’s a third category that I want to focus on – frequently requested but slightly-different reports.
&lt;h2 id="ParameterizableReproducibleResearch-whatisit"&gt;
what is it
&lt;/h2&gt;
&lt;p&gt;There’s a relatively new theme in the scientific research community called &lt;em&gt;&lt;a class="external-link" style="color: #3b73af;" href="http://reproducibleresearch.net/" rel="nofollow"&gt;reproducible research&lt;/a&gt;&lt;/em&gt;. Briefly, the idea is that it should be possible to re-do all steps after data collection automatically, including data cleaning and reformatting, statistical analyses, and even the actual generation of a camera-ready report with charts, graphs, and tables. This means that if you realized that, say, one data point in your analysis was bogus and needed to be removed, you could remove that data point, press a button, and in a minute or two have a shiny new PDF with all of the results automatically updated.&lt;/p&gt;
&lt;p&gt;This type of reproducible research has been around for a while, although it’s having a recent resurgence in part due to the so-called “&lt;a href="http://www.americanscientist.org/issues/feature/the-statistical-crisis-in-science/1" target="_blank"&gt;statistical crisis&lt;/a&gt;”. The &lt;a href="http://www.r-project.org/" target="_blank"&gt;R&lt;/a&gt; (and S) statistical programming languages have supported &lt;a class="external-link" style="color: #3b73af;" href="http://www.latex-project.org/" rel="nofollow"&gt;LaTeX&lt;/a&gt;, the scientific document creation/typesetting tool, for many years. Using a tool called &lt;a class="external-link" style="color: #3b73af;" href="https://www.stat.uni-muenchen.de/~leisch/Sweave/" rel="nofollow"&gt;Sweave&lt;/a&gt;, a researcher “weaves” chunks of text and chunks of R code together. The document is then “executed”, where the R code chunks are executed and the results are converted into a single LaTeX document, which is then compiled into a PDF or similar. The code can generate charts and tables, so no manual effort is needed to rebuild a camera-ready document.&lt;/p&gt;
&lt;p&gt;This is great, a huge step forward towards validation of often tricky and complex statistical analyses. If you’re writing a conference paper on, say, a biomedical experiment, a reproducible process can drastically improve your ability to be confident in your work. But data scientists often have to generate this sort of thing repeatedly, from different sources of data or with different parameters. And they have to do so efficiently.&lt;/p&gt;
&lt;p&gt;&lt;em&gt;Parameterizable reproducible research&lt;/em&gt;, then, is a variant of reproducible research tools and workflows where it is easy to specify data sources, options, and parameters to a standardized analytical report, even one that includes statistical or predictive analyses, data manipulation, and graph generation. The report can be emailed or otherwise sent to people, and doesn’t seem as public as, say, a web-based app developed in &lt;a href="http://shiny.rstudio.com/" target="_blank"&gt;Shiny&lt;/a&gt; or another technology. This isn’t a huge breakthrough or anything, but it’s a useful pattern that seems worth sharing.&lt;/p&gt;</description></item><item><title>integrating R with other systems</title><link>https://harlanh.tech/2012/06/integrating-r-with-other-systems/</link><pubDate>Sat, 16 Jun 2012 00:00:00 +0000</pubDate><author>harlan@harris.name (Harlan Harris)</author><guid>https://harlanh.tech/2012/06/integrating-r-with-other-systems/</guid><description>
&lt;p&gt;I just returned from the &lt;a href="http://biostat.mc.vanderbilt.edu/wiki/Main/UseR-2012" target="_blank" rel="noopener"&gt;useR! 2012 &lt;/a&gt;conference for developers and users of R. One of the common themes to many of the presentations was integration of R-based statistical systems with other systems, be they other programming languages, web systems, or enterprise data systems. Some highlights for me were an &lt;a href="http://www.rforge.net/Rserve/news.html" target="_blank" rel="noopener"&gt;update to Rserve &lt;/a&gt;that includes 1-stop web services, and a presentation on &lt;a href="http://cran.r-project.org/web/packages/Rjms/index.html" target="_blank" rel="noopener"&gt;ESB integration&lt;/a&gt;. Although I didn’t see it discussed, the new &lt;a href="http://cran.r-project.org/web/packages/httr/" target="_blank" rel="noopener"&gt;httr &lt;/a&gt;package for easier access to web services is also another outstanding development in integrating R into large-scale systems.&lt;/p&gt;</description></item><item><title>Survey of Data Science / Analytics / Big Data / Applied Stats / Machine Learning etc. Practitioners</title><link>https://harlanh.tech/2012/05/survey-of-data-science-analytics-big-data-applied-stats-machine-learning-etc-practitioners/</link><pubDate>Thu, 10 May 2012 00:00:00 +0000</pubDate><author>harlan@harris.name (Harlan Harris)</author><guid>https://harlanh.tech/2012/05/survey-of-data-science-analytics-big-data-applied-stats-machine-learning-etc-practitioners/</guid><description>
&lt;p&gt;&lt;a title="Data Science, Moore’s Law, and Moneyball" href="https://harlanh.tech/2011/09/data-science-moores-law-and-moneyball/" target="_blank" rel="noopener"&gt;As I’ve discussed here before&lt;/a&gt;, there is a debate raging (ok, maybe not raging) about terms such as “data science”, “analytics”, “data mining”, and “big data”. What do they mean, how do they overlap, and perhaps most importantly, who are the people who work in these fields?&lt;/p&gt;
&lt;p&gt;Along with two other DC-area Data Scientists, Marck Vaisman and Sean Murphy, I’ve put together a survey to explore some of these issues. Help us quantitatively understand the space of data-related skills and careers by participating!&lt;/p&gt;</description></item><item><title>hacking .gov shortened links</title><link>https://harlanh.tech/2011/07/hacking-gov-shortened-links/</link><pubDate>Sat, 30 Jul 2011 00:00:00 +0000</pubDate><author>harlan@harris.name (Harlan Harris)</author><guid>https://harlanh.tech/2011/07/hacking-gov-shortened-links/</guid><description>
&lt;p&gt;This past Friday, the web portal to the US Federal government, USA.gov, &lt;a href="http://blog.usa.gov/post/7054661537/1-usa-gov-open-data-and-hack-day"&gt;organized hackathons&lt;/a&gt; across the US for programmers and data scientists to work with and analyze the data from their link-shortening service. It turns out that if you shorten a web link with &lt;a href="http://bit.ly/"&gt;bit.ly&lt;/a&gt;, the shortened link looks like &lt;a href="http://1.usa.gov/V6NpL"&gt;1.usa.gov/V6NpL&lt;/a&gt; (that one goes to a NASA page). And because this service was paid for by taxpayer money, the data about each clickthrough is freely available.&lt;/p&gt;</description></item><item><title>making meat shares more efficient with R and Symphony</title><link>https://harlanh.tech/2011/05/making-meat-shares-more-efficient-with-r-and-symphony/</link><pubDate>Mon, 09 May 2011 01:01:01 +0000</pubDate><author>harlan@harris.name (Harlan Harris)</author><guid>https://harlanh.tech/2011/05/making-meat-shares-more-efficient-with-r-and-symphony/</guid><description>
&lt;p&gt;In my &lt;a href="https://harlanh.tech/2011/05/optimizing-meat-shares" target="_blank" rel="noopener"&gt;previous post&lt;/a&gt;, I motivated a web application that would allow small-scale sustainable meat producers to sell directly to consumers using a meat share approach, using constrained optimization techniques to maximize utility for everyone involved. In this post, I’ll walk through some R code that I wrote to demonstrate the technique on a small scale.&lt;/p&gt;
&lt;p&gt;Although the problem is set up in R, the actual mathematical optimization is done by &lt;a href="http://www.coin-or.org/SYMPHONY/" target="_blank" rel="noopener"&gt;Symphony&lt;/a&gt;, an open-source mixed-integer solver that’s part of the &lt;a href="http://www.coin-or.org/" target="_blank" rel="noopener"&gt;COIN-OR project&lt;/a&gt;. (The problem of optimizing assignments, in this case of cuts of meat to people, is an integer planning problem, because the solution involves assigning either 0 or 1 of each cut to each person. More generally, linear programming and related optimization frameworks allow solving for real-numbered variables.) The RSymphony package allows problems set up in R to be solved by the C/C++ Symphony code with little hassle.&lt;/p&gt;</description></item><item><title>intuitive visualizations of categorization for non-technical audiences</title><link>https://harlanh.tech/2011/04/intuitive-visualizations-of-categorization-for-non-technical-audiences/</link><pubDate>Mon, 25 Apr 2011 00:00:00 +0000</pubDate><author>harlan@harris.name (Harlan Harris)</author><guid>https://harlanh.tech/2011/04/intuitive-visualizations-of-categorization-for-non-technical-audiences/</guid><description>
&lt;p&gt;For a project I’m working on at work, I’m building a predictive model that categorizes something (I can’t tell you what) into two bins. There is a default bin that 95% of the things belong to and a bin that the business cares a lot about, containing 5% of the things. Some readers may be familiar with the use of predictive models to identify better sales leads, so that you can target the leads most likely to convert and minimize the amount of effort wasted on people who won’t purchase your product. Although my situation doesn’t have to do with sales leads, I’m going to pretend it does, as it’s a common domain.&lt;/p&gt;
&lt;p&gt;My data is many thousands of “leads”, for which I’ve constructed hundreds of predictive features (mostly 1/0, a few numeric) each. I can plug this data into any number of common statistical and machine learning systems which will crunch the numbers and provide a black box that can do a pretty good job of separating more-valuable leads from less valuable leads. That’s great, but now I have to communicate what I’ve done, and how valuable it is, to an audience that struggles with relatively simple statistical concepts like correlation. What can I do?&lt;/p&gt;</description></item><item><title>how to speak ggplot2 like a native, and Predictive Analytics World</title><link>https://harlanh.tech/2010/10/how-to-speak-ggplot2-like-a-native-and-predictive-analytics-world/</link><pubDate>Sun, 24 Oct 2010 00:00:00 +0000</pubDate><author>harlan@harris.name (Harlan Harris)</author><guid>https://harlanh.tech/2010/10/how-to-speak-ggplot2-like-a-native-and-predictive-analytics-world/</guid><description>
&lt;p&gt;I was recently given the opportunity to re-present &lt;a href="https://harlanh.tech/2010/03/ggplot-and-concepts-whats-right-and-whats-wrong/"&gt;my ggplot2 talk, which I originally gave&lt;/a&gt; to &lt;a href="http://www.meetup.com/nyhackr/"&gt;the NYC R Meetup&lt;/a&gt;, to &lt;a href="http://www.meetup.com/R-users-DC/"&gt;the DC R Meetup &lt;/a&gt;group. The Meetup was held co-located with the &lt;a href="http://www.predictiveanalyticsworld.com/"&gt;Predictive Analytics World &lt;/a&gt;conference in Alexandria, VA. (More on my thoughts on PAW below…) Contentwise, I made only small changes, changing a bit of patter and adding more examples at the end. I still love ggplot, with some frustration at the way it is typically introduced. Some of the audience had no R experience at all, while others were experts. One person, a grad student at U. of Maryland, had had very similar difficulty as I had when originally learning ggplot2, and his enthusiastic nods during my presentation were very validating! For reference, &lt;a href="http://www.meetup.com/R-users-DC/calendar/14236478/"&gt;the Meetup page is here&lt;/a&gt;, and I stuck the current version of the slides in a public &lt;a href="http://www.dropbox.com/"&gt;Dropbox&lt;/a&gt;, &lt;a href="http://dl.dropbox.com/u/7644953/ggplotIntro%20-%20PAW2010.pptx"&gt;located here&lt;/a&gt;.&lt;/p&gt;</description></item><item><title>Prediction with Multilevel Regression Models, and Pizza</title><link>https://harlanh.tech/2010/10/prediction-with-multilevel-regression-models-and-pizza/</link><pubDate>Fri, 15 Oct 2010 00:00:00 +0000</pubDate><author>harlan@harris.name (Harlan Harris)</author><guid>https://harlanh.tech/2010/10/prediction-with-multilevel-regression-models-and-pizza/</guid><description>
&lt;p&gt;The &lt;a href="http://www.meetup.com/" target="_blank" rel="noopener"&gt;Meetup&lt;/a&gt; phenomenon, which is now substantial and longstanding enough to be more of a cultural change than a &lt;a href="http://www.foursquare.com/" target="_blank" rel="noopener"&gt;flash in the pan&lt;/a&gt;, continues to impress me. Even more so than tools like &lt;a href="http://www.linkedin.com/"&gt;LinkedIn&lt;/a&gt;, Meetups have changed the nature of professional networking, making it more informal, diverse, and decentralized. Last night, statistics consultant (and cheap eats guru) &lt;a href="http://www.jaredlander.com/" target="_blank" rel="noopener"&gt;Jared Lander&lt;/a&gt; and I presented a talk on a statistical technique tangentially related to my professional work (more closely associated with Jared’s). The origin of this presentation is worth noting. On Meetup’s web site, members of a group can suggest topics for meetings. Before even attending a single &lt;a href="http://www.meetup.com/NYC-Predictive-Analytics/"&gt;NYC Predictive Analytics&lt;/a&gt; event, I posted several &lt;a href="http://www.meetup.com/NYC-Predictive-Analytics/ideas/"&gt;topics&lt;/a&gt; that I thought might be interesting for the group. A bit later, the organizers (&lt;a href="http://www.meetup.com/NYC-Predictive-Analytics/members/9260862/"&gt;Bruno&lt;/a&gt; and &lt;a href="http://www.meetup.com/NYC-Predictive-Analytics/members/9260860/"&gt;Alex&lt;/a&gt;) contacted me to see if I’d be willing to present on prediction with Multilevel models. I said that I would, but only if I could co-present with &lt;span style="text-decoration: line-through;"&gt;someone who actually knew something about the topic&lt;/span&gt; a complementary set of skills and experiences. Knowing Jared from the &lt;a href="http://www.meetup.com/nyhackr/"&gt;NYC R Meetup&lt;/a&gt; group, and knowing that he learned about multilevel models from the &lt;a href="http://www.stat.columbia.edu/~gelman/blog/"&gt;professor&lt;/a&gt; who wrote &lt;a href="http://www.stat.columbia.edu/~gelman/arm/"&gt;the best book on the topic&lt;/a&gt;, and knowing that he’s pretty good in front of an audience, I suggested we collaborate.&lt;/p&gt;</description></item><item><title>ggplot and concepts -- what's right, and what's wrong</title><link>https://harlanh.tech/2010/03/ggplot-and-concepts-whats-right-and-whats-wrong/</link><pubDate>Sun, 07 Mar 2010 00:00:00 +0000</pubDate><author>harlan@harris.name (Harlan Harris)</author><guid>https://harlanh.tech/2010/03/ggplot-and-concepts-whats-right-and-whats-wrong/</guid><description>
&lt;p&gt;A few months back I gave a presentation to the &lt;a href="http://www.meetup.com/nyhackr/"&gt;NYC R Meetup&lt;/a&gt;. (&lt;a href="http://www.r-project.org/"&gt;R&lt;/a&gt; is a statistical programming language. If this means nothing to you, feel free to stop reading now.) The presentation was on &lt;a href="http://had.co.nz/ggplot2/"&gt;ggplot2&lt;/a&gt;, a popular package for generating graphs of data and statistics. In the talk (&lt;a href="http://www.vcasmo.com/video/drewconway/7017"&gt;which you can see here&lt;/a&gt;, including both my slides and my patter!) I presented both the really great things about ggplot2 and some of its downsides. In this blog post, I wanted to expand a bit on my thinking on ggplot, the Grammar of Graphics, and how peoples’ conceptual representations of graphs, data, ggplot, and R all interact. ggplot is both incredibly elegant and unfortunately difficult to learn to use well, I think as a consequence of the variety of representations.</description></item></channel></rss>