From Messy to Tidy data


1 | Tidy data



First we load and/or install the necessary packages.


# Install these packages if you haven't already
install.packages("readxl")    # For importing Excel data
install.packages("tidyr")     # For re-organizing your data frames
install.packages("lubridate") # For dates
install.packages("stringr")   # Cleans spaces and character strings
install.packages("forcats")   # For assigning an order to character data c("Gold", "Silver", "Bronze")
install.packages("openxlsx")  # To pull Excel files straight from a website


# Load these packages
library("dplyr")
library("readr")
library("ggplot2")
library("tidyr")     
library("readxl")    
library("lubridate") 
library("stringr")
library("forcats") 
library("openxlsx")


DOWNLOAD — WIDE emissions data file

1.1 Read the data


# Change folder path to the location where you downloaded the emissions files

# Load emissions Excel file
wide_data <- read_excel("data/emissions_data.xlsx")

Look at all of these columns. This is real life.

names(wide_data)
##   [1] "SOURCE_ID"        "AI_ID"            "SOURCE_NAME"     
##   [4] "PERMIT_TYPE"      "NAICS_CODE"       "INVENTORY_YEAR"  
##   [7] "UNIT_CODE"        "222TRIFLUOROETHA" "2233444HEPTAFLUO"
##  [10] "ACENAPHTHEN"      "ACENAPHTHYL"      "ACETALDEHYDE"    
##  [13] "ACETONE"          "ACETONITRILE"     "ACETOPHENONE"    
##  [16] "ACROLEIN"         "ACRYLAMIDE"       "ACRYLIC ACID"    
##  [19] "ACRYLONITRIL"     "ALDEHYDE"         "ALLYL CHLORI"    
##  [22] "AMINOBIPHE,4"     "AMMONIA"          "ANILINE"         
##  [25] "ANISIDINE,O-"     "ANTHRACENE"       "ANTIM TRICL"     
##  [28] "ANTIMONY"         "ANTIMONY O3"      "ANTIMONY OXI"    
##  [31] "ANTIMPENTAFL"     "ARSENIC"          "ARSENIC O3"      
##  [34] "ARSINE"           "BARIUM CHROM"     "BENZ(A)ANTHR"    
##  [37] "BENZ(BK)FL"       "BENZ(GHI)PE"      "BENZALDEHYDE"    
##  [40] "BENZENE"          "BENZIDINE"        "BENZO(A)PYRE"    
##  [43] "BENZO(B)FLUO"     "BENZO(E)PYRE"     "BENZO(GHI)FL"    
##  [46] "BENZO(J)FLUO"     "BENZO(K)FLUO"     "BENZOFLUO"       
##  [49] "BENZYL CHLOR"     "BERYLL OXIDE"     "BERYLLIUM"       
##  [52] "BIPHENYL"         "BIS(2-CLETH)"     "BROMOFORM"       
##  [55] "BROMOMETH"        "BUT CARBITOL"     "BUT CELLOSOL"    
##  [58] "BUTADIENE,13"     "BUTBENZYLPHT"     "BUTCARBACET"     
##  [61] "BUTETACET,2"      "BUTYRALDEHYDE,N"  "CA CHROMATE"     
##  [64] "CAD SULFIDE"      "CADMIUM"          "CADMIUM OXI"     
##  [67] "CARB ACETATE"     "CARBON DISUL"     "CARBON TETRA"    
##  [70] "CARBONYL SUL"     "CATECHOL"         "CELLOSLV ACE"    
##  [73] "CELLOSOLVE"       "CFC-11"           "CFC-113"         
##  [76] "CHLORINE"         "CHLORNAPH,2"      "CHLOROBENZ"      
##  [79] "CHLOROETHANE"     "CHLOROFORM"       "CHLOROPRENE"     
##  [82] "CHRO(VI)OXID"     "CHROM HYDROX"     "CHROM ZN OX"     
##  [85] "CHROM(III)OX"     "CHROMIC ACID"     "CHROMIUM"        
##  [88] "CHROMIUM III"     "CHROMIUM O2"      "CHROMIUM VI"     
##  [91] "CHROMYL CL"       "CHRYSENE"         "CLACETOPHE,2"    
##  [94] "CO"               "CO2"              "CO2-B"           
##  [97] "COBALT"           "COBALT ALUM"      "COBALT NAPH"     
## [100] "COBALT OXIDE"     "COBALT SULFA"     "COBALT2E(STO"    
## [103] "COBALT2ETHEX"     "COPPER"           "CRESOL MX IS"    
## [106] "CRESOL,M"         "CRESOL,O"         "CRESOL,P"        
## [109] "CROTONALDEHY"     "CU CYANIDE"       "CUMENE"          
## [112] "CYANIDE"          "CYCHEXANE"        "D02-TS"          
## [115] "D03"              "DIBENZ(AE)PY"     "DIBENZ(AH)AC"    
## [118] "DIBENZ(AH)PY"     "DIBENZ(AI)PY"     "DIBENZ(AJ)AC"    
## [121] "DIBENZ(AL)PY"     "DIBENZ(CG)CA"     "DIBENZAHAN"      
## [124] "DIBENZOFURAN"     "DIBROMOET,12"     "DIBUTYL PHTH"    
## [127] "DICHLORETH12"     "DICLBENZ,14"      "DICLBENZEN,M"    
## [130] "DICLBENZEN,O"     "DICLBENZENES"     "DICLETH,11-"     
## [133] "DICLETHE,12"      "DICLPROP,13C"     "DICLPROP,13T"    
## [136] "DICLPROPE,13"     "DIEGLYDIMETH"     "DIETGLETMEET"    
## [139] "DIETGLMOBUPH"     "DIETGLMOETET"     "DIETGLMOMEET"    
## [142] "DIETHANOLAMI"     "DIMETH AMINO"     "DIMETH PHTHA"    
## [145] "DIMETH SULFA"     "DIMETHBNZ,33"     "DIMETHFORMAM"    
## [148] "DIMETHOXY,12"     "DIMETHOXY,33"     "DIMETHYLANIL"    
## [151] "DIMETHYLB"        "DINITROPH,24"     "DINITRTOL,24"    
## [154] "DIOCTYL PHTH"     "DIOCTYLPHTH,N"    "DIOXANE"         
## [157] "EPICLHYDRIN"      "EPOXYBUT,12"      "ETGLMOSEBUET"    
## [160] "ETH ACRYLATE"     "ETHGLYMOETAC"     "ETHYLBENZENE"    
## [163] "ETHYLENE GLY"     "ETHYLENE IMI"     "ETHYLENE OXI"    
## [166] "FC-72"            "FC-770"           "FLUORANTHENE"    
## [169] "FLUORENE"         "FORMALDEHYDE"     "GLYCOL ETHRS"    
## [172] "Galden DET"       "H2SO4"            "HCL"             
## [175] "HEXACL-1,3-C"     "HEXAMETHYL16"     "HEXANE"          
## [178] "HEXCHLORETH"      "HEXCL-13-BUT"     "HEXCLBENZENE"    
## [181] "HEXYETHANOL2"     "HEXYL CARB"       "HF"              
## [184] "HFC-125"          "HFC-134a"         "HFC-143a"        
## [187] "HFC-152a"         "HFC-227ea"        "HFC-23"          
## [190] "HFC-41"           "HFE-449s1"        "HFE-569sf2"      
## [193] "HFE-7500"         "HPCB,TOT"         "HPCDD1234678"    
## [196] "HPCDF1234678"     "HPCDF1234789"     "HXCB,TOT"        
## [199] "HXCDD,123478"     "HXCDD,123678"     "HXCDD,123789"    
## [202] "HXCDF,123478"     "HXCDF,123678"     "HXCDF,123789"    
## [205] "HXCDF,234678"     "HYDROGEN CYA"     "HYDROQUINONE"    
## [208] "INDN(123CDPY"     "ISOPHORONE"       "K CHROMATE"      
## [211] "K CYANIDE"        "K DICHROM"        "K FERROCYAN"     
## [214] "LEAD"             "LEAD CARB"        "LEAD CHROMAT"    
## [217] "LEAD PHOS"        "LEAD SULF"        "LEAD(II)OXID"    
## [220] "MALEIC ANHYD"     "MANGAN NITR"      "MANGAN O2"       
## [223] "MANGAN O3"        "MANGAN SULF"      "MANGAN TALL"     
## [226] "MANGANESE"        "MERCURY"          "MERCURY,ORG"     
## [229] "METEN BIS,44"     "METH ETH KET"     "METH HYDRAZI"    
## [232] "METH IODIDE"      "METH ISOBUT"      "METH ISOCYAN"    
## [235] "METH METHACR"     "METH NAPHT,1"     "METH TERT BU"    
## [238] "METHANE"          "METHANOL"         "METHCHRYS,5"     
## [241] "METHENE DIAN"     "METHENE(B)4-"     "METHYL CHLOR"    
## [244] "METHYLANTHR"      "METHYLCHOLA3"     "METHYLENE CL"    
## [247] "METHYLNAPHT2"     "MONOCB,2"         "NAPHTHALENE"     
## [250] "NF3"              "NI ACET DIHY"     "NI BROMIDE"      
## [253] "NI CHLORIDE"      "NI HYDROX"        "NI NITRITE"      
## [256] "NI SULFAMATE"     "NI SULFATE"       "NI(II) OXIDE"    
## [259] "NI(III)OXIDE"     "NICKEL"           "NICKEL REFIN"    
## [262] "NITRBIPHEN,4"     "NITROBENZ"        "NITROPHENL,4"    
## [265] "NITROPROPA,2"     "NITROSODIMET"     "NITROSOMORPH"    
## [268] "NITROUS OXID"     "NOX"              "OCDD,TOT"        
## [271] "OCDF,TOT"         "PAH"              "PAH/POM"         
## [274] "PCB,209"          "PCBS"             "PCP"             
## [277] "PECB,TOT"         "PECDD,12378"      "PECDF,12378"     
## [280] "PECDF,23478"      "PENTCLNITBEN"     "PERC"            
## [283] "PERYLENE"         "PFC"              "PFC-116"         
## [286] "PFC-14"           "PFC-218"          "PFC-318"         
## [289] "PHEN CELLO"       "PHENANTHRENE"     "PHENOL"          
## [292] "PHENYLENED,P"     "PHOSPHINE"        "PHOSPHORUS"      
## [295] "PHTHALIC ANH"     "PM"               "PM-CON"          
## [298] "PM-FIL"           "PM10-FIL"         "PM10-PRI"        
## [301] "PM25-FIL"         "PROP IM, 12"      "PROPIONALDEH"    
## [304] "PROPYL CELLO"     "PROPYLENE"        "PRPLENE DICH"    
## [307] "PRPLENE OXID"     "PYRENE"           "QUINONE"         
## [310] "SELEN DISULF"     "SELEN OXIDE"      "SELENIUM"        
## [313] "SILV CYANIDE"     "SO2"              "SODIUM CHRO6"    
## [316] "SODIUM CYAN"      "SODIUM DICHR"     "STRON CHROM"     
## [319] "STYRENE"          "SULF HXFLUOR"     "TCB,TOT"         
## [322] "TCDD,2378"        "TCDF,2378"        "TCE,111"         
## [325] "TETCLET,1122"     "TETETH LEAD"      "TITAN TETCL"     
## [328] "TOLUENE"          "TOLUENE24DII"     "TOLUIDINE,O-"    
## [331] "TRICB,244"        "TRICHLORETHY"     "TRICLBNZ,124"    
## [334] "TRICLETH,112"     "TRICLPHN,245"     "TRICLPHN,246"    
## [337] "TRIETHAMINE"      "TRIFLURALIN"      "TRIME-PENTAN"    
## [340] "TRIMETHBE124"     "TRIMETHBE135"     "VANADIUM"        
## [343] "VINLIDENE CL"     "VINYL ACETAT"     "VINYL BROMID"    
## [346] "VINYL CHLOR"      "VOC"              "XYLENE,M"        
## [349] "XYLENE,O"         "XYLENE,P"         "XYLENES ISO"     
## [352] "ZINC"             "ZINC CYANIDE"     "ZN CHROMATE"     
## [355] "ZN CHROMITE"      "ZN K CHROM"       "SOLV IN COAT"

