I am using stemDocument for stemming text document using tm package in R. Example code:
data("crude")
crude[[1]]
stemDocument(crude[[1]])
I get an error message:
Error in loadNamespace(name) : there is no package called ‘Snowball’
I have installed SnowballC package and unable to find Snowball package. Below is my sessionInfo():
R version 2.15.3 (2013-03-01)
Platform: x86_64-apple-darwin9.8.0/x86_64 (64-bit)
locale:
[1] en_CA.UTF-8/en_CA.UTF-8/en_CA.UTF-8/C/en_CA.UTF-8/en_CA.UTF-8
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] SnowballC_0.5 tm_0.5-8.3
loaded via a namespace (and not attached):
[1] slam_0.1-31 tools_2.15.3
Does it require any other package or Snowball?
Just try to install the SnowballC packages to R
install.packages("SnowballC")
library(SnowballC)
It should work.
You have an older version of pkg:tm. The current version of tm has a DESCRIPTION file that lists SnowballC as a "Suggests". Older versions suggested Snowball.
Package: tm
Title: Text Mining Package
Version: 0.5-10
Date: 2014-01-07
Authors#R: c(person("Ingo", "Feinerer", role = c("aut", "cre"),
email = "feinerer#logic.at"),
person("Kurt", "Hornik", role = "aut"),
person("Artifex Software, Inc.", role = c("ctb", "cph"),
comment = "pdf_info.ps taken from GPL Ghostscript"))
Depends: R (>= 2.14.0)
Imports: parallel, slam (>= 0.1-31)
Suggests: filehash, proxy, Rcampdf, Rgraphviz, Rpoppler, SnowballC, XML
This is the message you currently get from CRAN:
Package ‘Snowball’ was removed from the CRAN repository.
Formerly available versions can be obtained from the archive.
Archived on 2014-03-16 at the request of the maintainer.
You should update to the current version of tm. Try this:
update.packages("tm", checkBuilt = TRUE)
Related
TL;DR
Unable to install any package from GitHub, System Error 267
I've newly setup R (v4.1), Rstudio and just installed devtools.
I also additionally installed Rtools40 and added it to my path (global environment)
Rtools seems to work properly as validated with: Sys.which("make") & maketools::rtools_find() (output below)
Problem
I am unable to install any package from GitHub, e.g. rstudio/gt. The error is nearly identical for any GitHub Package, allways stating system error 267
devtools::install_github("rstudio/gt")
Downloading GitHub repo rstudio/gt#HEAD
Error: Failed to install 'gt' from GitHub:
create process 'C:/PROGRA~1/R/R-41~1.0/bin/x64/Rcmd.exe' (system error 267, Der Verzeichnisname ist ungültig.
) #win/processx.c:1040 (processx_exec
Update
As suggested I reinstalled R 4.1.0 to the most simple folde possible C:/R/
The error ist still the same despite now lacking tildes ~
devtools::install_github("rstudio/gt")
Downloading GitHub repo rstudio/gt#HEAD
Error: Failed to install 'gt' from GitHub:
create process 'C:/R/bin/x64/Rcmd.exe' (system error 267, Der Verzeichnisname ist ungültig.
) #win/processx.c:1040 (processx_exec)
Update 2:
Changed the .libPaths to a folder without any special characters
.libPaths( c( "D:/tmp" , .libPaths() ) )
.libPaths()
[1] "D:/tmp" "C:/Users/Björn/Documents/R/win-library/4.1"
[3] "C:/R/library"
Error is still the same
Update 3:
I updated some packages, and checked the version of packageVersion('processx')= 3.5.2
install.packages("testthat")
install.packages("pkgload")
install.packages("devtools")
install.packages("remote")
Content of Sys.getenv
Sys.getenv('Path')
[1] "C:\\rtools40\\usr\\bin;C:\\R\\bin\\x64;C:\\rtools40\\usr\\bin;C:\\rtools40\\mingw64\\bin;
Diagnostics
Session Info
> sessionInfo()
R version 4.1.0 (2021-05-18)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 19042)
Matrix products: default
locale:
[1] LC_COLLATE=German_Germany.1252 LC_CTYPE=German_Germany.1252 LC_MONETARY=German_Germany.1252
[4] LC_NUMERIC=C LC_TIME=German_Germany.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
Rtools successful installed / setup
Sys.which("make")
make
"C:\\rtools40\\usr\\bin\\make.exe"
maketools::rtools_find()
$version
[1] ‘4.0’
$compiler
[1] "gcc 8.3.0"
$api
[1] ‘8’
$PATH
[1] "C:\\rtools40\\usr\\bin"
$BINPREF
[1] "C:/rtools40/mingw$(WIN)/bin/"
$available
[1] TRUE
$compatible
[1] TRUE
The standalone mode of the remotes package solved the issue for me,
as suggested by the maintainer of processx (Gábor Csárdi) here
devtools::install_github() only calls remotes::install_github().
However, for the remotes, there is the option to be exectued in standalone mode
Source: Cran
Standalone mode
remotes will use the curl, git2r and pkgbuild packages if they are
installed to provide faster implementations for some aspects of the
install process. However if you are using remotes to install or update
these packages (or their reverse dependencies) using them during
installation may fail (particularly on Windows).
If you set the environment variable R_REMOTES_STANDALONE="true" (e.g.
in R Sys.setenv(R_REMOTES_STANDALONE="true")) you can force remotes to
operate in standalone mode and use only its internal R
implementations. This will allow successful installation of these
packages
With the following lines of code, gt was finally successfull installed from github.
Sys.setenv(R_REMOTES_STANDALONE="true")
remotes::install_github("rstudio/gt")
Thanks all the commentators for your help!
Update October / 2021
To avoid having to do these steps (Set in standanlone mode, and install with remotes) over and over again everytime you want to install a new package from github another convenient workaround is to just rollback to the previous version of processx as adviced by #rempsy in the github issue:
install.packages("pacman")
pacman::p_del(processx)
# Installing previous verison 3.5.1
install.packages("https://cran.r-project.org/src/contrib/Archive/processx/processx_3.5.1.tar.gz", repos=NULL, type="source")
After the rollback of processx to version 3.5.1, devtools::install_github() works as expected, e.g.
devtools::install_github("rstudio/gt")
I have an issue with the library path of R. Maybe the answer is out there already, but I was not able to find it. I am using R together with RStudio Version 1.1.456. All my additional libraries used to be in a directory dir1 <- \\SHARE\TOOLS_OLD$\R-3.5.1 which I append with .libPaths(dir1). In this setup, everything works as expected.
The problem occured after I copied all the libraries in directory \\SHARE\TOOLS_OLD$\R-3.5.1 to a new location \\NAS\TOOLSNEW$\R-3.5.1. I did not update the R version and I want to keep all the package versions the same such that I have exactly the same setup as before. That is why I did not reinstall the packages in the new location.
When I open a new R session and run the three lines of code
dir2 <- \\NAS\TOOLSNEW$\R-3.5.1
.libPaths(dir2)
.libPaths()
I get the correct output of .libPaths()
[1] "\\\\NAS/TOOLSNEW$/R-3.5.1" "C:/Apps/R-3.5.1/library"
but R also throws an error:
Error: invalid version specification ‘NA’
In addition: Warning message:
In utils:::packageDescription(packageName, fields = "Version") :
no package 'knitr' was found
Apparently some packages remember the original location where they were installed. Is there a way to copy packages to a new location without reinstalling them? If that is not possible, is there an easy (i.e. non-manual) way to reinstall my package tree without upgrading any of the packages (including the dependencies) i.e. defining the version of each package?
Thanks for your help!
PS: Here is my session info, just in case.
R version 3.5.1 (2018-07-02)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows >= 8 x64 (build 9200)
Matrix products: default
locale:
[1] LC_COLLATE=German_Switzerland.1252 LC_CTYPE=German_Switzerland.1252
LC_MONETARY=German_Switzerland.1252 LC_NUMERIC=C
[5] LC_TIME=German_Switzerland.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
loaded via a namespace (and not attached):
[1] compiler_3.5.1 tools_3.5.1 yaml_2.2.0
The problem can have many causes, e.g. there might be some dependencies which are lost by copying the package folder or that the registry entries don't match anymore, but I'm guessing here. When you copy packages from older versions you have to run update.packages (but this might update any package to the currently available version, which you don't want). Check out the R-FAQ and this Stackoverflow question.
You can install packages of a certain version with the devtools package.
install.packages("devtools")
require(devtools)
install_version(somePackage, version = neededVersion)
How I did it was I created a data.frame of all the required packages with the corresponding version number, like
> requiredPkgs
Package Version
condformat "condformat" "0.9.0"
DT "DT" "0.17"
formattable "formattable" "0.2.1"
ggplot2 "ggplot2" "3.3.3"
ggthemes "ggthemes" "4.2.4"
htmlTable "htmlTable" "2.1.0"
and then installed them in a loop
for(iPkg in requiredPkgs) {
install_version(iPkg[1], version = iPkg[2]
}
I try to install R package "methods" over R 3.0.1:
> install.packages("methods")
> Warning message:
package ‘methods’ is not available (for R version 3.0.1)
Is there any way to install 'methods' over R 3.0.1 or should I switch to R 3.0.0?
Thank you
methods is part of base R, you don't have to install it with install.packages, as it is already bundled with your R 3.0.1 installation.
You will see that loading the package will not provide any error :
library(methods)
But you don't even have to do that, as it is already loaded by default in your R session.
methods is a base package, along with the following packages
base
compiler
datasets
graphics
grDevices
grid
methods
parallel
splines
stats
stats4
tcltk
None of these packages are on CRAN, they only exist as part of base R.
See also the R FAQ Section 5.1.1.
I have installed a package in R (ggmap), but when I try to use it R gives an error:
> library()
... (all the rest)
gdata Various R programming tools for data
manipulation
ggmap A package for spatial visualization with Google
Maps and OpenStreetMap
ggplot2 An implementation of the Grammar of Graphics
...
> library("ggmap")
Error in FUN(structure(c("write_png", "read_png"), .Names = c("write_png", :
no such symbol write_png in package/Library/Frameworks/R.framework/Versions/3.0/Resources/library/png/libs/png.so
Error: package or namespace load failed for 'ggmap'
Any suggestion? Thanks!
PD:
sessionInfo()
R version 3.0.1 (2013-05-16)
Platform: x86_64-apple-darwin10.8.0 (64-bit)
locale:
[1] C
attached base packages:
[1] stats graphics grDevices utils datasets methods base
EDIT, solution:
Delete ~/Applications/R.app and Library/Frameworks/R.framework and install R again.
Could in be that you have another R installation for an earlier version 3.0 vs the 3.0.1 showing in your sessionInfo()?
Error in FUN(structure(c("write_png", "read_png"), .Names =
c("write_png", : no such symbol write_png in
package/Library/Frameworks/R.framework/Versions/3.0/Resources/library/png/libs/png.so
Error: package or namespace load failed for 'ggmap'
Go to the RStudio-->Options-->Global-->'General'-->R Version
Change the R Version to the latest one which you want to use.
For some packages like doMC & doSMP, i get the warning & inability to library(doMC).
As shown below, i have no problem with subselect thus no file/directory permission issue.
Also tried repo=http://cran.us.r-project.org & others, no luck.
please advise.
ps: for the unexpected Japanese characters, i have no clue; i assume that is a separable issue; no response yet from support.rstudio.org/help/discussions/problems/6009-japanese-characters-show-unexpectedly
> install.packages('doMC')
Warning in install.packages :
package 租oMC・is not available (for R version 3.0.0)
Installing package into 舛:/Users/YULE/Documents/R/win-library/3.0・(as 鼠ib・is unspecified)
Warning in install.packages :
package 租oMC・is not available (for R version 3.0.0)
> install.packages('subselect')
Installing package into 舛:/Users/YULE/Documents/R/win-library/3.0・(as 鼠ib・is unspecified)
trying URL 'http://cran.rstudio.com/bin/windows/contrib/3.0/subselect_0.12-2.zip'
Content type 'application/zip' length 1295653 bytes (1.2 Mb)
opened URL
downloaded 1.2 Mb
package 壮ubselect・successfully unpacked and MD5 sums checked
The downloaded binary packages are in
C:\Users\YULE\AppData\Local\Temp\Rtmp6DK5mn\downloaded_packages
> library(subselect)
---------------------------------------------------------------------------------
> sessionInfo()
R version 3.0.0 (2013-04-03)
Platform: x86_64-w64-mingw32/x64 (64-bit)
locale:
[1] LC_COLLATE=English_United States.1252 LC_CTYPE=English_United States.1252
[3] LC_MONETARY=English_United States.1252 LC_NUMERIC=C
[5] LC_TIME=English_United States.1252
attached base packages:
[1] graphics grDevices datasets stats utils methods base
other attached packages:
[1] subselect_0.12-2 XML_3.96-1.1 colorspace_1.2-2 RGtk2_2.20.25 rattle_2.6.26
loaded via a namespace (and not attached):
[1] tools_3.0.0
If you want to install it for windows, here it how you can:
install.packages("doMC", repos="http://R-Forge.R-project.org")
I did it for R 3.2.3 version and it works well.
As Erdogan mentioned, it works for R 4.x.x versions as well.
I assume it's not available to you because you're using Windows. The doMC package has never been available on Windows because it depends on the mclapply function, before in the multicore package and now in parallel. I haven't heard of any issues with doMC in R 3.0.0.
The doSMP package was intended to be the Windows alternative to doMC. I believe it was eventually taken off CRAN because of problems building it on newer versions of GCC.
The doParallel and doSNOW packages are probably the most popular foreach backends available for Windows.
I was facing the same issue with RTextTools, as RTextTools is now not available on CRAN.
I have Download RTextTools From Given Link
https://cran.r-project.org/src/contrib/Archive/RTextTools/
and copy RTextTools_1.4.2.tar.gz file in project root folder then run this command in project folder in terminal
"R CMD INSTALL RTextTools_1.4.2.tar.gz"
After running this command I receive below error "ERROR: dependencies ‘SparseM’, ‘randomForest’, ‘tree’, ‘e1071’, ‘ipred’, ‘caTools’, ‘maxent’, ‘glmnet’, ‘tau’ are not available for package ‘RTextTools’"
Now install each dependencies from RStudio or RConsole (Any Editor used by you) by simply running this code
install.packages("caTools")
Install all 9 required packages One By One (In My Case it was 9 Packages Dependencies required by RTextTools) all packages will be installed except 'maxent'
Now download maxent from the given link
https://cran.r-project.org/src/contrib/Archive/maxent/
and copy maxent_1.3.3.1.tar file in project folder then run this command in project folder in terminal
"R CMD INSTALL maxent_1.3.3.1.tar"
Now For RTextTools Run this command again in Terminal
"R CMD INSTALL RTextTools_1.4.2.tar.gz"
All is done Now..
But the Last Step is
Load the RTextTools using
library(RTextTools)
You will see one more Error: Load SparseM Now Loading SparseM use code below
library(SparseM)
and in the last Load RTextTools
library(RTextTools)