SlideShare a Scribd company logo
BASICS OF DATA
 MUNGING IN R

      &
DATA MUNGING
OUR GOAL
•


•
    –
    –
    –
    –
    –
SOURCES:
LET’S GET DATA
DATA LOOKS LIKE THIS
TEXT INTO R
       > read.table()
•      > read.csv()

       # Read a table
       > url <-
       'http://robjhyndman.com/tsdldata/robert
       s/beards.dat'

       > read.table(url, header=FALSE,skip=4)
          V1
       1 20
•      2 24
       3 10
       4 21
       5 28
       … …

       # Read a CSV file
       > Y <- read.csv(filename, header=F)
PLAIN TEXT
DATA LOOKS LIKE THIS
MARKUP INTO R
                                                        •
> library(XML)
> url2 <-
‘http://www.faa.gov/data_research/passengers_cargo/un
ruly_passengers/’
> X <- readHTMLTable(url2, header=T,
stringsAsFactors=FALSE)[[1]]
> X
   Year                   Total

                                                        •
1 1995                      146
2 1996                      184
3 1997                      235
4 1998
5 1999
                            200
                            226                             –
6 2000                      227
7 2001                      300
8 2002                      306
9 2003                      302                             –
10 2004                     330
11 2005
12 2006
                            226
                            156
                                                            –
13 2007
14 2008
                            176
                            134                             –
15 2009                     176
16 2010                     148
17 2011                     131
18 2012 12 as of April 10, 2012                             –
HTML
FROM OTHER LANGUAGES
> library(xlsx)
> library(foreign)
                      •
                      •
# SAS
> read.xport(file)

# Stata
> read.dta(file)      •
# SPSS
> read.spss(file)         –
                          –
# Matlab
> read.octave(file)
                          –
                          –
# minitab
> read.mtp(file)
                          –
                          –
                          –
CUSTOM PACKAGES
              >   library(quantmod)
•             >   library(twitteR)
              >   library(RNYTimes)
              >   library(RClimate)


              > getSymbols("GOOG")
              [1] "GOOG"

•             >
              searchTwitter('#ilovestatistics'
    –         ,n=10)[[2]]

              [1]"Statistics: the best kind of
              homework #ilovestatistics #nerd
              #shouldhavebeenastatistician
    –         #gradschoolproblems"
BUILDING AND
EXPLORING DATA
TYPES OF DATA
•           >
            >
                a
                b
                    <-
                    <-
                         c(1,2,3,4)
                         matrix(c(1,2,3,4), nrow=2)
    –       >   c   <-   list("a"="fred", "b"="bill")
    –       >   d   <-   data.frame(b)

    –       > a # VECTOR
    –       [1] 1 2 3 4

•           > b # MATRIX
                 [,1] [,2]
            [1,]    1    3
            [2,]    2    4

            > c # LIST (Note the key-value structure)
•           $a
            [1] "fred"
            $b
            [1] "bill"
    –
            > d # DATA FRAME
              X1 X2
            1 1 3
            2 2 4
CONVERSION AND COERCION
              > as.data.frame(a)
•               a
              1 1
    –         2 2
              3 3
              4 4
              > data.frame(a)
                a
    –         1 1
              2 2
              3 3
        •     4 4

              > as.matrix(a, nrow=2) # WATCH OUT
        •          [,1]
              [1,]    1
              [2,]    2
    –         [3,]    3
              [4,]    4
              > matrix(a, nrow=2)    # THIS INSTEAD!
                   [,1] [,2]
              [1,]    1    3
              [2,]    2    4
VARIABLE INTERROGATION
                 > Y <- runif(200)
•                > str(Y)
                 num [1:200] 0.5053 0.3564 0.0359 0.7377
                 0.0302 ...

                 > head(Y) # GIVE ME THE FIRST 5
                 [1] 0.50525553 0.35636648 0.03589792
•                0.73766891 0.03020607 0.50628327

    –            > tail(Y) # GIVE ME THE LAST 5
                 [1] 0.6612501 0.9930194 0.8392855
    –            0.5459498 0.2587155 0.3704778

    –            > dim(Y) # NOPE! HE IS A VECTOR
                 NULL
    –
                 > length(Y)
                 [1] 200
