Projects

This space will contain references to work that I am allowed to share.

matlab_mongodb

On GitHub I shared a set of MATLAB functions that show how to use MongoDB databases in the MATLAB environment with the MongoDB java driver.

The examples show how to fill a collection (a broader concept than a table in the relational data model) from an Excel sheet and how to do queries and MapReduce operations on such a collection.

knitr_matlab_stata

Also on GitHub I shared an extension to knitr. knitr is an application in R that enables integration of R code into e.g. LaTeX. Engines for some other languages (e.g. Python) are available but those for MATLAB and Stata were lacking and therefore created by me.

The repository contains the code for these engines and gives an elaborate example that shows how to work with knitr in general and how to use the engines in particular. Included are the input file in rnw-format and other inputs together with the resulting pdf-file.

matlab_publish_latex

This repository is an extension for the MATLAB publish functionality for LaTeX. It offers with its additional parameters the possibility

  • to specify the documentclass and layout (orientation and margins) of the document
  • to show MATLAB code and listings of m-files in a nice layout (thanks to the package matlab-prettifier by Julien Cretel)
  • to specify the hyperref options that determine the attributes of the final pdf-file
  • to specify how the beginning of the document looks like: should we include title, author, contents, list of figures or list of listings?

and to insert with simple additions to the m-file captions and references to plots.

Examples of the tex-files that are created and the resulting pdf-files are included.

matlab_wordserver

This repository contains a MATLAB class that can be used to create and update Microsoft Word documents. It is an extension of wordreport by Laurent Vaylet with some extra functionality:

  • the code is converted to a MATLAB class
  • tables and MATLAB figures can be exported to the word document with captions and references.
  • headers and footers can be included (with page numbering if that is needed)
  • the functions (methods) can be called very flexibly with arguments such as structures, cell arrays and name-value pairs
  • all wd constants (that are used) are included in a function with a translate routine so that the functions can be easily adapted.

An extended example is also included in the repository with the document that it creates

rmd_pdf_examples

This GitHub repository shows how to create pdf-files with the aid of RMarkdown. RMarkdown code makes use of knitr to execute chunks of R-code and combine those with a layout. The specification of the layout is much easier with RMarkdown (format rmd) than with LaTeX (format rnw).

The repository contains a number of examples. In the simplest one no use of LaTeX is made and that file can, with almost no changes, as easily be converted to html or docx format as to the pdf format. In the examples that make more use of LaTeX this is no longer the case but the functionality increases a lot (and is still easier to write than LaTeX) : other page layouts, colors, references and captions to figures and tables and bibliographies become possible.
An example of the output in html format can be found on iris_data_set_vm1.html. NB this page is created by software and makes use of javascript (in contrast with other pages of the website) and is not fully integrated in the website.

misc_hoqc

This GitHub repository contains items mainly related to geographical information. Further experiments will be included when they could be of interest to others. For the moment the items are:

  • In postcode.pdf I show how to request coordinates for an address (e.g. a postal code) with the aid of the Google Maps API.
  • spatial1.pdf shows how you can produce a map with R. The example let you see how Amstelveen (the place in the Netherlands where I live) is located with respect to its neighbours.
  • spatial2.pdf shows how information by the Dutch Cadastre, Land Registry and Mapping Agency about e.g. roads, buildings and water can be converted in precise maps where the programmer decides which elements to include and these elements are presented. As exemple again Amstelveen but now also Schiphol.
  • odata_cbs.pdf en odata_cbs_plot.pdf describe how to read data from the CBS (Statistics Netherlands, also known as the Dutch Central Bureau of Statistics) with the OData Protocol. By merging the data with CBS map information it can be presented in the form of a map.
  • debug1.pdf expands on an idea of John Mount that facilitates debugging of a function by saving the arguments at the time that it fails in an RDS file.
  • tedcsv.pdf shows how to read the csv version of the TED database that contains records about European public procurement. It is a large file with embedded separators and sometimes a missing last field, such that read.csv c.s. can't be used right away. Selected data is copied to a data.frame and from there to a Mongodb database. Examples of JSON queries on the database are included.
  • hoqc_LOG.m is a MATLAB class that enables logging of messages to the screen or a log file. Also available is a PDF demo file demo_hoqc_LOG.pdf that describes examples of use. The PDF was created from demo_hoqc_LOG.m with publish_demo_hoqc_LOG.m and matlab_publish_latex and thes necessary files are included.

R package odataR

In misc_hoqc it was shown how CBS data could be retrieved with the OData protocol. The R package odataR contains the code that was used. After installation of the package one line of R code suffices to convert a CBS table (optionally with selected rows and columns) to a data.frame. (This package is based on JSON. An older version based on XML can be found in R package odataR_old ) Also included is a pdf document that describes how a CBS document can be read into the MATLAB environment.