R package: Error appears not in Windows but in Linux - r

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?

Related

Problems With Interactive Viewers Running R in VSCode

I am getting started with running R scripts in VSCode. Things are generally running fine, except for unexpected results with some of the viewers. I'm running Mac OS Mojave 10.14.6.
First, any table / list I try to view (using the View() command) generates this error:
Error in check_for_XQuartz(file.path(R.home("modules"), "R_de.so")) :
X11 library is missing: install XQuartz from www.xquartz.org
So I went ahead and installed XQuartz. Viewing dataframes then worked, but it spawned a separate window, rather than a VSCode tab, that was very primitive: slow to render, without any interactivity (no sorting of columns or searching, etc. of the type shown at https://github.com/REditorSupport/vscode-R/wiki/Interactive-viewers).
Second, I'm having similar problems with rendering plots. Plotting works, but it spawns a separate window, titled "Quartz 2 (*)", rather rendering in VSCode.
I have installed httpgd, and enabled r.plot.useHttpgd in VSCode settings.
Any advice, anyone? Big thanks in advance.

Problem with mismatched perl binaries using system2 command

I am trying to run an executable script from within RStudio. The script runs perfectly from Terminal, however, when trying to run it form within R I get the following error message:
setwd("/users/admin")
command <- "/users/admin/Test_script.command"
system2(command)
> lib/Bio/DB/HTS/Faidx.c: loadable library and perl binaries are mismatched (got handshake key 0xdb00080, needed 0xc500080)
I am running MacOS X Big Sur and I use perlbrew with perl version 5.26.2, I guess the problem is that RStudio tries to use my system perl version - but I couldn't find a way to change that…
Any ideas? Thanks!
I found a way to get it running by looking into the actual script, which is perl based. Then I was able to solve the problem by following the answer to https://stackoverflow.com/a/65553736/4253357 as Michal suggested. Thanks again for your help!

Launch rstudio-server from terminal linux

I'm an Ubuntu user and I used to work with the standard version of Rstudio on my computer. After reading about the server version I installed it on my PC and I'm working with it now. Although I'm very happy with rstudio-server version, I have been facing some difficulties to keep with some old practices. Particularly, I use to launch, open and create new files from the terminal using rstudio keyword - I'm specially fond to the possibility of open files in current rstudio session through the terminal window within rstudio. However, I cannot figure out which command is equivalent in rstudio-server.
I tried, without success, the following commands:
rstudio-server
and
r-server
Interestingly, when I type which rstudio (to find the path of the program's binary files), the terminal did not return any results. The program is installed and working normally, but I just can't find it on my PC
Any help will be appreciated

R plot doesn't work on my Windows, but plot.default does

I'm taking a course in R and I've hit a road block on day one.
Typing:
demo(graphics)
...should start a series of graphs being displayed on screen. On my Windows 10 (64 bit) new Dell laptop, I get a persistent error:
The execution is stopped after the red lines, seemingly because the demo(graphics) call is being made with incompatible parameters. In blue I make the same call but use the default function and an empty plot is displayed.
I have tried uninstalling and reinstalling everything, installing through Anaconda and from the CRAN website. The same error persists. I've even tried with mro instead of basic R.
I don't see any similar error messages in my class or on Google. My guess is that I need to install a particular version of R and RStudio make it work but I'm guessing.
Can anybody offer some expertise?
I'm running R version 3.6.1 (2019-07-05) (which is executing code correct, just not the demo call) and RStudio Version
Running the basic Rgui software from the command line with the --vanilla parameter like so:
Rgui --vanilla
Opened Rgui and the
demo(graphics)
...call worked.
This meant that the issue was in the .Rprofile file. This is found in the etc folder of the basic R installation and when I checked, it looked absolutely fine (entirely commented out actually).
I wanted to use RStudio though, so I investigated the RStudio docs and saw that each project is given its own .Rprofile style initialization file when a new project is created.
So I created a new project with RStudio and by creating a new project whatever configuration issue was causing the error was completely fixed.
Credits to G. Grothendieck for the answer in the comments.

igraph read graph hang in OS X

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.

Resources