INDEXES



A[m,n]

A[ ,n]
USING INDEXES
•                                                       > b
                                                             [,1] [,2]
•                                                       [1,]    1    3
•                                                       [2,]    2    4

                                                        > b[,1]   # ALL ROWS, FIRST COLUMN
•                                                       [1] 1 2
•
                                                        > b[2,]   # SECOND ROW, ALL COLUMNS
                                                        [1] 2 4
    > head(unemp)
       rank     region Aug. 2012 Sept. 201 change       > b[-1,] # ALL ROWS EXCEPT 1
    14   14    alabama       8.5       8.3   -0.2
                                                        [1] 2 4
    15   14     alaska       7.7       7.5   -0.2
    27   27    arizona       8.3       8.2   -0.1
    16   14   arkansas       7.3       7.1   -0.2       > b>3
    2     2 california      10.6      10.2   -0.4             [,1] [,2]
    17   14   colorado       8.2       8.0   -0.2       [1,] FALSE FALSE
                                                        [2,] FALSE TRUE
    > unemp[unemp[4]>10,]
       rank       region Aug.   2012 Sept. 201 change
    2     2   california        10.6      10.2   -0.4   > GOOG[GOOG[,6]>768.00,6]
    11    6       nevada        12.1      11.8   -0.3              GOOG.Adjusted
    24   14 rhode island        10.7      10.5   -0.2   2012-10-04        768.05
USE NAMES INSTEAD: $
                                           > X <- 1
•                                          > X$name <- "Fred"
                                           Warning message:
                                           In X$name <- "Fred" : Coercing LHS
                                           to a list
                                           > X$occupation <- "Doctor"
                                           > X$age <- 21
     –
> name <- c("Fred", "Bill")                > X
> occupation <- c("Doctor", "Dancer")      [[1]]
> people <- data.frame(name, occupation)   [1] 1

> people
                                           $name
  name     occupation
                                           [1] "Fred"
1 Fred         Doctor
2 Bill         Dancer
                                           $occupation
> people$age <- 35                         [1] "Doctor"
> people
  name      occupation age                 $age
1 Fred          Doctor 35                  [1] 21
2 Bill          Dancer 35

people[people$name=="Fred",]$age=40
                                           > X$name == X[2]
MORE STRUCTURE



cbind(a,b)
rbind(a,b)
TRANSFORMING DATA
SPEAK LIKE A NATIVE
•                  > mymatrix <-
                   matrix(rep(seq(2,6,by=2), 3),
                   ncol = 3)
    –
        •          > mymatrix
                        [,1] [,2] [,3]
    –              [1,]    2    2    2
        •          [2,]    4    4    4
                   [3,]    6    6    6
    –
        •          > apply(mymatrix, 1, sum)
                   [1] 6 12 18
    –
        •          > apply(mymatrix, 2, sum)
                   [1] 12 12 12
LAPPLY
•        > lapply(mymatrix[,1],sum)
         [[1]]
         [1] 2

         [[2]]
•        [1] 4

         [[3]]
         [1] 6
    –
    –    > sapply(mymatrix[,1],sum)
    –    [1] 2 4 6
LONG TO WIDE
Language Skill Users
1        R High     10
2        R   Med     10
3        R   Low     10
4      SAS High       1
5      SAS   Med    25
6      SAS   Low     20

Language Users.High Users.Med Users.Low
1        R         10        10        10
4      SAS          1        25        20
RESHAPE GYMNASTICS
                                         > df <-
•                                        data.frame(c("R","R","R","SAS","SAS","SAS"),
                                         c("High","Med","Low","High","Med","Low"),
                                         c(10,5,10,1,25,20)); colnames(df) <-
       –                                 c("Language","Skill","Users")

                                         > df
                                           Language Skill Users
                                         1        R High     10
                                         2        R   Med    10
       –                                 3        R   Low    10
                                         4      SAS High      1

