igraph read graph hang in OS X - r

I use igraph r package. I have a ncol formatted graph file and uses
g <- read.graph('~/tmp/graph.ncol', format = 'ncol', weights="yes")
to read to memory. While this command and graph file runs fine for a few minutes under Ubuntu 14.04. Using the same machine with OS X 10.10 the command runs and never ends. I also tried another same graph in graphml format with same result.
This is a macbook pro that after upgrading to OS X 10.10, the refit/refind no longer works for me to boot into 14.04, so I decided to use OS X for a while and encountered this. The igraph package is installed by source in ubuntu while installed by binary from cran in OS X. I' ve also tried using the source package to compile igraph r package locally and got the same hanging result. Anyone experience similar things? Not sure if it is an OS X 10.10 thing.

It turns out that it only happens when the file path includes ~ like ~/tmp/graph.txt, that it begins to use tempfile and calling read.graph.toraw that causes the trouble. I can avoid using that ~. This is a workaround good enough for me.

Related

RStudio Server from Windows Subsystem for Linux cannot find packages on PATH

I am trying to use RStudio Server to run a package (CNV-CLinViewer) through Windows Subsystem for Linux.
All R packages required could be installed except for bedtoolsr, which requires bedtools (not an R package). I have bedtools installed on my WSL and the folder is part of my PATH.
For some reason, RStudio does not "see" it, however.
I tried to manually set the path to bedtools using options(bedtools.path = "/home/usr/anaconda3/bin/bedtools"), but that did not help either.
Does anybody have a tip on how to make it visible to RStudio Server?
Thanks
The issue was that the PATH variable was on RStudio was different from the one displayed on the terminal (it was missing /home/analyst/anaconda3/bin).
Editing the PATH variable on RStudio fixed it. I edited the variable like this:
old_path <- Sys.getenv("PATH")
Sys.setenv(PATH = paste(old_path, "/home/analyst/anaconda3/bin", sep = ":"))

R package: Error appears not in Windows but in Linux

guys.
I am currently trying to build an R package (using rcpp). By this suggestion, I encountered an error, which was fixed by putting the following line in src/Makevar and/or src/Makevar.win.
PKG_CXXFLAGS = -DRCPP_ARMADILLO_FIX_Field
However, this error disappeared when I run my function in Windows on my laptop, but it again appeared in Linux. (I usually wirte the code in Windows on my laptop and run the code by using Linux for parallel computing provided by my university) It seems that that line can remove the flag in Windows but cannot remove it in Linux.
How can this happen, and how can I fix this?

Plot doesn't work in Octave 4.0.0 (Windows 7 64-bit)

