1200字范文,内容丰富有趣,写作的好帮手!
1200字范文 > mac安装rstudio_在Windows / Linux / Mac OS上安装R和RStudio入门

mac安装rstudio_在Windows / Linux / Mac OS上安装R和RStudio入门

时间:2022-03-28 10:42:58

相关推荐

mac安装rstudio_在Windows / Linux / Mac OS上安装R和RStudio入门

mac安装rstudio

在Windows上安装R (Installing R on Windows)

Go to r- on your internet browser.在您的Internet浏览器上转到r- 。 Select download R link in the Getting Started section of the page which takes you to a list of CRAN (Comprehensive R Archive Network) mirrors list.在页面的“入门”部分中选择下载R链接,该链接将带您到CRAN(综合R存档网络)镜像列表的列表。

Cran Mirrors
颅镜

Select any mirror site of your installation. Here we have selected the 0-cloud site for installation.选择安装的任何镜像站点。 在这里,我们选择了0-cloud站点进行安装。 Now select R for Windows in the list given in the mirror site.现在,在镜像站点给定的列表中为Windows选择R。

Cran Windows Installation
Cran Windows安装

From the given options, selectbase(which installs all the base packages), corresponding toinstall R for the first time.从给定的选项中,选择base(将安装所有基本软件包),第一次对应于R。Download the binary file.下载二进制文件。 The current version is R-3.6.2 for Windows and the size of the installation is about 83MB.对于Windows,当前版本为R-3.6.2,安装大小约为83MB。

Windows R Installation
Windows R安装

The file will now download as an executable.该文件现在将作为可执行文件下载。 Run the installation and go through the setup wizard.运行安装并通过安装向导。 The installation should be done in a few minutes.安装应在几分钟内完成。 Now, you will be able to run R by selecting it from the start menu.现在,您可以通过从开始菜单中选择R来运行它。

R Console Windows
R Console Windows

在Linux / Ubuntu上安装R (Installing R on Linux/Ubuntu)

Installing R can be done in a similar way as above for Ubuntu. But it can easily get confusing as there are several options available to select.R的安装可以通过与Ubuntu相同的方式完成。 但是,由于有多个可供选择的选项,因此很容易引起混淆。 Instead, to do a basic installation on your Ubuntu machine, go to the terminal and run the commandsudo apt install r-baseto proceed with the base package installation.相反,要在Ubuntu机器上进行基本安装,请转到终端并运行命令sudo apt install r-base继续进行基本软件包安装。 You will be notified of all the packages about to be installed. Type in Y to continue with the installation.您将收到所有即将安装的软件包的通知。 输入Y继续安装。 You can start running the R environment from your terminal usingsudo -i Rcommand.您可以使用sudo -i R命令从终端开始运行R环境。

R Command-line Ubuntu
R命令行Ubuntu

This is the most straightforward way to run R. However, beginners benefit a lot from using an IDE like RStudio for their initial foray into R programming. The following section helps you get started with RStudio as well.

这是运行R的最直接的方法。但是,初学者从使用RStudio之类的IDE进行R编程的初衷中受益匪浅。 以下部分还可以帮助您开始使用RStudio。

在Mac OS上安装R (Installing R on Mac OS)

Go to the https://www.r-/ and click on the “download R” link. It will open the CRAN mirrors page.转到https://www.r-/并单击“download R”链接。 它将打开CRAN镜像页面。 Select any mirror from the list. I would suggest you select the nearest one from your location for faster download.从列表中选择任何镜像。 我建议您从您的位置选择最近的一个,以加快下载速度。 In the mirror page, click on theDownload R for (Mac) OS Xlink.在镜像页面中,单击Download R for(Mac)OS X链接。 Download the latest release package, which is R-3.6.2.pkg as of writing this guide.撰写本指南时,请下载最新的发行包,即R-3.6.2.pkg 。 Open the downloaded R package installer file. It will run the installer and you should see the below window.打开下载的R软件包安装程序文件。 它将运行安装程序,您将看到以下窗口。

R Mac Package Installer
R Mac软件包安装程序

Press the “Continue” button. The installation is straight-forward as there are no options to select. Once the installation is finished, you should see the below window for the successful installation message.按下“继续”按钮。 安装简单明了,因为没有可供选择的选项。 安装完成后,您将看到以下窗口,显示成功安装消息。

R Mac Installed Successfully
R Mac已成功安装

验证Mac OS上的R安装 (Validating R installation on Mac OS)

We can validate the R installation through the command-line by running the following commands.

