Convert environment tables to Darwin Core standard
Tool created to convert data table with environment variables to Darwin Core standard.
The conversion is necessary because the common layout used by researchers (wide format) does not match DwC layout.
This tool is just replicating the melt algorithm from package reshape2 from R language.
The R script below is how to achieve two columns required by the measurement and facts extension (measurementType, measurementValue).
# load data
# take extra care with encoding, most common for us are 'latin1' ou 'utf8' (please use utf8 if possible)
data = read.table('table.csv', header = T, sep = ',', dec = '.', encoding = 'utf8')
# load the library needed for melt function
library(reshape2)
# create a eventid column to maintain the original relationship of lines
data$eventid = 1:nrow(data)
# conversion from wide to long format
dataMelted = melt(data, id.vars = 'eventid')
Our experience shows users does not want to learn or install a new tool. R is pretty popular among ecologists but we needed to access a wide audience.
Teaching how to use R or pivot tables aren’t our focus and will take precious time we needed.
At time of writing this README our tool has only two steps, select a table and which columns to not “melt”.
We provide binaries on SiBBr courses but if you want to compile follow the steps described below.
$ go get -d github.com/sibbr/tableconverter
$ cd $GOPATH/src/github.com/sibbr/tableconverter
$ go build
Execute tableconverter, no output will be show if everything went ok.
David Dias: main developer
Eduardo Rudas: algorithm suggestions
Jurandir Júnior: main designer