I'm trying to get Plot working for Octave Windows 7 (64 bit). Things I have tried:
Tried changing the graphics_toolkit to gnuplot or fltk. See Plot window not responding
I have tried uninstalling and re-installing Octave.
I have tried to install the latest version of gnuplot in the Octave Directory.
pkg rebuild -noauto oct2mat (didn't help before or after octave restart)
The cursor moves to the next line (without ">>", as if waiting for the command to run), but the figure window doesn't show at all, I have to press Ctr-C several times to force Octave to quit.
Code:
x = linspace(0,1,10)
y = x.^2
plot(x,y);
Please suggest if I can try something else.
Octave version : 4.0.0, running on a laptop, Windows 7 64-bit Professional.
I rewrite the comment as answer.
A long delay when plotting for the first time in GNU Octave on Windoze is a known problem: http://savannah.gnu.org/bugs/?45458
The reason for this is that the fontconfig cache has to be build once. After that plotting should be fast as usual.

Older version of R in mac OS X 10.10.5

I have a problem downloading R in my mac which I have been dealing with for many hours now.
My purpose is to use propensity score matching in SPSS (from source forge). I am using SPSS version 22 on my mac OS X yosemite 10.10.5.
After reading a lot on the different sites I need to use R.2.15 for SPSS 22 in order to use the psmatching 3.03 on source forge.
However, I cannot seem to install R 2.15 when I run the installation package. When I am going to select destination on the macintosh HD, it says that R2.15.0 for Mac OS X 10.5 or higher can’t be installed on this disk. How is this possible? My OS X version is higher than the demanded version for R 2.15.
Any ideas how to make the installation?
I've run into this problem myself: SPSS versions require very specific versions of R to be installed for the R Integration plug-in to work. An older or newer version of R will not suffice.
I think the installation error is due to the old R installer's attempt to verify a sufficiently high OS X system version. But it doesn't recognize 10.10+ as being higher than 10.9 (or 10.5 for that matter).
The link below has information about disabling OS X El Capitan's System Integrity Protection, in order to change the OS X file /System/Library/CoreServices/SystemVersion.plist, so that a false system version can be reported to the installer.
https://forums.developer.apple.com/thread/4138
A safer method might be to manually place the files from R's 2.15 installer. There's an apparent complication with my attempt at that, though. I opened the R 2.15.pkg installer file, found a file 'payload' inside, used 'tar -xzvf Payload' to extract contents, and moved those contents into /Library/Frameworks/R.framework/Versions/2.15. In retrospect, it may be most useful to temporarily re-alias "Current" in the R.frameworks folder so that it points to 2.15 version while the installer completes. Instead, I did the following to get around installer error messages I found in the installer log file, which worked for me:
The SPSS Essentials for R installer reported that the install location does not contain R 2.15. Examining the error log files led me to believe that the installer's attempt to verify the R version inappropriately navigated to the "Current" version (aliased to a specific version, likely not R 2.15 if 2.15 was installed manually), even if the directory for 2.15 was specifically entered into the installer. It then seeks a couple of i386 subdirectories that no longer exist as of R 3.2.2. So (for my case) I manually created "/Library/Frameworks/R.framework/Versions/3.2/Resources/bin/exec/i386" and copied version 2.15 of the R unix executable, and did similarly for "/Library/Frameworks/R.framework/Versions/3.2/Resources/etc/i386", copying in the ldpaths file that the installer seeks. Doing so finally allowed the SPSS Essentials for R installer to complete. In retrospect, temporarily re-aliasing "Current" in the R.frameworks folder might have been a more direct approach, but I haven't tried that as of right now.
For what it's worth, I was able to install an older version of R (for a different purpose, but I found this page while trying to figure it out), without having to temporarily change the version of OS X (or macOS) on my system. That seemed dangerous to me, and I wanted a simpler fix.
What worked for me was extracting the installer pkg, modifying the version check in there, and then packaging it up again.
Downloading the pkg installer from CRAN
open Terminal and cd to the directory where the installer is: e.g.,
cd ~/Downloads
use pkgutil to expand the pkg file you downloaded
pkgutil --expand R-2.15.0.pkg R-2.15.0
This creates a folder named R-2.15.0 (You can name it whatever you want in the command above). In that folder is a text file called Distribution.
Open the Distribution file in a text editor (e.g., TextEdit), and
modify the function at the beginning that checks the version of OS
X. for example, if it requires Leopard, there will be a line that
looks like this:
if(!(my.target.systemVersion.ProductVersion >= '10.5.0')) {
...
}
Notice that version string for comparison is a string (not a number!), so any version past 10.9 (10.10 and up) will fail that check ('10.10' sorts between '10.1' and '10.2', which is less than '10.5').
All I did was change the minimum version here ('10.5.0') to '10.1'. So the same line reads:
if(!(my.target.systemVersion.ProductVersion >= '10.1')) {
Save the Distribution file.
Go back to terminal and re-package the directory you created in step 3:
pkgutil --flatten R-2.15.0 R-2.15.0-HACKED.pkg
You can call the new pkg whatever you want, as long as you will recognize it.
The resulting package (R-2.15.0-HACKED.pkg, in this example) will now run on any version of OS X higher than or equal to the version you specified (in this case, 10.1 and up).
Disclaimer: I actually tested this with R-2.12.0 (and it worked), but I provided example code for R-2.15.0 to answer the original question. It should be similar with any R installer pkg for OS X that uses a similar version string to check for compatibility before installation.

I cannot run my R script in Xcode for OS X mavericks

I'm using Xcode for OS X mavericks. I have written the code in R and saved it as a script file (.r). I can't run the script directly in R, only in Xcode. However, I'm not sure how to run the script I saved in R in Xcode. Could someone offer a simple explanation? thanks
In the R runtime environment, type the following command and execute it:
source(file.path(path, filename.saved.from.xcode.ending.in.r))

Resources