Installing R and the package igraph on a Mac: As Always, Not Quite the Same

The incredibly useful research program called R is available on many platforms — Linux, Windows and Apple computers — and can run the same scripts across all three of its different versions.  That said, the experience of getting R to run those scripts is not quite the same on an Apple Mac.  This seems to be some kind of unwritten rule for Macs — whatever your program, on a Mac the menus, procedures and names of commands will somehow end up being different.

So what?  Well, if you’re just getting started with R, you’ll need to occasionally get some tips and tricks for making the program work.  Most of the how-to blog posts and videos you can find out there use examples using a Linux or Windows system — and they just won’t work for a Mac.  I found this out the hard way when teaching students to use the igraph package for R to perform social network analysis.  A few of my students have Macs at home, and it didn’t take long for them to cry for help, because the R program they were dealing with looked very little like the R program I’d been showing them.

If you find yourself in the same boat, and are running into trouble using R and igraph, I hope the following video will be of some help. Using a screen capture of a Mac running OS X, I briefly demonstrate the experience of installing R and running a script with the igraph package on from an Apple vantage point.  One difference is that there are a few menu options you’ll need to select when installing igraph to actually make it run.  In another simple but crucial difference for Macs, you’ll need to select all the text in your script before running it.  THEN, and only then, use the “Execute” command.  That’s not necessary on a Windows computer, but it’s a make-or-break move on a Mac.

Why? Don’t ask me why. It’s the same old story that we’ve had for thirty years: it’s just different on a Mac.

The walkthrough video:

Please leave a comment if you have a question or need clarification, and I’d be glad to be of help if I can.

Learning Unbounded: EdX Introduction to R

It’s an open secret: to be a university professor is to be a perpetual student.  Learning doesn’t stop with the PhD; there’s always something new to read, always something new to discover, always something new to write, always something new to analyze, always a new technique to understand. This is why academics love the summer: finally, after teaching what we’ve already learned, we can learn some more!

One of my projects this summer is to bone up on the basics of a computer program for data analysis and visualization called R.  When I was a graduate student in the 1990s, statistical software was produced exclusively by companies at a fairly steep price.  Even now SAS 9.4, a software package used for data analysis in the academic and business communities, costs many thousands of dollars for an individual license (it’s so expensive that SAS won’t publish its price publicly).  If you were lucky, you had access to a university lab with software already installed.  If you didn’t have access and you wanted to run an analysis beyond the simplest level, you were simply out of luck.

All that changed with the introduction of R, a free and open-source program that runs on Windows computers, Mac computers, Unix computers and even web servers.  Methodologists from all kinds of disciplines are increasingly devoted to the development and extension of R, meaning that the latest analytical techniques are regularly added to R through easily added plug-ins called “packages.” R is easy to download, quick to install, and …

… well, I’d like to say it’s easy to run, but the truth is that for a generation that has grown up using pointing and clicking, it may be a bit intimidating to see a program with a command prompt that requires you to work almost entirely by entering text commands at prompts or developing programs of saved commands:

Screenshot of R running in the Windows environment

Still, with a bit of practice, it’s not much harder to type in text commands than it is to choose options in a drop-down menu.  The difference is that with drop-down menus, all options are presented to you in an organized fashion.  When you use R, you have to start out knowing what the commands are, and if you don’t know, you have to go find out.  It’s not R’s responsibility to show you what to do; it’s your responsibility to learn what R can do.  This is learning unbounded.

I became familiar with R by necessity earlier this year, when I needed to generate robust variance estimates in order to account for clustering in a sample.  That option isn’t available in most free menu-driven statistical programs, and I had a budget of $0 for my research project, so I installed R and the package rms by Frank E. Harrell, Jr.  R got the job done.

Since then, I’ve become aware that R can do much more than run a statistical analysis.  It can be used to gather data automatically.  It can be used to write automated webpages.  It can be used to create simulations.  It can visualize patterns in data with amazing graphics and videos (browse through the Google+ community for Statistics and R to get a taste of the possibilities).  But this level of high-end performance requires a more fundamental understanding of R than I’ve got right now.  To get back to basics and build myself a good foundation of understanding, I’ve started EdX’s Introduction to R Programming course.  This is another example of learning unbounded.  It’s an entirely online educational experience, I haven’t paid a cent to enroll, and I’m finding myself interacting with people from all over the globe in the course’s discussion sections.  Students in this course are asked to introduce themselves and say a little bit about where they’re from.  On a whim this morning, I tallied up the countries represented among students in the R course.  They are:

The United States isn’t even the top spot for R students; that position is taken by India, and there are 48 nations sending at least one student to the course. Just as the way we produce knowledge is changing, so is the way we learn how to produce knowledge.

P.S. Faced with a generation of academic and business analysts flocking to R, SAS has lost significant market share. Earlier this year, SAS responded by making a partial version of its software available for free. This software is called SAS University Edition and can be downloaded here. I’ve found installation to be more complicated and time-consuming than for R (the whopping download of a 1.8 GB installation file and the need to first install Oracle VM VirtualBox management software accounts for most of this difficulty), but I’m hopeful that I’ll have this second package of analytical software up and running soon so that I can compare the ease and power of the two programs.

Stages of Teaching and Learning Social Media Analytics (Presentation Notes)

This afternoon, I’ll be making a short presentation of thoughts on teaching social media analytics at the 2015 conference of the International Communication Association as part of its BlueSky Workshop on Tools for Teaching and Learning of Social Media Analytics. While the workshop is focused on the experience of teaching using a series of particular tools, I am interested in rejecting the question, “Which tools are best for teaching?,” and supplanting it with the idea of building capability in students in a progressive strategy. At different stages in students’ development as social media researchers, different analytic platforms may be more or less appropriate as teaching tools.

Below is a copy of notes for my presentation; notes can also be downloaded as a PDF here.

Objective: To introduce unexperienced undergraduate students to the process of analyzing social media with sufficient breadth that they may continue to learn independently.

Teaching Challenges Provoking Implementation:

  • As the mandate for higher education continues to widen, undergraduate students tend more and more to be non-traditional, to lack preparation, to lack confidence, and to be fascinated by but intimidated by math, research and technology.
  • Social media platforms are in a state of constant change.
  • Social media analytics packages and methods are rapidly evolving now and are likely to experience significant change in the next decade.

Learning Outcomes: Students who complete a course in social media analytics will be able to:

  1. Find and navigate social media platforms
  2. Recognize the common elements of social media:
    1. Individuals
    2. Actions
    3. Memberships
    4. Relationships
  3. Extract observations of these elements into datasets:
    1. Individual-level
    2. 1-mode network
    3. 2-mode network
  4. To analyze data and report data visualizations, qualitative categorizations and quantitative statistics

Strategy: A gentle, stepwise series of stages taking students from where they are to where they need to be, introducing students to a variety of analytic platforms, and focusing on the social research skills that will remain constant despite changes in social media and social media analytic platforms.

Stages of learning social media analytics, from Consumer to Manager to Secondhand Gatherer to Primary Gatherer to Analyst

Teaching Challenges in Implementation:

  • Universal access for students who no longer share a common campus, common hardware and common software
  • Reasonable yet challenging entry for students who come to class with a variety of previous experience and capabilities
  • A variety of reasonable endpoints for students who vary in their level of progression and accomplishment