SCM

SCM Repository

[tm] Diff of /pkg/R/textdoccol.R
ViewVC logotype

Diff of /pkg/R/textdoccol.R

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 73, Tue Nov 21 15:52:39 2006 UTC revision 74, Tue Nov 21 20:04:17 2006 UTC
# Line 505  Line 505 
505      for (i in 1:length(object)) {      for (i in 1:length(object)) {
506          l.meta <- c(l.meta, list(local.meta[[i]][local.used.meta[[i]]]))          l.meta <- c(l.meta, list(local.meta[[i]][local.used.meta[[i]]]))
507      }      }
508        # Load local meta data from text documents into data frame
509        for (i in 1:length(l.meta)) {
510            l.meta[[i]] <- c(l.meta[[i]], list(author = Author(object[[i]])))
511            l.meta[[i]] <- c(l.meta[[i]], list(datetimestamp = DateTimeStamp(object[[i]])))
512            l.meta[[i]] <- c(l.meta[[i]], list(description = Description(object[[i]])))
513            l.meta[[i]] <- c(l.meta[[i]], list(identifier = ID(object[[i]])))
514            l.meta[[i]] <- c(l.meta[[i]], list(origin = Origin(object[[i]])))
515            l.meta[[i]] <- c(l.meta[[i]], list(heading = Heading(object[[i]])))
516        }
517      # TODO: Handle entries (\code{m} with length greater 1, i.e., lists)      # TODO: Handle entries (\code{m} with length greater 1, i.e., lists)
518      for (i in 1:length(l.meta)) {      for (i in 1:length(l.meta)) {
519          for (m in l.meta[[i]]) {          for (j in 1:length(l.meta[[i]])) {
520              if (!(names(l.meta[[i]]) %in% names(query.df))) {              m <- l.meta[[i]][[j]]
521                m.name <- names(l.meta[[i]][j])
522                if (!(m.name %in% names(query.df))) {
523                  before <- rep(NA, i - 1)                  before <- rep(NA, i - 1)
524                  after <- rep(NA, length(l.meta) - i)                  after <- rep(NA, length(l.meta) - i)
525                  insert <- c(before, m, after)                  insert <- c(before, m, after)
526                  query.df <- cbind(query.df, insert, stringsAsFactors = FALSE)                  query.df <- cbind(query.df, insert, stringsAsFactors = FALSE)
527                  names(query.df)[length(query.df)] <- names(l.meta[[i]])                  names(query.df)[length(query.df)] <- m.name
528              }              }
529              else {              else {
530                  if (is.null(m))                  if (is.null(m))
# Line 521  Line 532 
532                  #if (length(m) > 1)                  #if (length(m) > 1)
533                  #    query.df[i,names(l.meta[[i]])] <- list(m)                  #    query.df[i,names(l.meta[[i]])] <- list(m)
534                  #else                  #else
535                      query.df[i,names(l.meta[[i]])] <- m                      query.df[i,m.name] <- m
536              }              }
537          }          }
538      }      }
539      attach(query.df)      attach(query.df)
540      result <- rownames(query.df) == row.names(query.df[eval(parse(text = s)), ])      try(result <- rownames(query.df) %in% row.names(query.df[eval(parse(text = s)), ]))
541      detach(query.df)      detach(query.df)
542      return(result)      return(result)
543  }  }
# Line 594  Line 605 
605  #              return(object)  #              return(object)
606  #          })  #          })
607    
608    # TODO: Handle metadata in document slots
609  setGeneric("prescind_meta", function(object, meta) standardGeneric("prescind_meta"))  setGeneric("prescind_meta", function(object, meta) standardGeneric("prescind_meta"))
610  setMethod("prescind_meta",  setMethod("prescind_meta",
611            signature(object = "TextDocCol", meta = "character"),            signature(object = "TextDocCol", meta = "character"),

Legend:
Removed from v.73  
changed lines
  Added in v.74

root@r-forge.r-project.org
ViewVC Help
Powered by ViewVC 1.0.0  
Thanks to:
Vienna University of Economics and Business Powered By FusionForge