1.2 Clean the data.

# 2. Make all names lowercase
wide_data <- wide_data %>% rename_all(tolower)


Now we are going to zip all of these columns into one pollutant column. This is a function in the tidyr package called gather()


# 3. Gather all the pollutant columns into one
long_data <- wide_data %>% 
                gather(key = pollutant, value = emissions, `222trifluoroetha`:`solv in coat`)

We still have some cleaning to do.

# 4. Drop the missing values and zero emissions
long_data <- filter(long_data, !is.na(emissions), emissions > 0)

Plot the data, Plot the data, Plot the data

#5. Plot emissions for *ALL* pollutants
long_data %>% ggplot(aes(x = pollutant, y = emissions)) + 
                geom_boxplot() + 
                scale_y_log10() +
                theme(axis.text.x = element_text(angle = 90, hjust = 1))


#6. Plot GHGs
long_data <- filter(long_data, pollutant %in% c("co2", "co2-b", "methane", "nitrous oxid", "hfc-134a"))

long_data %>% 
  ggplot(aes(x = pollutant, y = emissions)) + 
    geom_boxplot() + 
    scale_y_log10()

# 6. Arrange plots in descending order
long_data <- long_data %>% arrange(desc(emissions))

# See the new pollutant order
unique(long_data$pollutant)
## [1] "co2"          "co2-b"        "methane"      "nitrous oxid"
## [5] "hfc-134a"
# Use fct_inorder() to tell ggplot to respect your pollutant order.
long_data %>% 
  ggplot(aes(x = fct_inorder(pollutant), y = emissions)) + 
    geom_boxplot() + 
    scale_y_log10() +
    labs(x = "Pollutant")

