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.
- Install and configure an environment for Go. Follow this guide.
- If you did everything right type:
$ go get -d github.com/sibbr/tableconverter
$ cd $GOPATH/src/github.com/sibbr/tableconverter
$ go build
- Now you should have a binary called tableconverter[.exe]
Execute tableconverter, no output will be show if everything went ok.
- Open your browser at http://localhost:8080
- Select the table you want to convert (need to be in csv and UTF-8)
- Select the field separator
- Press Send
- Select which columns you want to remain fixed (usually terms of DwC)
- Press Convert and download the new file
David Dias: main developer
Eduardo Rudas: algorithm suggestions
Jurandir Júnior: main designer