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 885, Thu Jan 29 09:34:44 2009 UTC revision 886, Thu Jan 29 22:47:34 2009 UTC
# Line 83  Line 83 
83            function(object, encoding = "UTF-8")            function(object, encoding = "UTF-8")
84                new("URISource", LoDSupport = TRUE, URI = substitute(file(object, encoding = encoding)),                new("URISource", LoDSupport = TRUE, URI = substitute(file(object, encoding = encoding)),
85                    Position = 0, DefaultReader = readPlain, Encoding = encoding, Length = 1))                    Position = 0, DefaultReader = readPlain, Encoding = encoding, Length = 1))
86  setMethod("URISource", signature(object = "connection"),  setMethod("URISource", signature(object = "ANY"),
87            function(object, encoding = "UTF-8")            function(object, encoding = "UTF-8")
88                new("URISource", LoDSupport = TRUE, URI = match.call()$object,                new("URISource", LoDSupport = TRUE, URI = match.call()$object,
89                    Position = 0, DefaultReader = readPlain, Encoding = encoding, Length = 1))                    Position = 0, DefaultReader = readPlain, Encoding = encoding, Length = 1))
# Line 98  Line 98 
98                    Encoding = encoding, Length = length(content))                    Encoding = encoding, Length = length(content))
99            })            })
100  setMethod("CSVSource",  setMethod("CSVSource",
101            signature(object = "connection"),            signature(object = "ANY"),
102            function(object, encoding = "UTF-8") {            function(object, encoding = "UTF-8") {
103                content <- apply(read.csv(object), 1, paste, collapse = " ")                content <- apply(read.csv(object), 1, paste, collapse = " ")
104                new("CSVSource", LoDSupport = FALSE, URI = match.call()$object,                new("CSVSource", LoDSupport = FALSE, URI = match.call()$object,
# Line 110  Line 110 
110  setMethod("ReutersSource",  setMethod("ReutersSource",
111            signature(object = "character"),            signature(object = "character"),
112            function(object, encoding = "UTF-8") {            function(object, encoding = "UTF-8") {
113                  require("XML")
114    
115                corpus <- paste(readLines(object, encoding = encoding), "\n", collapse = "")                corpus <- paste(readLines(object, encoding = encoding), "\n", collapse = "")
116                tree <- xmlTreeParse(corpus, asText = TRUE)                tree <- xmlTreeParse(corpus, asText = TRUE)
117                content <- xmlRoot(tree)$children                content <- xmlRoot(tree)$children
# Line 119  Line 121 
121                    Encoding = encoding, Length = length(content))                    Encoding = encoding, Length = length(content))
122            })            })
123  setMethod("ReutersSource",  setMethod("ReutersSource",
124            signature(object = "connection"),            signature(object = "ANY"),
125            function(object, encoding = "UTF-8") {            function(object, encoding = "UTF-8") {
126                  require("XML")
127    
128                corpus <- paste(readLines(object), "\n", collapse = "")                corpus <- paste(readLines(object), "\n", collapse = "")
129                tree <- xmlTreeParse(corpus, asText = TRUE)                tree <- xmlTreeParse(corpus, asText = TRUE)
130                content <- xmlRoot(tree)$children                content <- xmlRoot(tree)$children
# Line 134  Line 138 
138  setMethod("GmaneSource",  setMethod("GmaneSource",
139            signature(object = "character"),            signature(object = "character"),
140            function(object, encoding = "UTF-8") {            function(object, encoding = "UTF-8") {
141                  require("XML")
142    
143                corpus <- paste(readLines(object, encoding = encoding), "\n", collapse = "")                corpus <- paste(readLines(object, encoding = encoding), "\n", collapse = "")
144                tree <- xmlTreeParse(corpus, asText = TRUE)                tree <- xmlTreeParse(corpus, asText = TRUE)
145                content <- xmlRoot(tree)$children                content <- xmlRoot(tree)$children
# Line 144  Line 150 
150                    Encoding = encoding, Length = length(content))                    Encoding = encoding, Length = length(content))
151            })            })
152  setMethod("GmaneSource",  setMethod("GmaneSource",
153            signature(object = "connection"),            signature(object = "ANY"),
154            function(object, encoding = "UTF-8") {            function(object, encoding = "UTF-8") {
155                  require("XML")
156    
157                corpus <- paste(readLines(object), "\n", collapse = "")                corpus <- paste(readLines(object), "\n", collapse = "")
158                tree <- xmlTreeParse(corpus, asText = TRUE)                tree <- xmlTreeParse(corpus, asText = TRUE)
159                content <- xmlRoot(tree)$children                content <- xmlRoot(tree)$children
# Line 187  Line 195 
195  setMethod("getElem",  setMethod("getElem",
196            signature(object = "ReutersSource"),            signature(object = "ReutersSource"),
197            function(object) {            function(object) {
198                  require("XML")
199    
200                # Construct a character representation from the XMLNode                # Construct a character representation from the XMLNode
201                virtual.file <- character(0)                virtual.file <- character(0)
202                con <- textConnection("virtual.file", "w", local = TRUE)                con <- textConnection("virtual.file", "w", local = TRUE)
# Line 198  Line 208 
208  setMethod("getElem",  setMethod("getElem",
209            signature(object = "GmaneSource"),            signature(object = "GmaneSource"),
210            function(object) {            function(object) {
211                  require("XML")
212    
213                # Construct a character representation from the XMLNode                # Construct a character representation from the XMLNode
214                virtual.file <- character(0)                virtual.file <- character(0)
215                con <- textConnection("virtual.file", "w", local = TRUE)                con <- textConnection("virtual.file", "w", local = TRUE)

Legend:
Removed from v.885  
changed lines
  Added in v.886

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