1.3 Bonus

# Flip your data back to wide format using 
## spread(data, column_to_spread, column_to_use_for_values)

wide_again <- spread(long_data, pollutant, emissions)  


TOO many files to read?

What if you get an entire folder of WIDE data and need to look at all of it by this Friday?? {-}

1.4 Looping through files

# Example "for loop"
num <- 1:10

num
##  [1]  1  2  3  4  5  6  7  8  9 10
# Pi loop
for (i in num) {
  
  print(i + pi)
  
}
## [1] 4.141593
## [1] 5.141593
## [1] 6.141593
## [1] 7.141593
## [1] 8.141593
## [1] 9.141593
## [1] 10.14159
## [1] 11.14159
## [1] 12.14159
## [1] 13.14159


Download these files into a folder called “messy_data”

DOWNLOAD — An entire folder of data files

1.5 list.files


list.files() is my friend. It provides a list of all of the file names in a folder.


# Type in the folder where you downloaded the messy data folder
# R will look for your data there

folder_path <- "data/messy_data"

folder_emissions <- list.files(folder_path)

# If you can't remember what directory you are in, this function helps
list.files("../")
## [1] "_index.md" "data"      "images"    "page"      "post"


1.6 for() loop


## Set up an empty data frame
data_emissions <- data.frame()

## For loop for WIDE emission files

for (i in folder_emissions) {
  
  print(i)
  
  # Read in a single file
  temp <- read_xlsx(paste0(folder_path, "/", i))
 
  # Add to master table of all files  
  data_emissions <- bind_rows(temp, data_emissions)

}
## [1] "emissions_2011.xlsx"
## [1] "emissions_2012.xlsx"
## [1] "emissions_2013.xlsx"
## [1] "emissions_2014.xlsx"
## [1] "emissions_2015.xlsx"
## [1] "emissions_2016.xlsx"
## [1] "emissions_2017.xlsx"


Now for all of those WIDE emissions files we only have to process and clean the data once.


# Fix column names
data_emissions <- data_emissions %>%
  rename_all(tolower)