我们可以通过运行以下命令,通过命令行来验证R的安装。

R --versionRscript --version

It should show the version of R that we have just installed.

它应该显示我们刚刚安装的R的版本。

R Version Command
R版本命令

Another way to verify the installation is to run the R app from the applications directory. It will open the “R Console” to run R applications.

验证安装的另一种方法是从Applications目录运行R app。 它将打开“ R Console”以运行R应用程序。

R Console App
R Console应用

RStudio入门 (Getting started with RStudio)

RStudio is a commercially developed IDE (Integrated Development Environment) for R. Unlike the traditional R console we installed above, RStudio provides syntax highlighting for easy debugging, space for displaying your graphical plots and history of commands for easy debugging and workspace management.

RStudio是用于R的商业开发的IDE(集成开发环境)。与上面安装的传统R控制台不同,RStudio提供了语法突出显示功能,以便于调试,显示空间用于显示图形化图和命令历史记录,以便于调试和工作区管理。

RStudio comes inDesktopandServerversions. The desktop version is free and it is enough to get you started with R.

RStudio具有桌面服务器版本。 桌面版本是免费的,足以让您开始使用R。

Once you select the Download option for RStudio Desktop from here, you will be automatically redirected to a page with download links all OS types. The installation is straightforward from there.

从此处选择RStudio桌面的“下载”选项后,您将自动重定向到包含所有操作系统类型的下载链接的页面。 从那里可以直接进行安装。

Once you install and run RStudio, you will get a window like this. This is your RStudio console.

一旦安装并运行RStudio,您将获得一个类似的窗口。 这是您的RStudio控制台。

RStudio Environment
RStudio环境

As you play around, you will see that the RStudio window has the following components. Each of them has different functionality.

在您玩转时,您会看到RStudio窗口具有以下组件。 它们每个都有不同的功能。

The command console– This is where you type and execute your commands. Try giving a small arithmetic command in the console like 5 + 5 and then press Enter to see the result displayed on the command-line itself.命令控制台–您可以在其中键入和执行命令。 尝试在控制台中输入一个小的算术命令(例如5 + 5),然后按Enter键以查看命令行本身显示的结果。The script editor– Most of our R programs will be a collection of commands rather than a single command. Rather than clumsily entering the commands one by one in the command console, we prefer to store and load them as a script. This is where the script editor helps us. The script editor is usually invisible when you first run RStudio and can be activated by selectingFile– >New File->R Scriptfrom the top menu.脚本编辑器–我们的大多数R程序都是命令的集合,而不是单个命令。 与其笨拙地在命令控制台中一个个地输入命令,我们不如将它们存储并加载为脚本。 这是脚本编辑器帮助我们的地方。 首次运行RStudio时,脚本编辑器通常是不可见的,可以通过从顶部菜单中选择“文件”->“新建文件”->“R脚本”来激活。 The scripts can be run using the Run button on top of the script editor panel. The results get displayed on the console.可以使用脚本编辑器面板顶部的“运行”按钮来运行脚本。 结果显示在控制台上。The environment panel– This is located on the top-right of the RStudio window. This is where you can monitor all the active variables in the present environment.环境面板–位于RStudio窗口的右上方。 您可以在此处监视当前环境中的所有活动变量。The history panel– This panel, located right next to the environment panel, shows the history of all the commands run till now. It makes your job easy when you want to rerun commands.历史记录面板–该面板位于环境面板的旁边,显示了迄今为止运行的所有命令的历史记录。 当您想重新运行命令时,它使您的工作变得容易。The files panel– This can be seen at the bottom right region of the window. This shows all the files in the current directory. You can monitor the needed datasets from this panel.文件面板–可以在窗口的右下方区域中看到。 这将显示当前目录中的所有文件。 您可以从此面板监视所需的数据集。The plots panel– This lies beside the files panel and displays your graphs when you execute the corresponding command.图面板–位于文件面板旁边,并在执行相应命令时显示图形。The packages panel– As the name indicates, it gives a list of active packages in your environment.软件包面板–顾名思义,它提供了您环境中活动软件包的列表。The help panel– This panel displays searchable help topics about your selected packages and public datasets.帮助面板–此面板显示有关所选软件包和公共数据集的可搜索帮助主题。

This is enough to get you started with RStudio for now. We will learn additional features as we move forward with the tutorial series.

这足以使您立即开始使用RStudio。 随着教程系列的发展,我们将学习其他功能。

翻译自: /34294/installing-r-rstudio-windows-linux-mac-os

mac安装rstudio

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。