R: RGraphviz installation - r

I've been trying to install the library using brute force - trying different combinations of the things people have posted in mailing lists (I'm too lazy to list them out one by one, but I think I tried the most of them. I can list that too if it helps anyone.). The results have varied from a harmless message of a missing dll to RGui not being able to start before I remove the library manually. Nevertheless, I haven't succeeded...
Do you know how to install it properly, so that it works? I'm running 64bit Windows 7 and I'm not keen of compiling packages from source. Thanks!

Install Rgraphviz 2.2.1 from Bioconductor
According to the latest README:
Rgraphviz now comes bundles with Graphviz. This should greatly simplify
installation on all platforms, compared with earlier versions.
Bioconductor 2.11 contains a lot of libraries that you might not want or need, but it does seem to be the easiest path to achieving what you want. These are the instructions on the Rgraphviz homepage:
source("http://bioconductor.org/biocLite.R")
biocLite("Rgraphviz")
These instructions work for R x64 2.15.2 on Windows 7
library("Rgraphviz")
Loading required package: graph
Loading required package: grid
set.seed(123)
V <- letters[1:10]
M <- 1:4
g1 <- randomGraph(V, M, 0.2)
plot(g1)

The README inside the source package for RGraphviz contains very some pretty clear instructions.
I think it's a bit user-unfriendly to those who only want to install the binary package, to hint that they might also want to download and unpack a tar.gz file containing the complete source, in order to find some technical info .... which turns out to be absolutely crucial.

One word of warning. If you follow the installation instructions for Rgrahpviz precisely, things won't work. Installing the package graphviz edits the environment PATH, but incorrectly. I didn't notice and I bet lots of others missed it too.
Rgraphviz wants to look for the binary in ...;C:\Graphviz2.20\bin\;
BUT the graphviz install adds a path only as far as ;C:\Graphviz2.20\;.
You'll have to edit it. Older instructions suggest a manual edit anyway, but newer ones leave it to graphviz.

I have same problems to install Rgraphviz (for using it in Bayesian Network packages). I used to get brute force solutions, but, now I trying an other one described here in this page
maybe you had also tried. If you succeed in installing Rgraphviz, I will be grateful if you learn me how to do.

I am using R-Studio on Ubuntu 12.10 x64 and installed Rgraphviz from the BioC software repository. Hope this helps. Eg: http://www.biotricks.net/2012/03/rstudio-and-bioconductor.html

I don't know if you have managed to solve your problem 100% but my installation problem came with the R version. Rgraphiz is developed by Bioconductor and it seems to be outdated. However, I had to use it since I moved to a new company and they are using it in one of their shiny apps for whatever reason.
With that being said, I have a dirty solve that I came up with after a couple of days of struggling with it.
First I include a line in the code which seems to be needed since without that line the shiny app simply doesn't do anything after opening:
if(!requireNamespace('BiocManager', quietly = TRUE))
install.packages('BiocManager')
It's weird that it won't work otherwise.The above line is found on Bioconductor's site: https://www.bioconductor.org/packages/devel/bioc/html/Rgraphviz.html
The second thing you need to do only once is to run the biocLite command below in the R console to install the Rgraphviz package
source("http://bioconductor.org/biocLite.R")
biocLite("Rgraphviz")
The above command I found on another thread: R: RGraphviz installation
Hopefully this update will help you or anyone else.

Since with the version of R 3.6.1 the script http://bioconductor.org/biocLite.R returns this message " Error: With R version 3.5 or greater, install Bioconductor packages using BiocManager; see https://bioconductor.org/install " I solved the problem with the following steps:
Get the list of directories used by R to install libraries and
choose the one with write permissions using: .libPaths()
Installing the "BiocManager" library using: install.packages("BiocManager")
Installation of the library "bioconductor" by forcing the directory
with write permissions using: BiocManager::install("Rgraphviz", lib = "C:/Users/tizbet/Documents/R/win-library/3.6")
I worked on the following R installation:
platform x86_64-w64-mingw32, arch x86_64, os mingw32, system x86_64, mingw32, version.string R version 3.6.1 (2019-07-05)