names(data_emissions)
##   [1] "source_id"        "ai_id"            "source_name"     
##   [4] "permit_type"      "naics_code"       "inventory_year"  
##   [7] "unit_code"        "222trifluoroetha" "2233444heptafluo"
##  [10] "acenaphthen"      "acenaphthyl"      "acetaldehyde"    
##  [13] "acetone"          "acetonitrile"     "acetophenone"    
##  [16] "acrolein"         "acrylamide"       "acrylic acid"    
##  [19] "acrylonitril"     "aldehyde"         "allyl chlori"    
##  [22] "aminobiphe,4"     "ammonia"          "aniline"         
##  [25] "anisidine,o-"     "anthracene"       "antim tricl"     
##  [28] "antimony"         "antimony o3"      "antimony oxi"    
##  [31] "antimpentafl"     "arsenic"          "arsenic o3"      
##  [34] "arsine"           "barium chrom"     "benz(a)anthr"    
##  [37] "benz(bk)fl"       "benz(ghi)pe"      "benzaldehyde"    
##  [40] "benzene"          "benzidine"        "benzo(a)pyre"    
##  [43] "benzo(b)fluo"     "benzo(e)pyre"     "benzo(ghi)fl"    
##  [46] "benzo(j)fluo"     "benzo(k)fluo"     "benzofluo"       
##  [49] "benzyl chlor"     "beryll oxide"     "beryllium"       
##  [52] "biphenyl"         "bis(2-cleth)"     "bromoform"       
##  [55] "bromometh"        "but carbitol"     "but cellosol"    
##  [58] "butadiene,13"     "butbenzylpht"     "butcarbacet"     
##  [61] "butetacet,2"      "butyraldehyde,n"  "ca chromate"     
##  [64] "cad sulfide"      "cadmium"          "cadmium oxi"     
##  [67] "carb acetate"     "carbon disul"     "carbon tetra"    
##  [70] "carbonyl sul"     "catechol"         "celloslv ace"    
##  [73] "cellosolve"       "cfc-11"           "cfc-113"         
##  [76] "chlorine"         "chlornaph,2"      "chlorobenz"      
##  [79] "chloroethane"     "chloroform"       "chloroprene"     
##  [82] "chro(vi)oxid"     "chrom hydrox"     "chrom zn ox"     
##  [85] "chrom(iii)ox"     "chromic acid"     "chromium"        
##  [88] "chromium iii"     "chromium o2"      "chromium vi"     
##  [91] "chromyl cl"       "chrysene"         "clacetophe,2"    
##  [94] "co"               "co2"              "co2-b"           
##  [97] "cobalt"           "cobalt alum"      "cobalt naph"     
## [100] "cobalt oxide"     "cobalt sulfa"     "cobalt2e(sto"    
## [103] "cobalt2ethex"     "copper"           "cresol mx is"    
## [106] "cresol,m"         "cresol,o"         "cresol,p"        
## [109] "crotonaldehy"     "cu cyanide"       "cumene"          
## [112] "cyanide"          "cychexane"        "d02-ts"          
## [115] "d03"              "dibenz(ae)py"     "dibenz(ah)ac"    
## [118] "dibenz(ah)py"     "dibenz(ai)py"     "dibenz(aj)ac"    
## [121] "dibenz(al)py"     "dibenz(cg)ca"     "dibenzahan"      
## [124] "dibenzofuran"     "dibromoet,12"     "dibutyl phth"    
## [127] "dichloreth12"     "diclbenz,14"      "diclbenzen,m"    
## [130] "diclbenzen,o"     "diclbenzenes"     "dicleth,11-"     
## [133] "diclethe,12"      "diclprop,13c"     "diclprop,13t"    
## [136] "diclprope,13"     "dieglydimeth"     "dietgletmeet"    
## [139] "dietglmobuph"     "dietglmoetet"     "dietglmomeet"    
## [142] "diethanolami"     "dimeth amino"     "dimeth phtha"    
## [145] "dimeth sulfa"     "dimethbnz,33"     "dimethformam"    
## [148] "dimethoxy,12"     "dimethoxy,33"     "dimethylanil"    
## [151] "dimethylb"        "dinitroph,24"     "dinitrtol,24"    
## [154] "dioctyl phth"     "dioctylphth,n"    "dioxane"         
## [157] "epiclhydrin"      "epoxybut,12"      "etglmosebuet"    
## [160] "eth acrylate"     "ethglymoetac"     "ethylbenzene"    
## [163] "ethylene gly"     "ethylene imi"     "ethylene oxi"    
## [166] "fc-72"            "fc-770"           "fluoranthene"    
## [169] "fluorene"         "formaldehyde"     "glycol ethrs"    
## [172] "galden det"       "h2so4"            "hcl"             
## [175] "hexacl-1,3-c"     "hexamethyl16"     "hexane"          
## [178] "hexchloreth"      "hexcl-13-but"     "hexclbenzene"    
## [181] "hexyethanol2"     "hexyl carb"       "hf"              
## [184] "hfc-125"          "hfc-134a"         "hfc-143a"        
## [187] "hfc-152a"         "hfc-227ea"        "hfc-23"          
## [190] "hfc-41"           "hfe-449s1"        "hfe-569sf2"      
## [193] "hfe-7500"         "hpcb,tot"         "hpcdd1234678"    
## [196] "hpcdf1234678"     "hpcdf1234789"     "hxcb,tot"        
## [199] "hxcdd,123478"     "hxcdd,123678"     "hxcdd,123789"    
## [202] "hxcdf,123478"     "hxcdf,123678"     "hxcdf,123789"    
## [205] "hxcdf,234678"     "hydrogen cya"     "hydroquinone"    
## [208] "indn(123cdpy"     "isophorone"       "k chromate"      
## [211] "k cyanide"        "k dichrom"        "k ferrocyan"     
## [214] "lead"             "lead carb"        "lead chromat"    
## [217] "lead phos"        "lead sulf"        "lead(ii)oxid"    
## [220] "maleic anhyd"     "mangan nitr"      "mangan o2"       
## [223] "mangan o3"        "mangan sulf"      "mangan tall"     
## [226] "manganese"        "mercury"          "mercury,org"     
## [229] "meten bis,44"     "meth eth ket"     "meth hydrazi"    
## [232] "meth iodide"      "meth isobut"      "meth isocyan"    
## [235] "meth methacr"     "meth napht,1"     "meth tert bu"    
## [238] "methane"          "methanol"         "methchrys,5"     
## [241] "methene dian"     "methene(b)4-"     "methyl chlor"    
## [244] "methylanthr"      "methylchola3"     "methylene cl"    
## [247] "methylnapht2"     "monocb,2"         "naphthalene"     
## [250] "nf3"              "ni acet dihy"     "ni bromide"      
## [253] "ni chloride"      "ni hydrox"        "ni nitrite"      
## [256] "ni sulfamate"     "ni sulfate"       "ni(ii) oxide"    
## [259] "ni(iii)oxide"     "nickel"           "nickel refin"    
## [262] "nitrbiphen,4"     "nitrobenz"        "nitrophenl,4"    
## [265] "nitropropa,2"     "nitrosodimet"     "nitrosomorph"    
## [268] "nitrous oxid"     "nox"              "ocdd,tot"        
## [271] "ocdf,tot"         "pah"              "pah/pom"         
## [274] "pcb,209"          "pcbs"             "pcp"             
## [277] "pecb,tot"         "pecdd,12378"      "pecdf,12378"     
## [280] "pecdf,23478"      "pentclnitben"     "perc"            
## [283] "perylene"         "pfc"              "pfc-116"         
## [286] "pfc-14"           "pfc-218"          "pfc-318"         
## [289] "phen cello"       "phenanthrene"     "phenol"          
## [292] "phenylened,p"     "phosphine"        "phosphorus"      
## [295] "phthalic anh"     "pm"               "pm-con"          
## [298] "pm-fil"           "pm10-fil"         "pm10-pri"        
## [301] "pm25-fil"         "prop im, 12"      "propionaldeh"    
## [304] "propyl cello"     "propylene"        "prplene dich"    
## [307] "prplene oxid"     "pyrene"           "quinone"         
## [310] "selen disulf"     "selen oxide"      "selenium"        
## [313] "silv cyanide"     "so2"              "sodium chro6"    
## [316] "sodium cyan"      "sodium dichr"     "stron chrom"     
## [319] "styrene"          "sulf hxfluor"     "tcb,tot"         
## [322] "tcdd,2378"        "tcdf,2378"        "tce,111"         
## [325] "tetclet,1122"     "teteth lead"      "titan tetcl"     
## [328] "toluene"          "toluene24dii"     "toluidine,o-"    
## [331] "tricb,244"        "trichlorethy"     "triclbnz,124"    
## [334] "tricleth,112"     "triclphn,245"     "triclphn,246"    
## [337] "triethamine"      "trifluralin"      "trime-pentan"    
## [340] "trimethbe124"     "trimethbe135"     "vanadium"        
## [343] "vinlidene cl"     "vinyl acetat"     "vinyl bromid"    
## [346] "vinyl chlor"      "voc"              "xylene,m"        
## [349] "xylene,o"         "xylene,p"         "xylenes iso"     
## [352] "zinc"             "zinc cyanide"     "zn chromate"     
## [355] "zn chromite"      "zn k chrom"       "solv in coat"
# Gather into the long format
long_data <- wide_data %>% 
                gather(key   = pollutant, 
                       value = emissions, 
                       `222trifluoroetha`:`solv in coat`)