•                                        5
                                         6
                                                SAS
                                                SAS
                                                      Med
                                                      Low
                                                             25
                                                             20

                                         > reshape(df, idvar="Language",
                                         timevar="Skill", direction="wide")
    > reshape(df2, direction="long")       Language Users.High Users.Med Users.Low
             Language Skill Users.High
    R.High          R High          10
                                         1        R         10        10        10
    SAS.High      SAS High           1   4      SAS          1        25        20
    R.Med           R   Med         10
    SAS.Med       SAS   Med         25
    R.Low           R   Low         10
    SAS.Low       SAS   Low         20

    > df3[order(df3$Language),]
NEW VARIABLES IN-PLACE
                 > head(mtcars)[1]
•                Mazda RX4
                                    mpg
                                   21.0
                 Mazda RX4 Wag     21.0
                 Datsun 710        22.8
    –            Hornet 4 Drive    21.4
                 Hornet Sportabout 18.7
                 Valiant           18.1
    –
                 > head(with(mtcars, mpg*10)) # NEW VECTOR
•                [1] 210 210 228 214 187 181


    –            > head(transform(mtcars,
                 electricdreams=mpg*10))[c(1,12)]
                                    mpg electricdreams
    –            Mazda RX4         21.0            210
                 Mazda RX4 Wag     21.0            210
    –            Datsun 710        22.8            228
                 Hornet 4 Drive    21.4            214
                 Hornet Sportabout 18.7            187
                 Valiant           18.1            181
MASH UP




> head(unemp)
      region rank Aug. 2012 Sept. 201 change DEV state_code State Abbreviation
1    alabama   14       8.5       8.3   -0.2 0.4         01                 AL
2     alaska   14       7.7       7.5   -0.2 -0.4        02                 AK
3    arizona   27       8.3       8.2   -0.1 0.3         04                 AZ
4   arkansas   14       7.3       7.1   -0.2 -0.8        05                 AR
5 california    2      10.6      10.2   -0.4 2.3         06                 CA
6   colorado   14       8.2       8.0   -0.2 0.1         08                 CO
THANKS
•
•

More Related Content

PDF
Rug hogan-10-03-2012
PPTX
Retro gaming with lambdas stephen chin
PDF
Massively Distributed Backups at Facebook Scale - Shlomo Priymak, Facebook - ...
PDF
Introductionto fp with groovy
PPTX
Php forum2015 tomas_final
PPT
Groovy unleashed
PPTX
BGOUG15: JSON support in MySQL 5.7
KEY
Template Haskell とか
Rug hogan-10-03-2012
Retro gaming with lambdas stephen chin
Massively Distributed Backups at Facebook Scale - Shlomo Priymak, Facebook - ...
Introductionto fp with groovy
Php forum2015 tomas_final
Groovy unleashed
BGOUG15: JSON support in MySQL 5.7
Template Haskell とか

What's hot (20)

PDF
Codigos
KEY
Invertible-syntax 入門
KEY
Metaprogramming in Haskell
PDF
A deeper-understanding-of-spark-internals
PPTX
Introduction to R
PDF
CREATE INDEX … USING VODKA. VODKA CONNECTING INDEXES, Олег Бартунов, Александ...
PDF
Data profiling with Apache Calcite
PDF
Drools5 Community Training Module 3 Drools Expert DRL Syntax
ODP
The PostgreSQL JSON Feature Tour
KEY
Django101 geodjango
KEY
Saving Gaia with GeoDjango
PPTX
Slick: Bringing Scala’s Powerful Features to Your Database Access
PPTX
Switching from java to groovy
PDF
Nik Graf - Get started with Reason and ReasonReact
PDF
Deep dive to PostgreSQL Indexes
KEY
関数潮流(Function Tendency)
PDF
Introducción rápida a SQL
PDF
JDD2015: Functional programing and Event Sourcing - a pair made in heaven - e...
PDF
TDC218SP | Trilha Kotlin - DSLs in a Kotlin Way
PDF
Drools5 Community Training HandsOn 1 Drools DRL Syntax
Codigos
Invertible-syntax 入門
Metaprogramming in Haskell
A deeper-understanding-of-spark-internals
Introduction to R
CREATE INDEX … USING VODKA. VODKA CONNECTING INDEXES, Олег Бартунов, Александ...
Data profiling with Apache Calcite
Drools5 Community Training Module 3 Drools Expert DRL Syntax
The PostgreSQL JSON Feature Tour
Django101 geodjango
Saving Gaia with GeoDjango
Slick: Bringing Scala’s Powerful Features to Your Database Access
Switching from java to groovy
Nik Graf - Get started with Reason and ReasonReact
Deep dive to PostgreSQL Indexes
関数潮流(Function Tendency)
Introducción rápida a SQL
JDD2015: Functional programing and Event Sourcing - a pair made in heaven - e...
TDC218SP | Trilha Kotlin - DSLs in a Kotlin Way
Drools5 Community Training HandsOn 1 Drools DRL Syntax
Ad

