[R-sig-Geo] metadata

Roger Bivand Roger.Bivand at nhh.no
Mon Nov 9 16:23:36 CET 2009

On Mon, 9 Nov 2009, Blair Christian wrote:

> Hi All,
> I have a couple of comments here.  I'm working on some S4 classes for
> spatiotemporal data, basically extending Spatial, and I would like to
> include some metadata sooner or later.  I wrote some functions to get data
> off of webpages (like spatiotemporal ozone data from the EPA's air
> explorer), and I wanted to somehow encode this origin of the data into the
> object, so I thought a metadata object would be one way to do this.
> My very first go was something like this:
> setClass("stMetadata",
>         representation(title="character",
>                        url="character",
>                        creator="character",
>                        contact="character",
>                        description="character"
>                        ))
> Other things that I think ought to be in there are units of observations (eg
> ozone in ppm), units of spatial data (eg northing/easting, lat/long,
> Dorsey?),  temporal periodicity (eg daily, weekly, hourly, etc), and perhaps
> something about data range (is this a subset of a larger set? what are the
> temporal/spatial bounds, etc).
> Anyhow, those are some of the thoughts I have.  Of course, it's much easier
> to do this when you are using scripts to create data sets than to try to
> convince a hurried user to fill out yet another form when all they want to
> do is "one simple thing"....
> Thoughts?

In fact, comment() is pretty robust, but only accepts character vectors, 
nothing else. Using write.dcf() and read.dcf, one can get from:

com0 <- list(title="mytitle", url="myurl")
com1 <- capture.output(write.dcf(com0))
comment(meuse) <- com1
com2 <- as.list(data.frame(read.dcf(textConnection(comment(meuse))),
all.equal(com0, com2)

com3 <- as.list(data.frame(read.dcf(textConnection(comment(meuse[1:5,
   1:3]))), stringsAsFactors=FALSE))
all.equal(com0, com3)

and back out again. comment and comment<- are not methods, though, so a 
wrapper setup might be needed. I don't think that S4 classes can be packed 
into the comment easily.


> Blair
> 	[[alternative HTML version deleted]]
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo at stat.math.ethz.ch
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo

Roger Bivand
Economic Geography Section, Department of Economics, Norwegian School of
Economics and Business Administration, Helleveien 30, N-5045 Bergen,
Norway. voice: +47 55 95 93 55; fax +47 55 95 95 43
e-mail: Roger.Bivand at nhh.no

More information about the R-sig-Geo mailing list