how to install rstan in ubuntu 18.04 - r

I'm trying to instal the rstan in Ubuntu 18.04. I started with
apt-get install r-cran-rstan
and it showed dependence on the packages : r-cran-ggplot2 , r-cran-pkgbuild and r-cran-v8.
Then while trying to install all of them, another dependence on r-api-3.5, which I tried to install with
apt-get install r-api-3.5
Then I saw the following message :
The r-api-3.5 package is a virtual package provided by: r-base-core
3.6.3-1bionic [Not a candidate version]
E: The 'r-api-3.5' package has no candidate for installation
I read some tutorials like this one: Not able to install rstanarm on Ubuntu 18.04 LTS saying I should add the ppa by doing :
sudo add-apt-repository -y "ppa:marutter/rrutter"
sudo add-apt-repository -y "ppa:marutter/c2d4u3.5"
sudo apt update
sudo apt install r-cran-rstanarm
and I did. But it's still not working. My R version is the latest one. I didn't find documentation about r-api-3.5 in Ubuntu. If anyone knows how to solve it, please tell me.

I ran into the same issue and my colleague as well.
We just jumped directly to the install and it worked fine.
In short:
remove.packages("rstan")
if (file.exists(".RData"))
file.remove(".RData")
install.packages("rstan", repos = "https://cloud.r-project.org/", dependencies = TRUE)
library(rstan)
example(stan_model,run.dontrun = TRUE)
Source and more detailed explanation: https://github.com/stan-dev/rstan/wiki/RStan-Getting-Started#installation-of-rstan

Related

Not able to install tm package in R Studio in Fedora-25

I am getting this error and i have tried every other solution related to this given on stackoverflow but still not able to install the package.Please suggest a solution.And how can i install any R package using source on linux?
You can try the following:
In shell:
sudo yum install -y epel-release
sudo yum install glibc-common
sudo yum install -y rpm-build make wget tar libxml2-devel
In R:
install.packages('xml2')
Instructions are adapted from https://github.com/opencpu/opencpu-server/tree/master/rpm#readme
Please let me know if it works.

R - How to install "PKI" library in Ubuntu

I tried to install PKI library but got this error
ERROR: compilation failed for package ‘PKI’
when I already installed "openssl" and update package index
sudo apt-get update
sudo apt-get install libssl-dev
What else can I do to help install "PKI" library in R.
Thank you.

Installing rgl and rgdal packages in R 3.3.2 on Ubuntu 16.10

I'm using R 3.3.2 and Ubuntu 16.10. I'm unable to install rgl and rgdal packages.
When I use
install.packages("rgl")
gives the following error message:
configure: error: X11 not found but required, configure aborted.
ERROR: configuration failed for package ‘rgl’
When I use
install.packages("rgdal")
gives the following error message:
configure: error: gdal-config not found or not executable.
ERROR: configuration failed for package ‘rgdal’
Edited
When I use
sudo apt-get install r-cran-rgl
in Ubuntu Terminal, it says
r-cran-rgl is already the newest version (0.95.1441-2)
However, the latest version of rgl is 0.96.0.
When I use
sudo apt-get install libgdal-dev libgeos++-dev
it throws the following error:
The following packages have unmet dependencies:
libgdal-dev : Depends: libopenjp2-7-dev but it is not going to be installed
I found a solution that was useful for me here: http://robinlovelace.net/r/2013/11/26/installing-rgdal-on-ubuntu.html.
In short, the solution would be this tree command lines:
sudo apt-get install aptitude # install aptitude as an alternative to apt-get
sudo aptitude install libgdal-dev # install the package (you may have to respond to queries here)
sudo aptitude install libproj-dev # install the proj.4 projection library
For rgl, just do sudo apt-get install r-cran-rgl.
For rgdal, follow the recommendation of the spatial folks eg here for sf and do this
add ubuntugis-unstable to the package repositories (e.g. with sudo add-apt-repository ppa:ubuntugis/ubuntugis-unstable and then sudo apt-get install libgdal-dev libgeos++-dev)
For general 'R on Ubuntu or Debian' questions, go to the r-sig-debian list.
Edit: Note that you don't need need ubuntugis-unstable repo if the current/older libgdal, libproj4 versions are good enough for you. Those are in the Ubuntu distro so just do sudo apt-get install ....
These installations worked for me provided that, in addition, I installed libxerces-c28. The need for the related shared object was indicated in the error log the first time I tried, after doing the installations indicated (libgdal, libgdal-dev, etc)

Errors while installing Rstudio

I am trying to install Rstudio. I have downloaded the rstudio-0.98.1103-deb package.
This is the error I am getting when I do:
sudo dpkg -i rstudio-0.98.1103-amd64.deb
How do I go about the installation? Any suggestions would be great. I am on Ubuntu 14.04.
Package libjpeg62 is not installed.
You can get it by typing this in Terminal:
sudo apt-get install libjpeg62
It tells you pretty clearly that you libjpeg62.
So do sudo apt-get install libjpeg62 and then reinstall RStudio.

Install particular version(2.15.2) of r-base on ubuntu

I am newbie to both Ubuntu and R.
I am trying to install R 2.15.2 on ubuntu. Since the latest version of R is 3.0.X, I specified the version in /etc/apt/sources.list
deb http://cran.ma.imperial.ac.uk/bin/linux/ubuntu precise 2.15.2
Then I ran sudo apt-get install r-base.
It installs, but when I check version, it is 2.14.1, not 2.15.2
I tried to specify version in command line, such as:
sudo apt-get install r-base_2.15.2_1precision1
Always seeing:
E: Unable to locate package r-base_2.15.2_1precision1.
E: Couldn't find any package by regex 'r-base_2.15.2_1precision1'
Any suggestion? Thanks.
If I run command:
sudo apt-get install r-base=2.15.2-1precise0
See the following message:
The following packages have unmet dependencies:
r-base : Depends: r-recommended (= 2.15.2-1precise0) but 3.0.1-1precise0precise2 is to be installed
Recommends: r-base-html but it is not going to be installed
Find the solution.
I need to install like:
sudo apt-get install r-base-core=2.15.3-1precise0precise1
sudo apt-get install r-recommended=2.15.3-1precise0precise1
sudo apt-get install r-doc-html=2.15.3-1precise0precise1
sudo apt-get install r-base=2.15.3-1precise0precise1
Okay so the URL for where the packages are found has changed :^) on the cran.ma site:
Change the debian url to:
deb http://cran.ma.imperial.ac.uk/bin/linux/ubuntu precise/
do an apt-get update and try reinstalling
The complete instructions are on:
http://cran.ma.imperial.ac.uk/bin/linux/ubuntu/

Resources