Getting Data into R

One of my students is taking an advanced statistics course–mostly online–and it introduced her to the statistical package R. I’ve been meaning to learn how to use R for a while, so I had her show me how use it. This allowed me to give her a final exam that used some PEW survey data for analysis. (I used the data for the 2013 LGBT survey). These are my notes on getting the PEW data, which is in SPSS format, into R.

Instructions on Getting PEW data into R

Go to the link for the 2013 LGBT survey“>2013 LGBT survey and download the data (you will have to set up an account if you have not used their website before).

  • There should be two files.
    • The .sav file contains the data (in SPSS format)
    • The .docx file contains the metadata (what is metadata?).
  • Load the data into R.
    • To load this data type you will need to let R know that you are importing a foreign data type, so execute the command:
    • > library(foreign)
      
    • To get the file’s name and path execute the command:
    • > file.choose()
      
    • The file.choose() command will give you a long string for the file’s path and name: it should look something like “C:\\Users\…” Copy the name and put it in the following command to read the file (Note 1: I’m naming the data “dataset” but you can call it anything you like; Note 2: The string will look different based on which operating system you use. The one you see below is for Windows):
    • > dataset = read.spss(“C:\\Users\...”)
      
    • To see what’s in the dataset you can use the summary command:
    • > summary(dataset)
      
    • To draw a histogram of the data in column “Q39” (which is the age at which the survey respondents realized they were LGBT) use:
    • > hist(dataset$Q35)
      
    • If you would like to export the column of data labeled “Q39” as a comma delimited file (named “helloQ39Data.csv”) to get it into Excel, use:
    • > write.csv(dataset$Q39, ”helloQ39Data.csv”)
      

This should be enough to get started with R. One problem we encountered was that the R version on Windows was able to produce the histogram of the dataset, while the Mac version was not. I have not had time to look into why, but my guess is that the Windows version is able to screen out the non-numeric values in the dataset while the Mac version is not. But that’s just a guess.

Histogram showing the age at which LGBT respondents first felt that they might be something other than heterosexual.
Histogram showing the age at which LGBT respondents first felt that they might be something other than heterosexual.

Quarto Set

Quarto board.
Quarto board.

One of the more interesting projects of the last year was the wooden Quarto set I made for our middle schoolers to use during their study hall.

The game is quite an interesting one, as was the build. The pieces (rectangular and cylindrical prisms capped with solid or hollow tops) were fairly simple to make using the table-saw for the bodies and laser cutter for the tops. However, I wanted to make a box for the pieces and have the board with its 4×4 grid of circle serve as the top.

Cutting out the top and bottom of the box out of plywood (on the CNC machine) was easy enough, as was lasering on the grid, but the most fascinating part was making the sides of the box. The rounded corners on the top required rounded sides, so I used the laser to cut a living hinge on a piece of plywood and glued it to the base. Then I used some spacer pieces for the inside to hold up an inset that would hold the pieces.

Quarto set box opened up.
Quarto set box opened up.

Cajón

Student sits atop a Cajón.
Student sits atop a Cajón.

Last year, for an interim project, one of my more musically inclined students decide to build a Cajón. It’s a box shaped drum that you can sit on, with a snare inside. He worked up a simple design in Inkscape and I cut it out on the CNC machine at the Techshop. It turned out quite well, and he even built one that I could keep at school.

Finger Labyrinths

Finger Mazes.
Finger Mazes.

Our first through third grade teachers requested these finger labyrinths. I asked Dr. Steurer to explain how they used them:

Sometimes you just need to be alone. Welcome to our 1-2-3 Classroom “Comfort Zone.” When a child needs a break, they may relax and take a time away from any feeling of pressure or being overwhelmed.

One activity found in the “Comfort Zone” is a finger labyrinth crafted by Dr. Urbano. Children are taught three easy steps for slowly tracing the beautifully designed wooden labyrinth.

Step One: Release – Pause and take a deep breath.

Take a deep breath before you begin your finger walk to the center. This is the time for you to calm yourself and get focused. Let go of everything.

Step Two: Receive – Take in the center.

The center is a place for you to gain calm and peace. You can stay in the center point as long as you need.

Step Three: Return – Slowly take the journey back.

Move back out of the center point. Make the transition from the center back into your daily routine, ready and armed with the experience of peace and calm.

The “Comfort Zone” is one area in our classroom used to support our children in improving their abilities to pay attention, to calm down when they are upset and to make better decisions.

​Being Mindful helps with emotional regulation and cognitive focus.

– Dr. Steurer