一.安装R
1.Ctrl+Alt+T打开终端;
2.sudo gedit /etc/apt/sources.list 添加软件源;
3.将如下软件源:
deb http://mirrors.xmu.edu.cn/CRAN/bin/linux/ubuntu xenial/
添加到文件最后。如下:
## Uncomment the following two lines to add software from Canonical's
## 'partner' repository.
## This software is not part of Ubuntu, but is offered by Canonical and the
## respective vendors as a service to Ubuntu users.
deb http://archive.canonical.com/ubuntu utopic partner
# deb-src http://archive.canonical.com/ubuntu utopic partner
deb http://security.ubuntu.com/ubuntu/ vivid-security multiverse universe restricted main
deb http://mirrors.xmu.edu.cn/CRAN/bin/linux/ubuntu xenial/
实际上,可选择不同镜像网站和文件夹名称,链接放在这,自己按着修改就行。
4.更新软件源:sudo apt-get update;
5.安装软件:sudo apt-get install r-base r-base-dev;
6.在终端下输入R即可运行。
二.安装RStudio
1.打开链接地址:https://www.rstudio.com/products/rstudio/download/
2.选择对应版本下载;
3.弹出界面,直接选择open with Ubuntu Software Center,直接安装;
4.等待安装完成;
5.安装完成后,终端输入rstudio打开程序;
三.建立RStudio桌面图标
1.桌面新建一个文件;
2.复制下面内容到文件中;
[Desktop Entry]
Categories=Development;
Comment[zh_CN]=
Comment=
Exec=/usr/lib/rstudio/bin/rstudio
GenericName[zh_CN]=IDE
GenericName=IDE
Icon=/usr/lib/rstudio/rstudio.png
MimeType=
Name[zh_CN]=RStudio
Name=RStudio
Path=
StartupNotify=true
Terminal=false
Type=Application
X-DBUS-ServiceName=
X-DBUS-StartupType=
X-KDE-SubstituteUID=false
X-KDE-Username=hoyochen
3.其中,可能需要修改的内容,包括Exec,Icon,两个Name,X-KDE-Username属性;这个方法可以通用建立其他程序桌面图标,只要修改这些属性;
4.将文件名改为RStudio.desktop
5.右键文件属性,修改文件权限,勾选允许作为程序执行文件;
6.双击运行程序。