18 Jul 2013
This is an initial implementation of a package that provides R users with high-level facilities to generate KML, the Keyhole Markup Language for display in, e.g., Google Earth. By high-level, we mean that the R user does not have to (but can) create the XML directly herself. Instead, there are high-level functions which take care of these lower-level details.
The package is intended to provide the basics and illustrate how others can build on this framework to add more functionality and allow other users to leverage more of the KML facilities. As such, the package is far from a complete interface to KML, but more a proof-of-concept and an encouragement for statisticians to explore this rich form of visualization. We will add to the package as time permits and we need to for our own use. We strongly encourage others to build on this, contribute code back or take over the package if they are intending to do much work in this area. Please chat with us via email to let us know about your plans so we can help and coordinate with others.
The main elements the package provides are
the high-level kml()
function,
and the slightly lower-level/more-specific
functions kmlPoints()
and kmlTime()
.
kmlPoints()
displays points on the earth.
kmlTime()
displays points but connects them with
lines and puts a time stamp on each.
These functions need to know the variables that correspond to longitude, latitude and time. One can change the names of the variables in the data set, or more conveniently and richly use a formula notation. The formula is something like
~ X + Y @ timeVariableThis is not comprehensively implemented yet in terms of allowing transformations of the variables within the formula, but we will do this in the future. This notation will also support an expression on the right hand side and conditioning and this can be used for various interesting effects.
There are more nuts-and-bolt functions for creating specific KML elements.
There are many ways this could be improved. Try some!