[R] Error using the package tm.plugin.webmining "object '.Source' not found"

Milan Bouchet-Valat nalimilan at club.fr
Mon Apr 14 21:13:55 CEST 2014


Le dimanche 13 avril 2014 à 20:50 -0400, brian arb a écrit :
> I recently had an issue while trying to use the package tm.plugin.webmining.
> 
> I was able to get a hack to work for me and I wanted to share the diff and
> bring this to someones attention.
> Or what is the proper way to report a bug for third party code?
You should contact the maintainer of the package. Apparently this
package was using tm's internal function .Source(), which was renamed
into Source() in tm 0.5-10.

You can likely work around this by defining this function first:
.Source <- function(defaultreader, encoding, length, lodsupport, names,
position, vectorized, class = NULL) {
    if (vectorized && (length <= 0))
        stop("vectorized sources must have positive length")

    if (!is.null(names) && (length != length(names)))
        stop("incorrect number of element names")

    structure(list(DefaultReader = defaultreader, Encoding = encoding,
Length = length,
                   LoDSupport = lodsupport, Names = names, Position =
position, Vectorized = vectorized),
              class = unique(c(class, "Source")))
}

If this doesn't work, you can install an older version of tm
(see http://cran.r-project.org/src/contrib/Archive/tm/).

Regards

> Cheers
> 
> ##### error I get when using the plugin. #####
> Error in get(name, envir = asNamespace(pkg), inherits = FALSE) :
>   object '.Source' not found
> 
> ##### My Hack Diff #####
> diff ~/Downloads/tm.plugin.webmining/R/source.R \
> > tm.plugin.webmining/R/source.R
> 35c35,36
> <  s <- tm:::.Source(NULL, encoding, length(content_parsed), FALSE, NULL,
> 0, vectorized, class = class)
> ---
> >  s <- tm:::Source(defaultReader=readPlain, encoding=encoding,
> length=length(content_parsed),
> >   names=NA_character_, position=0, vectorized=vectorized, class=class)
> <
> 569,570c570,572
> <  s <- tm:::.Source(NULL, encoding = "UTF-8", length(content), FALSE,
> NULL, 0, vectorized = FALSE, class = "WebXMLSource")
> <  s$Content <- content
> ---
> >  s <- tm:::Source(defaultReader=readPlain, encoding="UTF-8",
> length=length(content),
> >   names=NA_character_, position=0, vectorized=FALSE, class="WebXMLSource")
> 
> 
> Using R version 3.1.0 beta (2014-03-28 r65330) -- "Spring Dance"
> 
> ##### output from console ######
> 
> > library(quantmod)
> Loading required package: Defaults
> Loading required package: xts
> Loading required package: zoo
> 
> Attaching package: 'zoo'
> 
> The following objects are masked from 'package:base':
> 
>     as.Date, as.Date.numeric
> 
> Loading required package: TTR
> Version 0.4-0 included new data defaults. See ?getSymbols.
> > library(rJava)
> > library(boilerpipeR)
> > library(namespace)
> > library(tm.plugin.webmining)
> Loading required package: tm
> Loading required package: RCurl
> Loading required package: bitops
> 
> Attaching package: 'RCurl'
> 
> The following object is masked from 'package:rJava':
> 
>     clone
> 
> Loading required package: XML
> 
> Attaching package: 'tm.plugin.webmining'
> 
> The following object is masked from 'package:RCurl':
> 
>     getURL
> 
> The following object is masked from 'package:base':
> 
>     parse
> 
> >
> > corpus <- WebCorpus(GoogleFinanceSource("NASDAQ:MSFT"))
> Error in get(name, envir = asNamespace(pkg), inherits = FALSE) :
>   object '.Source' not found
> 
> 	[[alternative HTML version deleted]]
> 
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.




More information about the R-help mailing list