[R] merging corpora and metadata

Milan Bouchet-Valat nalimilan at club.fr
Fri Nov 18 11:31:00 CET 2011


Le jeudi 17 novembre 2011 à 21:34 -0500, R. Michael Weylandt a écrit :
> Hi Josh,
> 
> You're absolutely right. I suppose one could set up some sort of S3
> thing for Henri's problem:
> 
> c <- function(..., recursive = FALSE) UseMethod("c")
> c.default <- base::c
> c.corpus <- function(..., recursive = FALSE) {ans = c.default(...);
> attributes(ans) <- c(do.call(attributes, ...))}
> 
> But agreed, it seems deeply risky.
This method already exists in the tm package where the Corpus class
comes from. Henri-Paul, see ?c.Corpus.

Specifically, tot.corpus <- c(corpus.1, corpus.2, recursive=TRUE)
meta(tot.corpus)
works.

It looks weird that recursive=TRUE isn't the default, but the
documentation seems to imply that the merging of meta-data might produce
weird results, so that's probably why it's disabled by default. You may
want to get in touch with Ingo Feinerer about that.


Regards



More information about the R-help mailing list