SCM

SCM Repository

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

Diff of /pkg/R/source.R

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

revision 866, Sun Nov 2 09:11:00 2008 UTC revision 869, Sat Nov 8 09:16:37 2008 UTC
# Line 11  Line 11 
11                          Position = "numeric",                          Position = "numeric",
12                          DefaultReader = "function",                          DefaultReader = "function",
13                          Encoding = "character",                          Encoding = "character",
14                            Length = "numeric",
15                          "VIRTUAL"))                          "VIRTUAL"))
16    
17  # A vector where each component is interpreted as document  # A vector where each component is interpreted as document
# Line 50  Line 51 
51            signature(object = "vector"),            signature(object = "vector"),
52            function(object, encoding = "UTF-8") {            function(object, encoding = "UTF-8") {
53                new("VectorSource", LoDSupport = FALSE, Content = object, Position = 0,                new("VectorSource", LoDSupport = FALSE, Content = object, Position = 0,
54                    DefaultReader = readPlain, Encoding = encoding)                    DefaultReader = readPlain, Encoding = encoding, Length = length(object))
55            })            })
56    
57  setGeneric("DirSource", function(directory, encoding = "UTF-8", recursive = FALSE) standardGeneric("DirSource"))  setGeneric("DirSource", function(directory, encoding = "UTF-8", recursive = FALSE) standardGeneric("DirSource"))
# Line 61  Line 62 
62                isdir <- sapply(d, file.info)["isdir",]                isdir <- sapply(d, file.info)["isdir",]
63                files <- d[isdir == FALSE]                files <- d[isdir == FALSE]
64                new("DirSource", LoDSupport = TRUE, FileList = files,                new("DirSource", LoDSupport = TRUE, FileList = files,
65                    Position = 0, DefaultReader = readPlain, Encoding = encoding)                    Position = 0, DefaultReader = readPlain, Encoding = encoding, Length = length(files))
66            })            })
67    
68  setGeneric("CSVSource", function(object, encoding = "UTF-8") standardGeneric("CSVSource"))  setGeneric("CSVSource", function(object, encoding = "UTF-8") standardGeneric("CSVSource"))
# Line 72  Line 73 
73                con <- eval(object)                con <- eval(object)
74                content <- apply(read.csv(con), 1, paste, collapse = " ")                content <- apply(read.csv(con), 1, paste, collapse = " ")
75                new("CSVSource", LoDSupport = FALSE, URI = object,                new("CSVSource", LoDSupport = FALSE, URI = object,
76                    Content = content, Position = 0, DefaultReader = readPlain, Encoding = encoding)                    Content = content, Position = 0, DefaultReader = readPlain,
77                      Encoding = encoding, Length = length(content))
78            })            })
79  setMethod("CSVSource",  setMethod("CSVSource",
80            signature(object = "ANY"),            signature(object = "ANY"),
# Line 81  Line 83 
83                con <- eval(object)                con <- eval(object)
84                content <- apply(read.csv(con), 1, paste, collapse = " ")                content <- apply(read.csv(con), 1, paste, collapse = " ")
85                new("CSVSource", LoDSupport = FALSE, URI = object,                new("CSVSource", LoDSupport = FALSE, URI = object,
86                    Content = content, Position = 0, DefaultReader = readPlain, Encoding = encoding)                    Content = content, Position = 0, DefaultReader = readPlain,
87                      Encoding = encoding, Length = length(content))
88            })            })
89    
90  setGeneric("ReutersSource", function(object, encoding = "UTF-8") standardGeneric("ReutersSource"))  setGeneric("ReutersSource", function(object, encoding = "UTF-8") standardGeneric("ReutersSource"))
# Line 96  Line 99 
99                content <- xmlRoot(tree)$children                content <- xmlRoot(tree)$children
100    
101                new("ReutersSource", LoDSupport = FALSE, URI = object,                new("ReutersSource", LoDSupport = FALSE, URI = object,
102                    Content = content, Position = 0, DefaultReader = readReut21578XML, Encoding = encoding)                    Content = content, Position = 0, DefaultReader = readReut21578XML,
103                      Encoding = encoding, Length = length(content))
104            })            })
105  setMethod("ReutersSource",  setMethod("ReutersSource",
106            signature(object = "ANY"),            signature(object = "ANY"),
# Line 109  Line 113 
113                content <- xmlRoot(tree)$children                content <- xmlRoot(tree)$children
114    
115                new("ReutersSource", LoDSupport = FALSE, URI = object,                new("ReutersSource", LoDSupport = FALSE, URI = object,
116                    Content = content, Position = 0, DefaultReader = readReut21578XML, Encoding = encoding)                    Content = content, Position = 0, DefaultReader = readReut21578XML,
117                      Encoding = encoding, Length = length(content))
118            })            })
119    
120  setGeneric("GmaneSource", function(object, encoding = "UTF-8") standardGeneric("GmaneSource"))  setGeneric("GmaneSource", function(object, encoding = "UTF-8") standardGeneric("GmaneSource"))
# Line 125  Line 130 
130                content <- content[names(content) == "item"]                content <- content[names(content) == "item"]
131    
132                new("GmaneSource", LoDSupport = FALSE, URI = object,                new("GmaneSource", LoDSupport = FALSE, URI = object,
133                    Content = content, Position = 0, DefaultReader = readGmane, Encoding = encoding)                    Content = content, Position = 0, DefaultReader = readGmane,
134                      Encoding = encoding, Length = length(content))
135            })            })
136  setMethod("GmaneSource",  setMethod("GmaneSource",
137            signature(object = "ANY"),            signature(object = "ANY"),
# Line 139  Line 145 
145                content <- content[names(content) == "item"]                content <- content[names(content) == "item"]
146    
147                new("GmaneSource", LoDSupport = FALSE, URI = object,                new("GmaneSource", LoDSupport = FALSE, URI = object,
148                    Content = content, Position = 0, DefaultReader = readGmane, Encoding = encoding)                    Content = content, Position = 0, DefaultReader = readGmane,
149                      Encoding = encoding, Length = length(content))
150            })            })
151    
152  setGeneric("stepNext", function(object) standardGeneric("stepNext"))  setGeneric("stepNext", function(object) standardGeneric("stepNext"))

Legend:
Removed from v.866  
changed lines
  Added in v.869

R-Forge@R-project.org
ViewVC Help
Powered by ViewVC 1.0.0  
Thanks to:
Vienna University of Economics and Business University of Wisconsin - Madison Powered By FusionForge