More exercises in swirl

Once you’ve installed swirl and completed the recommended modules in R Programming in swirl, there are other swirl modules that will help you with course content.

Getting and Cleaning Data (dyplr, tidr, lubridate)

Data cleaning

swirl::install_course(“Getting and Cleaning Data”)

Statistical inference (probability, distributions, hypothesis testing)

probabilities

swirl::install_course(“Statistical Inference”)

Regression Models

regression models

swirl::install_course(“Regression Models”)

Exploratory Data Analysis

visual data exploration

swirl::install_course(“Exploratory Data Analysis”)

More swirl modules available

Online: http://swirlstats.com/scn/title.html

Setting up a Zotero workflow on MacOS

Zotero will only allow you to sync your library using either their service (not enough space) or via WebDAV. My Dreamhost backups storage doesn’t support webDAV. I tinkered around with some options (e.g., storagemadeeasy) to turn either my Dreamhost or my NAS shares into WebDAV folders. But, then, I learned that Mac OS doesn’t play well (or at least easily) with WebDAV, so I abandoned that strategy. Also, though my NAS has an iPad app and related tools to be able to access files remotely (via an encrypted tunnel and using a myCloud app), in practice, they haven’t worked seamlessly or at all.

At every turn, it seems that Dropbox was the only solid solution. Since I’m tired of moving files around to not fill up my free space, I’ve resigned myself to paying for Dropbox storage. Seems silly because I have lots of storage at home and 50GB at Dreamhost and I can get them to work together with lots of ad hoc tools and arrangements, but in this instance, I decided that convenience and reliability was more important than cost. Also, I’m really good at rationalizing money spent on technology.

I set up Zotero with my data directory in my home folder, but my document folder in my Dropbox. My group library files are synced using the Zotero service. I also have copied these to my personal library as separate collections. I installed the ZotFile plugin to manage the documents. It took some back and forth and tweaking to get the settings right, so I’m going to put them all here for future reference.

[In the process of researching how to do this, I consulted these sources, which all had some part of the necessary information. I did try to get things set up with Zotpad, but it kept crashing and wouldn’t work. Maybe someday there will be an updated, stable version.]

For now, the Zotero + Zotfile + Dropbox combo works. The goal is to keep a library of original .pdfs and also copies labeled _md.pdf that have been annotated. The tricky part is making sure both versions are linked to the Zotero database, which is what the Zotfile “send to tablet” features do within Zotero.

Essentially, when I add .pdfs to entries in Zotero, I also need to send them to the ipad folder (highlight all items, right click, manage attachments, send to tablet). This makes a second copy of the file in the ipad subfolder within my Zotero document folder inside Dropbox. Then to read the file on my ipad, I open iAnnotate, use the Dropbox connection to browse to the ipad folder and read/annotate the file. When, I’m done, I can save the file back to Dropbox. Then, next time I want to write/cite, I open Zotero. Zotfile creates to special search folders that will let you see if you have any tablet files that need to be reconnected (Tablet files modified) to their parent items in the Zotero database. So, before writing, I open that search folder to get the annotated files from the tablet back into the database and main library folder (highlight all items, right click, get from tablet). The result is one library with both my original .pdf plus the _md.pdf annotated .pdf. Zotfile also copies all the annotations into the Zotero notes field, too, which is nice. Also, informally, I can treat the ipad folder as a to-read folder, for those times when I’m sitting around bored with my ipad and nothing to do. [<- Ha! That’s what email is for. But, really, I’m never sitting around bored, and I never have nothing to do.] It sounds a bit clunky, but actually isn’t too bad if you just remember to send all new items to your tablet when you add them and then re-get them from the tablet the next time you open Zotero (hence the need for the full 100GB in Dropbox…. though you could set it up so just the ipad folder is in your Dropbox folder). The downside is that this workflow assumes a) you’re adding items to your library from your pc (not tablet) and b) you always send new .pdfs to your tablet from Zotero+Zotfile standalone.

Installing R & RStudio

If you have not used or installed R previously, follow the instructions on this page to install R, RStudio, and swirl before the first day of class. Note: If you are a Windows user, you must have an administrative account to install software.

We will be using R & RStudio during class and for all class assignments. If you do not have a laptop or use a tablet (with iOS or Android) for your academic work, please see me during office hours so that I can direct you to web-based alternatives.

Overview. The steps are generally:

  1. Install “R”, which is the underlying statistical software program that performs all the data manipulation and analysis.
  2. Install “RStudio Desktop”, which is a software program that provides a nice looking user interface (aka GUI) that has additional features that make analysis easier.

Install R. Instructions for installing R are online. Choose your Operating System (e.g., Mac or Win) and follow the instructions for installing the base R package.

If you are unsure which version of the software to download and install, post a question to the class discussion board. Include with your question a link to the page you are asking about so that we can see which choices you have. This StackOverflow page has some useful guidance about how to post a good question, and I would recommend trying to follow this guidance when you post to the class discussion board.

Download and install R before you go on to the next step.

Install RStudio Desktop. Visit this page to download the free version of RStudio Desktop.

Download and install RStudio Desktop before you go on to install the swirl package inside RStudio. The instructions include a list of the swirl learning modules that I recommend for new R users, particularly those who have not used a command script with a statistical software program before.

Installing and exploring R with swirl

swirl is an interactive learning tool that works inside RStudio. I recommend swirl exercises for all R users, but especially for students who have never used a command script with a software analysis program before.

Install the swirl package inside RStudio. You are now ready to install the swirl package in RStudio. A package is a small program that runs inside R/RStudio. Follow the steps below.

Launch or open RStudio. In the “Console” after the > type:

install.packages(“swirl”)

It should look like this:

screenshot of RStudio
Screenshot of RStudio interface

Launch the swirl package inside RStudio by typing in the Console:

library(swirl)

swirl()

If you choose Option 1. R Programming, you should see these options in the Console

swirl R Programming menu options

For our class, I recommend completing the following units for the first week: 1 – 2

If you get stuck, you can always type info() to get a list of additional commands, as illustrated below:

After you are done with a session, type

bye()

You can then either exit RStudio or continue your data analysis.