Related

gRrain and Rgraphviz not available in the latest 3.6 R version

after updating my R version to 3.6.1 version - the rGrain and rGraphviz packages do not work. First the error was suggesting that the packages are not writable. However after updating some libraries and trying to source it outside from the BiocManager right now the error appears saying that the compilation fails. Does anybody know how to fix it?
I have already tried multiple options like sourcing it outside and directly from BiocManager and other sources however with no results.
I would appreciate any type of help suggesting how to fix or just install packages gRain and Rgraphviz.
Not writable is biocmanager being poorly programmed and somehow wanting to install some secondary packages into the main R folder in program files, rather than the usual R\win-library\ in documents.
You can workaround that by launching the R console or Studio with administrator privileges when installing/updating.

Can homebrew R and "standard" R for MacOS from CRAN coexist?

I am running R 3.6.1 on a Mac Mini running Sierra and a MacBook Pro running El Capitan. I normally get all the R packages that I need from CRAN or github and use them without issues, but I am trying to install and use an R package (NicheMapR) that requires a fortran compiler and this is giving me issues. Even after installing gfortran, the R package still does not work (the fortran code seems to be compiled but the package installation fails). The package developer suggested that installing R via homebrew might solve the problem. On the contrary, my hunch is that it would lead to a world of pain, to quote Walter from the Big Lebowski. My questions are:
What is the advantage of a homebrew version of R for MacOSX over the "regular" version installed from CRAN?
Can the two versions coexist?
Is the homebrew version going to affect the regular one?
Finally: is homebrew going to help or will it simply open a whole
new can of worms?
Many thanks in advance.
Yes, installing from homebrew is a recipe for pain. It's specifically recommended against by the official CRAN binary maintainer see his remarks from March 2016 on r-sig-mac.
Regarding your questions, this can be summarized as:
What is the advantage of a homebrew version of R for MacOSX over the "regular" version installed from CRAN?
Positives: Select your own BLAS and easily work with geospatial tools.
Downsides: Always needing to compile each R package.
Can the two versions coexist?
Yes. The homebrew version installs into a different directory. But, watch out for library collision (see next question). However, you will have to deal with symbolic linking regarding what version of R is accessible from the console and you will also need to look into using RSwitch to switch between R versions.
Is the homebrew version going to affect the regular one?
Yes, if the library paths overlap. There will be problems regarding package installation and loading. Make sure to setup different library paths. To do so, please look at the .libPaths() documentation.
Finally: is homebrew going to help or will it simply open a whole new can of worms?
Yes and no. Unless you know what you're doing, opt for the CRAN version of R and its assorted goodies.

R package listed on CRAN but not in available package

I want to install a package that is listed in https://cran.r-project.org/web/packages/available_packages_by_name.html as available in CRAN, but when I check in R the install packages menu or the available.packages() command, I can't see the package there.
Do I need to do something different to install those packages? Why aren't those packages available?
The packages I'm interested on are WikipediR ( https://cran.r-project.org/web/packages/WikipediR/index.html ), WikidataR and WikipediaR.
If it matters, I'm using R 2.15.0 in Windows XP.
See the documentation for ?available.packages...
By default, the return value includes only packages whose version and
OS requirements are met by the running version of R, and only gives
information on the latest versions of packages.
In other words... your R 2.15 is likely too old for the package you are looking to download.
You can try to download the package source manually add the package to the package library usually found somewhere like "win-library/2.15/" but like Cory mentioned it is likely that the older version of R does not support the package build.
The advice given so far is a bit incomplete although I do agree you need to update your R version if you want to use these packages. Looks like they don't need compilation so you might have been able to either install from a local copy or drop R code in, but critically they depend on httr which requires R 3.0.0 or above. They were released only relatively recently, so there will be no Windows binaries from back in 2012. (Your copy of R is from 30-Mar-2012.) Look in the DESCRIPTION file which is presented in a nice web format at the CRAN/package listing:
https://cran.r-project.org/web/packages/WikidataR/index.html
Imports: httr, jsonlite, WikipediR
Suggests: testthat, knitr, pageviews
# only one version of these two
https://cran.r-project.org/src/contrib/Archive/WikidataR/WikidataR_1.0.0.tar.gz
https://cran.r-project.org/src/contrib/Archive/WikipediaR/WikipediaR_1.0.tar.gz
# pick one of these
https://cran.r-project.org/src/contrib/Archive/WikipediR/