# Drop the missing values and zero emissions
long_data <- filter(long_data, !is.na(emissions), emissions > 0)

# View final table
glimpse(data_emissions)
## Observations: 2,211
## Variables: 357
## $ source_id          <chr> "2701500048", "2701500049", "2701500050", "...
## $ ai_id              <chr> NA, "1983", "52", "4137", "610", "260", "24...
## $ source_name        <chr> "MCG Inc", "NC Minerals LLC - Sleepy Eye", ...
## $ permit_type        <chr> "B", "D", "B", "B", "D", "D", "NM", "B", "R...
## $ naics_code         <chr> "335312", "212325", "811121", "811121", "33...
## $ inventory_year     <dbl> 2014, 2014, 2014, 2014, 2014, 2014, 2014, 2...
## $ unit_code          <chr> "GAL", "TON", "GAL", "GAL", "TON", "TON", "...
## $ `222trifluoroetha` <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,...
## $ `2233444heptafluo` <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,...
## $ acenaphthen        <dbl> NA, 2.952000e-09, NA, NA, 3.572000e-09, 2.1...
## $ acenaphthyl        <dbl> NA, 2.952000e-09, NA, NA, 3.572000e-09, 2.1...
## $ acetaldehyde       <dbl> NA, NA, NA, NA, NA, NA, NA, NA, 0.000016909...
## $ acetone            <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, 3.6...
## $ acetonitrile       <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,...
## $ acetophenone       <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, 1.9...
## $ acrolein           <dbl> NA, NA, NA, NA, NA, NA, NA, NA, 0.000000124...
## $ acrylamide         <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,...
## $ `acrylic acid`     <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,...
## $ acrylonitril       <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,...
## $ aldehyde           <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,...
## $ `allyl chlori`     <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,...
## $ `aminobiphe,4`     <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,...
## $ ammonia            <dbl> NA, 0.0052480, NA, NA, 0.0063500, 0.0385400...
## $ aniline            <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,...
## $ `anisidine,o-`     <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,...
## $ anthracene         <dbl> NA, 3.936000e-09, NA, NA, 4.763000e-09, 2.8...
## $ `antim tricl`      <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,...
## $ antimony           <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, 1.5...
## $ `antimony o3`      <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,...
## $ `antimony oxi`     <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,...
## $ antimpentafl       <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,...
## $ arsenic            <dbl> NA, 3.280000e-07, NA, NA, 3.969000e-07, 2.4...
## $ `arsenic o3`       <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,...
## $ arsine             <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,...
## $ `barium chrom`     <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,...
## $ `benz(a)anthr`     <dbl> NA, 2.952000e-09, NA, NA, 3.572000e-09, 2.1...
## $ `benz(bk)fl`       <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,...
## $ `benz(ghi)pe`      <dbl> NA, 1.968000e-09, NA, NA, 2.381000e-09, 1.4...
## $ benzaldehyde       <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,...
## $ benzene            <dbl> NA, 3.444000e-06, NA, NA, 4.167000e-06, 2.5...
## $ benzidine          <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,...
## $ `benzo(a)pyre`     <dbl> NA, 1.968000e-09, NA, NA, 2.381000e-09, 1.4...
## $ `benzo(b)fluo`     <dbl> NA, 2.952000e-09, NA, NA, 3.572000e-09, 2.1...
## $ `benzo(e)pyre`     <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, 0.0...
## $ `benzo(ghi)fl`     <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,...
## $ `benzo(j)fluo`     <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,...
## $ `benzo(k)fluo`     <dbl> NA, 2.952000e-09, NA, NA, 3.572000e-09, 2.1...
## $ benzofluo          <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,...
## $ `benzyl chlor`     <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,...
## $ `beryll oxide`     <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,...
## $ beryllium          <dbl> NA, 1.968000e-08, NA, NA, 2.381000e-08, 1.4...
## $ biphenyl           <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,...
## $ `bis(2-cleth)`     <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,...
## $ bromoform          <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,...
## $ bromometh          <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, 0.0...
## $ `but carbitol`     <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,...
## $ `but cellosol`     <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,...
## $ `butadiene,13`     <dbl> NA, NA, NA, NA, NA, NA, NA, NA, 0.000007801...
## $ butbenzylpht       <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,...
## $ butcarbacet        <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,...
## $ `butetacet,2`      <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,...
## $ `butyraldehyde,n`  <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,...
## $ `ca chromate`      <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,...
## $ `cad sulfide`      <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,...
## $ cadmium            <dbl> NA, 1.804000e-06, NA, NA, 2.183000e-06, 1.3...
## $ `cadmium oxi`      <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,...
## $ `carb acetate`     <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,...
## $ `carbon disul`     <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, 0.0...
## $ `carbon tetra`     <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, 0.0...
## $ `carbonyl sul`     <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,...
## $ catechol           <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,...
## $ `celloslv ace`     <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,...
## $ cellosolve         <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,...
## $ `cfc-11`           <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, 0.0...
## $ `cfc-113`          <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,...
## $ chlorine           <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, 1.5...
## $ `chlornaph,2`      <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, 0.0...
## $ chlorobenz         <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, 0.3...
## $ chloroethane       <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,...
## $ chloroform         <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, 7.4...
## $ chloroprene        <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,...
## $ `chro(vi)oxid`     <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,...
## $ `chrom hydrox`     <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,...
## $ `chrom zn ox`      <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,...
## $ `chrom(iii)ox`     <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,...
## $ `chromic acid`     <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,...
## $ chromium           <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,...
## $ `chromium iii`     <dbl> NA, 2.204000e-06, NA, NA, 2.667000e-06, 1.6...
## $ `chromium o2`      <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,...
## $ `chromium vi`      <dbl> NA, 9.184000e-08, NA, NA, 1.111000e-07, 6.7...
## $ `chromyl cl`       <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,...
## $ chrysene           <dbl> NA, 2.952000e-09, NA, NA, 3.572000e-09, 2.1...
## $ `clacetophe,2`     <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,...
## $ co                 <dbl> NA, 0.137800, NA, NA, 0.166700, 1.015630, 0...
## $ co2                <dbl> NA, 201.400, NA, NA, 243.800, 1485.071, NA,...
## $ `co2-b`            <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, 134...
## $ cobalt             <dbl> NA, 1.378000e-07, NA, NA, 1.667000e-07, 1.0...
## $ `cobalt alum`      <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,...
## $ `cobalt naph`      <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,...
## $ `cobalt oxide`     <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,...
## $ `cobalt sulfa`     <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,...
## $ `cobalt2e(sto`     <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,...
## $ cobalt2ethex       <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,...
## $ copper             <dbl> NA, 1.394000e-06, NA, NA, 1.687000e-06, 1.0...
## $ `cresol mx is`     <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,...
## $ `cresol,m`         <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,...
## $ `cresol,o`         <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,...
## $ `cresol,p`         <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,...
## $ crotonaldehy       <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, 0.0...
## $ `cu cyanide`       <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,...
## $ cumene             <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, 0.0...
## $ cyanide            <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,...
## $ cychexane          <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,...
## $ `d02-ts`           <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,...
## $ d03                <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,...
## $ `dibenz(ae)py`     <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,...
## $ `dibenz(ah)ac`     <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,...
## $ `dibenz(ah)py`     <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,...
## $ `dibenz(ai)py`     <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,...
## $ `dibenz(aj)ac`     <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,...
## $ `dibenz(al)py`     <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,...
## $ `dibenz(cg)ca`     <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,...
## $ dibenzahan         <dbl> NA, 1.968000e-09, NA, NA, 2.381000e-09, 1.4...
## $ dibenzofuran       <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,...
## $ `dibromoet,12`     <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, 0.0...
## $ `dibutyl phth`     <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, 7.1...
## $ dichloreth12       <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, 0.0...
## $ `diclbenz,14`      <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,...
## $ `diclbenzen,m`     <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,...
## $ `diclbenzen,o`     <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,...
## $ diclbenzenes       <dbl> NA, 0.0000019680, NA, NA, 0.0000023810, 0.0...
## $ `dicleth,11-`      <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,...
## $ `diclethe,12`      <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, 0.1...
## $ `diclprop,13c`     <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,...
## $ `diclprop,13t`     <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,...
## $ `diclprope,13`     <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,...
## $ dieglydimeth       <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,...
## $ dietgletmeet       <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,...
## $ dietglmobuph       <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,...
## $ dietglmoetet       <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,...
## $ dietglmomeet       <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,...
## $ diethanolami       <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,...
## $ `dimeth amino`     <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,...
## $ `dimeth phtha`     <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,...
## $ `dimeth sulfa`     <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,...
## $ `dimethbnz,33`     <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,...
## $ dimethformam       <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,...
## $ `dimethoxy,12`     <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,...
## $ `dimethoxy,33`     <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,...
## $ dimethylanil       <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,...
## $ dimethylb          <dbl> NA, 2.624000e-08, NA, NA, 3.175000e-08, 1.9...
## $ `dinitroph,24`     <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, 0.0...
## $ `dinitrtol,24`     <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,...
## $ `dioctyl phth`     <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, 0.0...
## $ `dioctylphth,n`    <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,...
## $ dioxane            <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,...
## $ epiclhydrin        <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,...
## $ `epoxybut,12`      <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,...
## $ etglmosebuet       <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,...
## $ `eth acrylate`     <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,...
## $ ethglymoetac       <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,...
## $ ethylbenzene       <dbl> NA, NA, NA, NA, 4.000000e-02, NA, NA, NA, N...
## $ `ethylene gly`     <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,...
## $ `ethylene imi`     <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,...
## $ `ethylene oxi`     <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,...
## $ `fc-72`            <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,...
## $ `fc-770`           <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,...
## $ fluoranthene       <dbl> NA, 4.920000e-09, NA, NA, 5.954000e-09, 3.6...
## $ fluorene           <dbl> NA, 4.592000e-09, NA, NA, 5.557000e-09, 3.3...
## $ formaldehyde       <dbl> NA, 0.000123000, NA, NA, 0.000148800, 0.000...
## $ `glycol ethrs`     <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, 0.0124,...
## $ `galden det`       <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,...
## $ h2so4              <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, 2.4...
## $ hcl                <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, 25....
## $ `hexacl-1,3-c`     <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,...
## $ hexamethyl16       <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,...
## $ hexane             <dbl> NA, 0.00295200, NA, NA, 0.00357200, 0.02168...
## $ hexchloreth        <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,...
## $ `hexcl-13-but`     <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,...
## $ hexclbenzene       <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,...
## $ hexyethanol2       <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,...
## $ `hexyl carb`       <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,...
## $ hf                 <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,...
## $ `hfc-125`          <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,...
## $ `hfc-134a`         <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,...
## $ `hfc-143a`         <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,...
## $ `hfc-152a`         <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,...
## $ `hfc-227ea`        <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,...
## $ `hfc-23`           <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,...
## $ `hfc-41`           <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,...
## $ `hfe-449s1`        <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,...
## $ `hfe-569sf2`       <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,...
## $ `hfe-7500`         <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,...
## $ `hpcb,tot`         <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, 0.0...
## $ hpcdd1234678       <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, 0.0...
## $ hpcdf1234678       <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, 0.0...
## $ hpcdf1234789       <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, 0.0...
## $ `hxcb,tot`         <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, 0.0...
## $ `hxcdd,123478`     <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, 0.0...
## $ `hxcdd,123678`     <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, 0.0...
## $ `hxcdd,123789`     <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, 0.0...
## $ `hxcdf,123478`     <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, 0.0...
## $ `hxcdf,123678`     <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, 0.0...
## $ `hxcdf,123789`     <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, 0.0...
## $ `hxcdf,234678`     <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, 0.0...
## $ `hydrogen cya`     <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,...
## $ hydroquinone       <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,...
## $ `indn(123cdpy`     <dbl> NA, 2.952000e-09, NA, NA, 3.572000e-09, 2.1...
## $ isophorone         <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,...
## $ `k chromate`       <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,...
## $ `k cyanide`        <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,...
## $ `k dichrom`        <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,...
## $ `k ferrocyan`      <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,...
## $ lead               <dbl> NA, 8.200000e-07, NA, NA, 9.923000e-07, 6.0...
## $ `lead carb`        <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,...
## $ `lead chromat`     <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,...
## $ `lead phos`        <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,...
## $ `lead sulf`        <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,...
## $ `lead(ii)oxid`     <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,...
## $ `maleic anhyd`     <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,...
## $ `mangan nitr`      <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,...
## $ `mangan o2`        <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,...
## $ `mangan o3`        <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,...
## $ `mangan sulf`      <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,...
## $ `mangan tall`      <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,...
## $ manganese          <dbl> NA, 0.0000006232, NA, NA, 0.0000007541, 0.0...
## $ mercury            <dbl> NA, 1.378000e-09, NA, NA, 1.667000e-09, 1.0...
## $ `mercury,org`      <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,...
## $ `meten bis,44`     <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,...
## $ `meth eth ket`     <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, 0.0...
## $ `meth hydrazi`     <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,...
## $ `meth iodide`      <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,...
## $ `meth isobut`      <dbl> NA, NA, NA, NA, 0.0100000, NA, NA, NA, NA, ...
## $ `meth isocyan`     <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,...
## $ `meth methacr`     <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,...
## $ `meth napht,1`     <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,...
## $ `meth tert bu`     <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,...
## $ methane            <dbl> NA, 0.00378800, NA, NA, 0.00458400, 0.02810...
## $ methanol           <dbl> NA, NA, NA, NA, 0.04000000, NA, NA, NA, NA,...
## $ `methchrys,5`      <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,...
## $ `methene dian`     <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,...
## $ `methene(b)4-`     <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,...
## $ `methyl chlor`     <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, 0.0...
## $ methylanthr        <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,...
## $ methylchola3       <dbl> NA, 2.952000e-09, NA, NA, 3.572000e-09, 2.1...
## $ `methylene cl`     <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, 0.3...
## $ methylnapht2       <dbl> NA, 3.936000e-08, NA, NA, 4.763000e-08, 2.8...
## $ `monocb,2`         <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, 0.0...
## $ naphthalene        <dbl> NA, 0.0000010000, NA, NA, 0.0000012110, 0.0...
## $ nf3                <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,...
## $ `ni acet dihy`     <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,...
## $ `ni bromide`       <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,...
## $ `ni chloride`      <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,...
## $ `ni hydrox`        <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,...
## $ `ni nitrite`       <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,...
## $ `ni sulfamate`     <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,...
## $ `ni sulfate`       <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,...
## $ `ni(ii) oxide`     <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,...
## $ `ni(iii)oxide`     <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,...
## $ nickel             <dbl> NA, 3.444000e-06, NA, NA, 4.167000e-06, 2.5...
## $ `nickel refin`     <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,...
## $ `nitrbiphen,4`     <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,...
## $ nitrobenz          <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,...
## $ `nitrophenl,4`     <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, 0.0...
## $ `nitropropa,2`     <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,...
## $ nitrosodimet       <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,...
## $ nitrosomorph       <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,...
## $ `nitrous oxid`     <dbl> NA, 0.000378800, NA, NA, 0.000458400, 0.002...
## $ nox                <dbl> NA, 0.164000, NA, NA, 0.198500, 1.211292, 2...
## $ `ocdd,tot`         <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, 0.0...
## $ `ocdf,tot`         <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, 0.0...
## $ pah                <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,...
## $ `pah/pom`          <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,...
## $ `pcb,209`          <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, 0.0...
## $ pcbs               <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,...
## $ pcp                <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, 0.0...
## $ `pecb,tot`         <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, 0.0...
## $ `pecdd,12378`      <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, 0.0...
## $ `pecdf,12378`      <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, 0.0...
## $ `pecdf,23478`      <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, 0.0...
## $ pentclnitben       <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,...
## $ perc               <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, 1.0...
## $ perylene           <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, 0.0...
## $ pfc                <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,...
## $ `pfc-116`          <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,...
## $ `pfc-14`           <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,...
## $ `pfc-218`          <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,...
## $ `pfc-318`          <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,...
## $ `phen cello`       <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,...
## $ phenanthrene       <dbl> NA, 2.788000e-08, NA, NA, 3.374000e-08, 2.0...
## $ phenol             <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, 0.0...
## $ `phenylened,p`     <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,...
## $ phosphine          <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,...
## $ phosphorus         <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, 0.0...
## $ `phthalic anh`     <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,...
## $ pm                 <dbl> NA, 0.97255280, NA, NA, 3.01103200, 0.00628...
## $ `pm-con`           <dbl> NA, 0.00052480, NA, NA, 0.00063510, 0.00386...
## $ `pm-fil`           <dbl> NA, NA, NA, NA, NA, NA, NA, NA, 1.265100e-0...
## $ `pm10-fil`         <dbl> NA, 9.310080e-01, NA, NA, 3.010397e+00, 2.4...
## $ `pm10-pri`         <dbl> NA, 0.93153280, NA, NA, 3.01103200, 0.00628...
## $ `pm25-fil`         <dbl> NA, 2.749114e-01, NA, NA, 2.498218e+00, 1.3...
## $ `prop im, 12`      <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,...
## $ propionaldeh       <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, 0.0...
## $ `propyl cello`     <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,...
## $ propylene          <dbl> NA, NA, NA, NA, NA, NA, NA, NA, 0.00004396,...
## $ `prplene dich`     <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, 0.0...
## $ `prplene oxid`     <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,...
## $ pyrene             <dbl> NA, 8.200000e-09, NA, NA, 9.923000e-09, 6.0...
## $ quinone            <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,...
## $ `selen disulf`     <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,...
## $ `selen oxide`      <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,...
## $ selenium           <dbl> NA, 3.936000e-08, NA, NA, 4.763000e-08, 2.8...
## $ `silv cyanide`     <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,...
## $ so2                <dbl> NA, 0.00098400, NA, NA, 0.00119100, 0.00723...
## $ `sodium chro6`     <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,...
## $ `sodium cyan`      <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,...
## $ `sodium dichr`     <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,...
## $ `stron chrom`      <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,...
## $ styrene            <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, 1.2...
## $ `sulf hxfluor`     <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,...
## $ `tcb,tot`          <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, 0.0...
## $ `tcdd,2378`        <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, 2.2...
## $ `tcdf,2378`        <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, 0.0...
## $ `tce,111`          <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, 0.0...
## $ `tetclet,1122`     <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,...
## $ `teteth lead`      <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,...
## $ `titan tetcl`      <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,...
## $ toluene            <dbl> NA, 0.000005576, NA, NA, 0.000006747, 0.000...
## $ toluene24dii       <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,...
## $ `toluidine,o-`     <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,...
## $ `tricb,244`        <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, 0.0...
## $ trichlorethy       <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, 4.1...
## $ `triclbnz,124`     <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, 0.8...
## $ `tricleth,112`     <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, 2.3...
## $ `triclphn,245`     <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,...
## $ `triclphn,246`     <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,...
## $ triethamine        <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,...
## $ trifluralin        <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,...
## $ `trime-pentan`     <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,...
## $ trimethbe124       <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,...
## $ trimethbe135       <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,...
## $ vanadium           <dbl> NA, 0.000003772, NA, NA, 0.000004564, 0.000...
## $ `vinlidene cl`     <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,...
## $ `vinyl acetat`     <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,...
## $ `vinyl bromid`     <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,...
## $ `vinyl chlor`      <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, 0.0...
## $ voc                <dbl> NA, 0.0090200, NA, NA, 1.4509100, 0.0667340...
## $ `xylene,m`         <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,...
## $ `xylene,o`         <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,...
## $ `xylene,p`         <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,...
## $ `xylenes iso`      <dbl> NA, NA, NA, NA, 0.2000000000, NA, NA, NA, 0...
## $ zinc               <dbl> NA, 0.0000475600, NA, NA, 0.0000575500, 0.0...
## $ `zinc cyanide`     <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,...
## $ `zn chromate`      <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,...
## $ `zn chromite`      <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,...
## $ `zn k chrom`       <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,...
## $ `solv in coat`     <dbl> 2.00, NA, 241.00, 1769.00, NA, NA, NA, 362....


Look out messy data, R is coming for you.


Return to Day3 AM