212 |
} |
} |
213 |
}) |
}) |
214 |
|
|
215 |
setGeneric("transformTextDocCol", function(object, FUN, ...) standardGeneric("transformTextDocCol")) |
setGeneric("tm_transform", function(object, FUN, ...) standardGeneric("tm_transform")) |
216 |
setMethod("transformTextDocCol", |
setMethod("tm_transform", |
217 |
c("TextDocCol"), |
c("TextDocCol"), |
218 |
function(object, FUN, ...) { |
function(object, FUN, ...) { |
219 |
lapply(object, FUN, ...) |
lapply(object, FUN, ...) |
262 |
return (object) |
return (object) |
263 |
}) |
}) |
264 |
|
|
265 |
setGeneric("filterTextDocCol", function(object, FUN, ...) standardGeneric("filterTextDocCol")) |
setGeneric("tm_filter", function(object, FUN, ...) standardGeneric("tm_filter")) |
266 |
setMethod("filterTextDocCol", |
setMethod("tm_filter", |
267 |
c("TextDocCol"), |
c("TextDocCol"), |
268 |
function(object, FUN, ...) { |
function(object, FUN, ...) { |
269 |
sapply(object, FUN, ...) |
sapply(object, FUN, ...) |
345 |
return(x) |
return(x) |
346 |
return(as(c(as(x, "list"), ...), "TextDocCol")) |
return(as(c(as(x, "list"), ...), "TextDocCol")) |
347 |
}) |
}) |
348 |
|
|
349 |
|
setMethod("length", |
350 |
|
signature(x = "TextDocCol"), |
351 |
|
function(x){ |
352 |
|
return(length(as(x, "list"))) |
353 |
|
}) |
354 |
|
|
355 |
|
setMethod("show", |
356 |
|
signature(object = "TextDocCol"), |
357 |
|
function(object){ |
358 |
|
cat("A text document collection with", length(object), "text document") |
359 |
|
if (length(object) == 1) |
360 |
|
cat("\n") |
361 |
|
else |
362 |
|
cat("s\n") |
363 |
|
}) |
364 |
|
|
365 |
|
setMethod("summary", |
366 |
|
signature(object = "TextDocCol"), |
367 |
|
function(object){ |
368 |
|
show(object) |
369 |
|
if (length(GlobalMetaData(object)) > 0) { |
370 |
|
cat("\nThe global metadata consists of", length(GlobalMetaData(object)), "tag-value pair") |
371 |
|
if (length(GlobalMetaData(object)) == 1) |
372 |
|
cat(".\n") |
373 |
|
else |
374 |
|
cat("s.\n") |
375 |
|
cat("Available tags are:\n") |
376 |
|
cat(names(GlobalMetaData(object)), "\n") |
377 |
|
} |
378 |
|
}) |