R data.entry is not working on OS X El Capitan - r

When I use R language, I can't use data entry:
$ R
> cheese = c(1,2,3)
> data.entry(cheese)
error: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/otool: can't open file: /usr/local/Cellar/r/3.2.2_1/R.framework/Resources/modules/R_de.so (No such file or directory)
Error in dataentry(odata, as.list(Modes)) : X11 is not available
In addition: Warning message:
running command ''/usr/bin/otool' -L '/usr/local/Cellar/r/3.2.2_1/R.framework/Resources/modules/R_de.so'' had status 1
But I installed X11, XQuartz 2.7.7.

You need X11 support in order to use this function. Reinstall R with:
brew reinstall r --with-x11
It should then work as expected.

Installing 'R' from RStudio helped me in fixing this problem. I had installed 'R' using brew, therefore first uninstalled 'R' using command-
Atuls-MacBook-Pro:~ atulkaushik$ brew uninstall r
Then downloaded the appropriate package 'R-x.y.z.pkg' from RStudio. Though, this step helped me in running x11() on terminal, I was still not able to perform operations using this function.
m=matrix(1:81,9,9)
data.entry(m)
Error in .External2(C_dataentry, data, modes) :
unable to start data editor
In addition: Warning messages:
1: In dataentry(odata, as.list(Modes)) :
locale not supported by Xlib: some X ops will operate in C locale
2: In dataentry(odata, as.list(Modes)) : X cannot set locale modifiers
3: In dataentry(odata, as.list(Modes)) :
unable to create fontset --fixed-medium-r----120------
instead of invoking r shell through command 'r', I used LC_CTYPE=C R command
Atuls-MacBook-Pro:~ atulkaushik$ LC_CTYPE=C R
Now, when I execute
data.entry(m)
System will open a XQuartz window like -

Related

install_keras() Error: Keras installation failed (no conda binary found)

I am facing error in this command though I have python3 x in my system and have anaconda as well. I tried all the option given in
Error: Unable to find conda binary. Is Anaconda installed? reticulate Rstudio
https://stackoverflow.com/posts/53434444/revisions, but nothing working for me.
In fact, I am getting error for H2o as well.
Warning in install.packages :
unable to move temporary installation ‘C:\Users\kumaashi\Documents\R\win-library\3.5\file124f052421e1\h2o’ to ‘C:\Users\kumaashi\Documents\R\win-library\3.5\h2o’
I got this error earlier also but used to get fixed with trace(utils:::unpackPkgZip, edit=TRUE) by changing sys.time - 2.5 but since i updated R that option is not coming at all

R unable to load internet routines after upgrade to MacOS Sierra