Similar to Data Munging in R - Chicago R User Group (20)

PDF
PRE: Datamining 2nd R
PDF
Datamining R 1st
PDF
Datamining r 1st
PPTX
Introduction to R
PDF
R for you
PPTX
BA lab1.pptx
PDF
Extending Operators in Perl with Operator::Util
PDF
جلسه سوم پایتون برای هکر های قانونی دوره مقدماتی پاییز ۹۲
KEY
R for Pirates. ESCCONF October 27, 2011
PPTX
R programming language
PDF
第5回 様々なファイル形式の読み込みとデータの書き出し(解答付き)
PDF
Dr Joshua Bishop, WWF Australia - Presentation - UNAA Vic Natural Capital Sem...
KEY
useR!2010 matome
PDF
Datamining r 4th
PDF
第2回 基本演算,データ型の基礎,ベクトルの操作方法(解答付き)
PDF
Datamining R 4th
PDF
第5回 様々なファイル形式の読み込みとデータの書き出し
PPTX
PPTX
R v01 rprogamming_basic01 (R 프로그래밍 기본)
PPTX
Getting started with R when analysing GitHub commits
PRE: Datamining 2nd R
Datamining R 1st
Datamining r 1st
Introduction to R
R for you
BA lab1.pptx
Extending Operators in Perl with Operator::Util
جلسه سوم پایتون برای هکر های قانونی دوره مقدماتی پاییز ۹۲
R for Pirates. ESCCONF October 27, 2011
R programming language
第5回 様々なファイル形式の読み込みとデータの書き出し(解答付き)
Dr Joshua Bishop, WWF Australia - Presentation - UNAA Vic Natural Capital Sem...
useR!2010 matome
Datamining r 4th
第2回 基本演算,データ型の基礎,ベクトルの操作方法(解答付き)
Datamining R 4th
第5回 様々なファイル形式の読み込みとデータの書き出し
R v01 rprogamming_basic01 (R 프로그래밍 기본)
Getting started with R when analysing GitHub commits
Ad

Recently uploaded (20)

PDF
KodekX | Application Modernization Development
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
DOCX
The AUB Centre for AI in Media Proposal.docx
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PDF
NewMind AI Weekly Chronicles - August'25 Week I
PPTX
Cloud computing and distributed systems.
PDF
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
PDF
Network Security Unit 5.pdf for BCA BBA.
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PPTX
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PDF
Dropbox Q2 2025 Financial Results & Investor Presentation
PDF
Unlocking AI with Model Context Protocol (MCP)
KodekX | Application Modernization Development
Building Integrated photovoltaic BIPV_UPV.pdf
The AUB Centre for AI in Media Proposal.docx
Mobile App Security Testing_ A Comprehensive Guide.pdf
NewMind AI Weekly Chronicles - August'25 Week I
Cloud computing and distributed systems.
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
Reach Out and Touch Someone: Haptics and Empathic Computing
Network Security Unit 5.pdf for BCA BBA.
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
The Rise and Fall of 3GPP – Time for a Sabbatical?
Diabetes mellitus diagnosis method based random forest with bat algorithm
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
Agricultural_Statistics_at_a_Glance_2022_0.pdf
Per capita expenditure prediction using model stacking based on satellite ima...
Dropbox Q2 2025 Financial Results & Investor Presentation
Unlocking AI with Model Context Protocol (MCP)