How can I access Windows COM objects in R v3?

Some time ago, you used to be able to install the rcom package in R to use COM scripting (eg, access to external programs.) Unfortunately, it seems to be discontinued:
Package ‘rcom’ was removed from the CRAN repository.
Formerly available versions can be obtained from the archive.
This depends on statconnDCOM, which nowadays restricts use, contrary
to the CRAN policy for a package with a FOSS licence. See
http://rcom.univie.ac.at/ and http://www.statconn.com/.
Following the archive and statconn links and installing one of the older versions in R version 3 gives the error:
“Error: package ‘rcom’ was built before R 3.0.0: please re-install
it”.
I am not very familiar with R, but there seems no way around this message - after all, it occurs when installing, so re-installing doesn't seem to be the answer. It appears as though rcom is simply not available for recent (3.0+) versions of R. I have also scanned the package list, although searching for "COM" there returns over a hundred results and it is possible I missed the right one when clicking through them.
How can I use the rcom package, or use COM from within R some other way?
(Note: I am asking this question on behalf of a colleague. I have no experience with R myself at all. Both of us, when searching for answers, could not find anything. I am sure that others are also using COM in the latest version of R, though!)
I looked at the rcom source code a few months ago. It seems I can get it to build and install OK on R3.0.1. Below is the procedure if it helps.
Get a checkout of the latest source code of rcom. I have rcom_2.2-5.tar.gz locally. I can google something at the following address, but I have no idea of the provenance, so up to you to check it is legit. http://cran.open-source-solution.org/web/packages/rcom/index.html
in R do install.packages('rscproxy')
install Rtools as per the instructions on the R web site (http://cran.r-project.org/bin/windows/Rtools),
open a Windows command prompt i.e. run "CMD"
go to the folder containing the 'rcom' folder, and at the command prompt:
set R="c:\Program Files\R\R-3.0.1\bin\i386\R.exe"
%R% CMD check --no-manual rcom
check it passes without too many complaints. Your call as to the --no-manual option (if you have MiKTeX installed you may remove it)
%R% CMD INSTALL rcom
should result in
installing to c:/Rlib/rcom/libs/i386
** R
** inst
** preparing package for lazy loading
** help
*** installing help indices
** building package indices
** testing if installed package can be loaded
rcom requires a current version of statconnDCOM installed.
To install statconnDCOM type
installstatconnDCOM()
This will download and install the current version of statconnDCOM
You will need a working Internet connection
because installation needs to download a file.
* DONE (rcom)
in R:
library(rcom)
installstatconnDCOM()
I tried a comRegisterRegistry() ; comRegisterServer()
; x<-comGetObject("Excel.Application") but I get a NULL for x. I am not a user of rcom so while it all seems to compile fine; it may just not work anymore.
If you happen to need to access .NET code, a viable option (and yes I have a vested interest in mentioning it) may be the rClr package.
Hope this helps; I'd be interested to hear how you go.
This really should be a comment, but I don't have enough rep points yet to leave one.
I found that the above steps did not work for me, but the answer posted by Lisa Ann on this question, RExcel in R 3.0.x, did solve my problem installing rcom. Since you need rcom to run RExcel, the initial steps to install RExcel cover installing rcom on newer versions of R (such as 3.0.2).
Specifically, following the advice on statconn's wiki, http://homepage.univie.ac.at/erich.neuwirth/php/rcomwiki/doku.php?id=wiki:how_to_install
You also need to follow these instructions if you upgrade R, i.e. you install a new >release of R after you have installed RExcel.
Download the statconn DCOM server and execute the program you downloaded
Start R as administrator (on Windows 7 you need to right-click the R icon and click the >corresponding item)
In R, run the following commands (you must start R as administrator to do this)
install.packages(c("rscproxy","rcom"),repos="http://rcom.univie.ac.at/download",lib=.Library)
library(rcom)
comRegisterRegistry()
Now you have rcom installed, [instructions for installing RExcel follow...]
New versions of rcom and rscproxy (also for current versions of R) are available from a different repository. Just use http://rcom.univie.ac.at/download as the R repository to install from and you can download and install binary versions of statconn packages from there.
Hope this helps!

R: can rpm files be used with Windows for possibly outdated R packages?

I was trying to run code that required the R packages ‘pkgDepTools’ and ‘Rgraphviz’. I received error messages saying that neither package is available for R version 2.15.0.
A Google search turned up the following webpage RPM Pbone that seems to have the packages:
http://rpm.pbone.net/index.php3/stat/4/idpl/17802118/dir/mandrake_other/com/R-pkgDepTools-1.20.0-1-mdv2012.0.i586.rpm.html
and
http://rpm.pbone.net/index.php3/stat/4/idpl/17802080/dir/mandrake_other/com/R-Rgraphviz-1.32.0-2-mdv2012.0.i586.rpm.html
However, the files have an *.rpm extension rather than the *.tar.gz or *.zip extensions I am used to.
I am using Windows 7 and R version 2.15.0. Can I install an R package from an *.rpm file?
From Wikipedia *.rpm seems like maybe it is more for Linux:
http://en.wikipedia.org/wiki/RPM_Package_Manager
Regarding other possible solutions, I have found several earlier posts here with similar questions about installing R packages that are not available for the most recent version of R:
Bivariate Poisson Regression in R?
Package ‘GeneR’ is not available
R Venn Diagram package Venerable unavailable - alternative package?
I have installed the latest version of Rtools and the package 'devtools'. Although I know nothing about them.
There is an archived version of 'Rgraphviz' here:
http://cran.r-project.org/src/contrib/Archive/Rgraphviz/
but I cannot locate an archived version of 'pkgDepTools'.
If I can install the packages on a Windows machine using the above *.rpm files could someone please provide instructions?
If I must use Rtools to build them I might ask more questions because the instructions at the link below are challenging for me:
http://cran.r-project.org/doc/manuals/R-admin.html#Building-from-source
To be completely transparent I am hoping someone might build them for me, if that is possible. Although I recognize the experience and knowledge gained from doing it myself would probably pay off in the long run.
Thank you for any advice.
pkgDepTools and Rgraphviz are BioConductor R packages not ones hosted on CRAN. Unless you configure your R to download packages from those repos, R will report that they are not available; it can only install from repos it has been configured to install from.
To install those BioConductor packages a lite installation method is provided:
source("http://bioconductor.org/biocLite.R")
biocLite(c("pkgDepTools", "Rgraphviz"))
Further details are provided on the Install page of the BioConductor website
In general you can't use rpm packages on Windows; rpm's are the equivalent of a binary package for Linux. Any C/C++/Fortran/etc code will have been compiled for Linux not Windows. If a package really isn't available for your version of R then check if there is a reason stated on CRAN (usually Windows binaries take a few days longer to produce or there may be requirements for software not available on the CRAN Windows build machines). You can try the WinBuilder service run by Uwe Ligges to build Windows Binaries of packages for you, but if the package was on CRAN and now isn't that suggests it no longer works with current R and can not be built.
In general try a wider search for packages; the first hit in my Google search results under the search string "pkgDepTools" is the Bioconductor page for the package which includes a link to the Windows binary and instructions on how to install the package from within R.
I think this merits an answer rather than a comment.
A gentleman at Bioconductor helped me get Rgraphviz installed. The primary problem was that the version of Rgraphviz I had downloaded only seems to work with the 32-bit version of R and I was running a 64-bit version of R. I was able to install Rgraphviz in the 32-bit version of R.
I had also made an error or two in the PATH statement during some of my attempts to install Rgraphviz. However, the post above in my second comment provides the instructions for installation.
You just, it seems, cannot install the normal download version of Rgraphviz in the 64-bit version of R.
I think many of our emails back and forth are now posted on the Bioconductor forum.
I might edit this answer with more detailed instructions in the next 24-hours.

Resources