Skip to content

Commit

Permalink
fix spp-common mismatch in after explode0
Browse files Browse the repository at this point in the history
just switched all factors to characters; not sure why this was causing the problem. Debugging showed that each region was being properly "exploded", so the problem was when data.table was recombining the output of explod0 from each region
  • Loading branch information
rBatt committed Jan 13, 2017
1 parent 517e2d5 commit f523f31
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion complete_r_script.R
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
# 3) Manually change the WORKING_DIRECTORY variable (line 27) to the directory with your data and run the script.

# RDB quality of life enhancer "~/Documents/School&Work/pinskyPost/OceanAdapt/data_download/Data_Vis_2015_09_04"
# setwd("/Users/Battrd/Documents/School&Work/pinskyPost/OceanAdapt/data_updates/Data_Updated")
# setwd("/Users/Battrd/Documents/School&Work/pinskyPost/OceanAdapt/data_updates/")


### File Structure
Expand Down Expand Up @@ -1287,6 +1287,8 @@ print_status('>Species data complete.')
# ===========
# = Add 0's =
# ===========
td_factorColumns <- sapply(trimmed_dat, is.factor)
trimmed_dat[,td_factorColumns] <- lapply(trimmed_dat[,td_factorColumns], as.character)
dat.exploded <- as.data.table(trimmed_dat)[,explode0(.SD), by="region"]
# write.csv(dat.exploded, file.path(WORKING_DIRECTORY, "..", "..", "dat.exploded.csv")) # this will be ~600MB

Expand Down

0 comments on commit f523f31

Please sign in to comment.