Data Munging in R - Chicago R User Group

  • 1. BASICS OF DATA MUNGING IN R &
  • 3. OUR GOAL • • – – – – –
  • 6. TEXT INTO R > read.table() • > read.csv() # Read a table > url <- 'http://robjhyndman.com/tsdldata/robert s/beards.dat' > read.table(url, header=FALSE,skip=4) V1 1 20 • 2 24 3 10 4 21 5 28 … … # Read a CSV file > Y <- read.csv(filename, header=F)
  • 9. MARKUP INTO R • > library(XML) > url2 <- ‘http://www.faa.gov/data_research/passengers_cargo/un ruly_passengers/’ > X <- readHTMLTable(url2, header=T, stringsAsFactors=FALSE)[[1]] > X Year Total • 1 1995 146 2 1996 184 3 1997 235 4 1998 5 1999 200 226 – 6 2000 227 7 2001 300 8 2002 306 9 2003 302 – 10 2004 330 11 2005 12 2006 226 156 – 13 2007 14 2008 176 134 – 15 2009 176 16 2010 148 17 2011 131 18 2012 12 as of April 10, 2012 –
  • 10. HTML
  • 11. FROM OTHER LANGUAGES > library(xlsx) > library(foreign) • • # SAS > read.xport(file) # Stata > read.dta(file) • # SPSS > read.spss(file) – – # Matlab > read.octave(file) – – # minitab > read.mtp(file) – – –
  • 12. CUSTOM PACKAGES > library(quantmod) • > library(twitteR) > library(RNYTimes) > library(RClimate) > getSymbols("GOOG") [1] "GOOG" • > searchTwitter('#ilovestatistics' – ,n=10)[[2]] [1]"Statistics: the best kind of homework #ilovestatistics #nerd #shouldhavebeenastatistician – #gradschoolproblems"
  • 14. TYPES OF DATA • > > a b <- <- c(1,2,3,4) matrix(c(1,2,3,4), nrow=2) – > c <- list("a"="fred", "b"="bill") – > d <- data.frame(b) – > a # VECTOR – [1] 1 2 3 4 • > b # MATRIX [,1] [,2] [1,] 1 3 [2,] 2 4 > c # LIST (Note the key-value structure) • $a [1] "fred" $b [1] "bill" – > d # DATA FRAME X1 X2 1 1 3 2 2 4
  • 15. CONVERSION AND COERCION > as.data.frame(a) • a 1 1 – 2 2 3 3 4 4 > data.frame(a) a – 1 1 2 2 3 3 • 4 4 > as.matrix(a, nrow=2) # WATCH OUT • [,1] [1,] 1 [2,] 2 – [3,] 3 [4,] 4 > matrix(a, nrow=2) # THIS INSTEAD! [,1] [,2] [1,] 1 3 [2,] 2 4
  • 16. VARIABLE INTERROGATION > Y <- runif(200) • > str(Y) num [1:200] 0.5053 0.3564 0.0359 0.7377 0.0302 ... > head(Y) # GIVE ME THE FIRST 5 [1] 0.50525553 0.35636648 0.03589792 • 0.73766891 0.03020607 0.50628327 – > tail(Y) # GIVE ME THE LAST 5 [1] 0.6612501 0.9930194 0.8392855 – 0.5459498 0.2587155 0.3704778 – > dim(Y) # NOPE! HE IS A VECTOR NULL – > length(Y) [1] 200
  • 18. USING INDEXES • > b [,1] [,2] • [1,] 1 3 • [2,] 2 4 > b[,1] # ALL ROWS, FIRST COLUMN • [1] 1 2 • > b[2,] # SECOND ROW, ALL COLUMNS [1] 2 4 > head(unemp) rank region Aug. 2012 Sept. 201 change > b[-1,] # ALL ROWS EXCEPT 1 14 14 alabama 8.5 8.3 -0.2 [1] 2 4 15 14 alaska 7.7 7.5 -0.2 27 27 arizona 8.3 8.2 -0.1 16 14 arkansas 7.3 7.1 -0.2 > b>3 2 2 california 10.6 10.2 -0.4 [,1] [,2] 17 14 colorado 8.2 8.0 -0.2 [1,] FALSE FALSE [2,] FALSE TRUE > unemp[unemp[4]>10,] rank region Aug. 2012 Sept. 201 change 2 2 california 10.6 10.2 -0.4 > GOOG[GOOG[,6]>768.00,6] 11 6 nevada 12.1 11.8 -0.3 GOOG.Adjusted 24 14 rhode island 10.7 10.5 -0.2 2012-10-04 768.05
  • 19. USE NAMES INSTEAD: $ > X <- 1 • > X$name <- "Fred" Warning message: In X$name <- "Fred" : Coercing LHS to a list > X$occupation <- "Doctor" > X$age <- 21 – > name <- c("Fred", "Bill") > X > occupation <- c("Doctor", "Dancer") [[1]] > people <- data.frame(name, occupation) [1] 1 > people $name name occupation [1] "Fred" 1 Fred Doctor 2 Bill Dancer $occupation > people$age <- 35 [1] "Doctor" > people name occupation age $age 1 Fred Doctor 35 [1] 21 2 Bill Dancer 35 people[people$name=="Fred",]$age=40 > X$name == X[2]
  • 22. SPEAK LIKE A NATIVE • > mymatrix <- matrix(rep(seq(2,6,by=2), 3), ncol = 3) – • > mymatrix [,1] [,2] [,3] – [1,] 2 2 2 • [2,] 4 4 4 [3,] 6 6 6 – • > apply(mymatrix, 1, sum) [1] 6 12 18 – • > apply(mymatrix, 2, sum) [1] 12 12 12
  • 23. LAPPLY • > lapply(mymatrix[,1],sum) [[1]] [1] 2 [[2]] • [1] 4 [[3]] [1] 6 – – > sapply(mymatrix[,1],sum) – [1] 2 4 6
  • 24. LONG TO WIDE Language Skill Users 1 R High 10 2 R Med 10 3 R Low 10 4 SAS High 1 5 SAS Med 25 6 SAS Low 20 Language Users.High Users.Med Users.Low 1 R 10 10 10 4 SAS 1 25 20
  • 25. RESHAPE GYMNASTICS > df <- • data.frame(c("R","R","R","SAS","SAS","SAS"), c("High","Med","Low","High","Med","Low"), c(10,5,10,1,25,20)); colnames(df) <- – c("Language","Skill","Users") > df Language Skill Users 1 R High 10 2 R Med 10 – 3 R Low 10 4 SAS High 1 • 5 6 SAS SAS Med Low 25 20 > reshape(df, idvar="Language", timevar="Skill", direction="wide") > reshape(df2, direction="long") Language Users.High Users.Med Users.Low Language Skill Users.High R.High R High 10 1 R 10 10 10 SAS.High SAS High 1 4 SAS 1 25 20 R.Med R Med 10 SAS.Med SAS Med 25 R.Low R Low 10 SAS.Low SAS Low 20 > df3[order(df3$Language),]
  • 26. NEW VARIABLES IN-PLACE > head(mtcars)[1] • Mazda RX4 mpg 21.0 Mazda RX4 Wag 21.0 Datsun 710 22.8 – Hornet 4 Drive 21.4 Hornet Sportabout 18.7 Valiant 18.1 – > head(with(mtcars, mpg*10)) # NEW VECTOR • [1] 210 210 228 214 187 181 – > head(transform(mtcars, electricdreams=mpg*10))[c(1,12)] mpg electricdreams – Mazda RX4 21.0 210 Mazda RX4 Wag 21.0 210 – Datsun 710 22.8 228 Hornet 4 Drive 21.4 214 Hornet Sportabout 18.7 187 Valiant 18.1 181
  • 27. MASH UP > head(unemp) region rank Aug. 2012 Sept. 201 change DEV state_code State Abbreviation 1 alabama 14 8.5 8.3 -0.2 0.4 01 AL 2 alaska 14 7.7 7.5 -0.2 -0.4 02 AK 3 arizona 27 8.3 8.2 -0.1 0.3 04 AZ 4 arkansas 14 7.3 7.1 -0.2 -0.8 05 AR 5 california 2 10.6 10.2 -0.4 2.3 06 CA 6 colorado 14 8.2 8.0 -0.2 0.1 08 CO