When running R after upgrading my mac to 10.12.6 (Sierra), R can no longer load libraries or access anything on the internet:
> install.packages("devtools")
--- Please select a CRAN mirror for use in this session ---
Warning: failed to download mirrors file (internet routines cannot be loaded); using local file '/anaconda/lib/R/doc/CRAN_mirrors.csv'
[...]
Warning: unable to access index for repository
https://cran.cnr.berkeley.edu/src/contrib:
internet routines cannot be loaded
Warning messages:
1: In download.file(url, destfile = f, quiet = TRUE) :
unable to load shared object '/anaconda/lib/R/modules//internet.so':
dlopen(/anaconda/lib/R/modules//internet.so, 6): Library not loaded: #rpath/libssh2.1.dylib
Referenced from: /anaconda/lib/R/modules//internet.so
Reason: image not found
2: package ‘devtools’ is not available (for R version 3.4.1)
Similarly:
> source("https://bioconductor.org/biocLite.R")
Error in file(filename, "r", encoding = encoding) :
internet routines cannot be loaded
In addition: Warning message:
In file(filename, "r", encoding = encoding) :
unable to load shared object '/anaconda/lib/R/modules//internet.so':
dlopen(/anaconda/lib/R/modules//internet.so, 6): Library not loaded: #rpath/libssh2.1.dylib
Referenced from: /anaconda/lib/R/modules//internet.so
Reason: image not found
This happens both when I run R from Terminal and when I run R from RStudio (though RStudio only gives me the error, not the warning, and then still fails).
I found other people with vaguely similar problems in the past; one common solution was to re-install XQuartz, which I have done, but which didn't help.
Another common solution was to update LD_LIBRARY_PATH. However, 'libssh2.1.dylib' does not seem to exist: 'locate libssh2.1.dylib' returns nothing. I did find libssh2.dylib in /Applications/Xcode.app/Contents/Developer/usr/lib/libssh2.dylib, which is presumably the same thing, but R isn't finding it, I suppose.
Any ideas? Thank you!
EDIT: I found a simple solution. Just download the .tar file and use the command 'R CMD INSTALL mcmcse_1.3-2.tar', for example, in your terminal, from the directory in which your .tar file is saved.
I think that install.packages(‘package_name’) not working within R on macOS Sierra (with the package manager Anaconda installed) might be because Anaconda moves R’s path.
Just a reply to flag the same issue while using Anaconda 4.2.0 with R 3.4.1 on macOS Sierra 10.12.6. I was initially running R 3.4.0 in /usr/bin/R, but R has since become R 3.4.1 in /Users/[username]/anaconda/bin/R after installing Anaconda 4.2.0.
Warning: unable to access index for repository https://www.stats.bris.ac.uk/R/src/contrib:
internet routines cannot be loaded
Warning messages:
1: In download.file(url, destfile = f, quiet = TRUE) :
unable to load shared object '/Users/michaelfaulknerlocal/anaconda/lib/R/modules//internet.so':
dlopen(/Users/michaelfaulknerlocal/anaconda/lib/R/modules//internet.so, 6): Library not loaded: #rpath/libssh2.1.dylib
Referenced from: /Users/michaelfaulknerlocal/anaconda/lib/R/modules//internet.so
Reason: image not found
2: package ‘mcmcse’ is not available (for R version 3.4.1)
This turns out to be, as far as I can tell, a bug in Anaconda2-4.4.0-MacOSX-x86_64.pkg I had an anaconda/ directory in /, /Applications/, and /Users/[me]/: I deleted all of them, and removed the Anaconda PATH change to .bash_profile. R then reverted to /usr/local/bin/R, which did not have the internet connection problems reported above. Then I reinstalled Anaconda from scratch, then installed RStudio from Anaconda-Navigator. 'which R' now pointed at /Users/[me]/anaconda/bin/R (the PATH having changed again upon install), and which had the internet connectivity problem. Running /usr/local/bin/R directly, even with Anaconda installed, had no problems.
I've filed the bug as https://github.com/Anaconda-Platform/support/issues/137 but now can at least run R myself by using /usr/local/bin/R.

Getting gputools and gmatrix in R to run smoothly on Linux

I am having trouble getting R to recognize gmatrix for R, running through Rstudio. My details are below.
Things that are accomplished and DONE:
install of openSuse Tumbleweed x86_64
install of NVIDIA graphics driver 361.42
install of CUDA 7.5 & symbolic link for /usr/local/cuda
set LD_LIBRARY_PATH & PATH
R 3.2.5
RStudio 0.98.501-1.62
patched /usr/local/cuda/include/host_config.h, line: 115 by increasing the "4"'s to "5"'s (this pertains to the gcc compiler)
install package gputools
~ partial install of package gmatrix
*I had to edit the host_config.h file because cuda is not supported for the gcc compiler that Tumbleweed ships with. I basically broke the evaluation that checks for version and set it to 5.9 instead of 4.9. Was this a supremely naive thing to do?
Things not Done, help required:
-I wasn't able to install gmatrix properly. I got R to install by manually adding the LD & PATH directories using the Sys.setenv()
> Sys.setenv("LD_LIBRARY_PATH"="/usr/lib64/R/lib:/lib:/usr/local/lib64:/usr/local/cuda/lib64")
> Sys.setenv("PATH"="/home/eamergent/bin:/usr/local/bin:/usr/bin:/bin:/usr/bin/X11:/usr/games:/usr/local/cuda/bin")
However, I am unable to load the gmatrix package, yet gputools works fine:
> library(gputools) "no issues"
> library(gmatrix)
> Error in dyn.load(file, DLLpath = DLLpath, ...) : unable to load shared object '/home/eamergent/R/x86_64-suse-linux-gnu-library/3.2/gmatrix/libs/gmatrix.so':libcudart.so.7.5: cannot open shared object file: No such file or directory Error: package or namespace load failed for ‘gmatrix’
*The Error makes it seem that libcudart.so.7.5 is to blame
However,
/usr/local/cuda/lib64/libcudart.so.7.5 does in fact exist:
> eamergent#linux-pnx7: ls /usr/local/cuda/lib64/libcuda
libcudadevrt.a libcudart.so libcudart.so.7.5 libcudart.so.7.5.18 libcudart_static.a
*I used tab to get a shorter list. there are many more in lib64
Any ideas on how to get R to recognize the already installed gmatrix package? Or how to properly reinstall without using the R environment path fix that I used above?
I had the same issue on Ubuntu 14.04 where the system and R (Sys.setenv()) shared library paths were set properly, but R failed to load the CUDA shared library. What worked was to set the CUDA shared library path using ldconfig.
as root or prefix commands with sudo:
# echo "/usr/local/cuda/lib64/libcuda" > /etc/ld.so.conf.d/cuda.conf
# ldconfig
then
# R
> install.packages("gmatrix")
or if gmatrix is already installed
# R
> library(gmatrix)
> gtest()

r - Rd2pdf error about TeX binary

I created an R package in RStudio using devtools and roxygen2. I have the project file open and I now want to take all of the documentation for my functions and put it together into a pdf reference manual. I ran
system("R CMD Rd2pdf .")
which gave me the following error:
# Error in texi2dvi(file = file, pdf = TRUE, clean = clean, quiet = quiet, :
# Running 'texi2dvi' on 'Rd2.tex' failed.
# Output:
# You don't have a working TeX binary (tex) installed anywhere in
# your PATH, and texi2dvi cannot proceed without one. If you want to use
# this script, you'll need to install TeX (if you don't have it) or change
# your PATH or TEX environment variable (if you do). See the --help
# output for more details.
# For information about obtaining TeX, please see http://www.tug.org. If
# you happen to be using Debian, you can get it with this command:
# apt-get install tetex-bin
# Error in running tools::texi2pdf()
I'm using OS X 10.10 and I have MacTeX installed (it's sitting in my Applications folder). I'm a beginner at R and LaTeX so I'm not sure what the error message means when it says that I don't have a working TeX binary installed. How should I proceed?
After digging around, I found out that the error I was getting has to do with the
Yosemite upgrade.
The workaround is to launch RStudio from terminal as suggested on here.
When I did this, I was able to produce the reference manual just fine.

require(RQuantLib) fails

I am trying to load RQuantLib but I get the following error:
> require(RQuantLib)
Loading required package: RQuantLib
Error : .onLoad failed in loadNamespace() for 'RQuantLib', details:
call: if (is.character(qc) && nchar(qc) > 1) {
error: missing value where TRUE/FALSE needed
In addition: Warning message:
running command 'bash -c 'type -p quantlib-config' 2>/dev/null' had status 1
I am pretty new to programming in general so I am not sure what this means. I am working in an Mac OS Maverick environment, I downloaded the latest version of RQuantLib (0.3.12) and the "R Package Installer" says it is installed. (I installed RQuantLib from the terminal using "R CMD INSTALL RQuantLib" as using install.packages() from within R did not work - it gave me an error saying QuantLib was not configured, although it was running fine in from the terminal.) I am running R from the R console. QuantLib works fine and so does Rcpp.
I checked the "NAMESPACE" document in the RQuantLib folder and it says:
import(methods)
importFrom(Rcpp, Rcpp.plugin.maker)
useDynLib(RQuantLib)
exportPattern("*.default")
export(
##--arrays.R
"oldEuropeanOptionArrays",
"EuropeanOptionArrays",
"plotOptionSurface",
##--asian.R
"AsianOption",
##--bermudan.R
"BermudanSwaption",
"summary.G2Analytic",
"summary.HWAnalytic",
"summary.HWTree",
"summary.BKTree",
##--bond.R
"ZeroCouponBond",
"ZeroPriceByYield",
"ZeroYield",
"FixedRateBond",
"FixedRateBondYield",
"FixedRateBondPriceByYield",
"FloatingRateBond",
"ConvertibleZeroCouponBond",
"ConvertibleFixedCouponBond",
"ConvertibleFloatingCouponBond",
"CallableBond",
"FittedBondCurve",
##--calendars.R
"isBusinessDay", "businessDay",
"isHoliday",
"isWeekend",
"isEndOfMonth",
"getEndOfMonth", "endOfMonth",
"adjust",
"advance",
"businessDaysBetween",
"getHolidayList", "holidayList",
"setCalendarContext",
##--dayCounter.R
"dayCount",
"yearFraction",
"setEvaluationDate",
##--discount.R
"DiscountCurve",
"plot.DiscountCurve",
##--implied.R
"EuropeanOptionImpliedVolatility",
"AmericanOptionImpliedVolatility",
"BinaryOptionImpliedVolatility",
##--option.R
"EuropeanOption",
"AmericanOption",
"AmericanOption.default",
"BinaryOption",
"BarrierOption"
)
S3method("plot", "Option")
S3method("print", "Option")
S3method("summary", "Option")
S3method("plot", "Bond")
S3method("print", "Bond")
S3method("summary", "Bond")
If I try to specify the path where the Terminal wrote that it installed RQuantLib while requiring it I get the following error:
> require('RQuantLib', lib.loc = "C:/Users/dealmer/Library/R/3.1/library/RQuantLib/libs")
Loading required package: RQuantLib
Warning message:
In library(package, lib.loc = lib.loc, character.only = TRUE, logical.return = TRUE, :
no library trees found in 'lib.loc'
So, do I need to move something from there to where the other R libraries are? (There is already a folder named "RQuantLib" in the folder where the other R library folders are, that's where I found the NAMESPACE doc for example) The path that the Terminal gave me I can't follow in the Finder window however because it doesn't show the "Library" folder and I don't know how to make it do that.)
This is what .libPaths() gives me:
> .libPaths()
[1] "/Users/dealmer/Library/R/3.1/library"
[2] "/Library/Frameworks/R.framework/Versions/3.1/Resources/library"
The R libraries are in [2].
I've tried googling but I can't find anything that seems helpful. Any help will be very appreciated. Thank you
- Dom
I think the issue is that on Linux we have quantlib-config in the $PATH:
edd#max:~$ quantlib-config --help
Usage: quantlib-config [--prefix[=DIR]] [--exec-prefix[=DIR]] [--version] \
[--libs] [--cflags]
edd#max:~$ quantlib-config --version
1.4
edd#max:~$
I don't own an OS X box, so I depend on someone like you help with a better configure setup. It should just work if you copy (or soft-link) quantlib-config into your path (eg /usr/local/bin), or adjust $PATH otherwise to include the directory it is in.
I had the same issue and after some hours of struggle I manage to use something not very rigorous but it works!
It seems that R has some issues evaluating system("bash -c 'type -p quantlib-config'").
After having installed QuantLib, typing the command bash -c 'type -p quantlib-config' in Terminal gives us the path of our quantlib-config which is for me /opt/local/bin/quantlib-config.
So I went back to my source folder for RQuantLib (version 0.4.0) and replaced qc in file R/inline.Rby:
qc <- as.character("/opt/local/bin/quantlib-config")
and rebuilt the package using the terminal command R CMD install RQuantLib/.
As I said, not very sexy but it works.
A restart of R and Rstudio is necessary.
Hope it helps!

Resources