r语言和rstudio_R和RStudio简介

r语言和rstudio

With increased computing power comes increased access to large amounts of freely accessible data. People are tracking their lives with productivity, calorie, fitness and sleep trackers. Governments are publishing survey data left and right, and companies conduct audience testing that needs analyzing. There’s a lot of data out there even now, ready to be grabbed and looked at.

随着计算能力的提高,对大量免费访问的数据的访问也越来越多。 人们通过生产力,卡路里,健身和睡眠追踪器来追踪生活。 政府正在左右发布调查数据,公司进行需要分析的受众测试。 即使到现在, 仍然有很多数据可供读取和查看。

Graphs and Analytics

In this tutorial, we’ll look at the basics of the R programming language – a language built solely for statistical computing. I won’t bore you with Wikipedia definitions – instead, let’s dive right into it. In this introduction, we’ll cover the installation of the default IDE and language, and its data types.

在本教程中,我们将研究R编程语言的基础-R编程语言是专门为统计计算而构建的。 我不会对Wikipedia的定义感到厌烦–相反,让我们直接研究它。 在本简介中,我们将介绍默认IDE和语言及其数据类型的安装。

正在安装 (Installing)

R is both a programming language and a software environment, which means it’s fully self-contained. There are two steps to getting it installed:

R既是一种编程语言,又是一种软件环境,这意味着它是完全独立的。 有两个安装步骤:

Both are free, both open source. R will be installed as the underlying engine that powers RStudio’s computations, while RStudio will provide sample data, command autocompletion, help files, and an effective interface for getting things done quickly. You could write R code in simple text files as in most other languages, but that’s really not recommended given how many commands there are and how complex things can quickly get.

两者都是免费的,都是开源的。 R将被安装为支持RStudio计算的基础引擎,而RStudio将提供示例数据,命令自动完成,帮助文件以及有效地完成任务的有效界面。 您可以像使用其他大多数语言一样,在简单的文本文件中编写R代码,但实际上不建议这样做,因为有多少个命令以及可以快速获得复杂的东西。

After you’ve installed the tools, launch R Studio.

安装工具后,启动R Studio。

IDE领域 (IDE Areas)

Let’s briefly explain the GUI. There are four main parts. I’ll explain the default order, though note that this can be changed in Settings/Preferences -> Pane Layout.

让我们简要解释一下GUI。 有四个主要部分。 我将说明默认顺序,不过请注意,可以在“设置/首选项”->“窗格布局”中更改此默认顺序。

编辑 (The Editor)

The top left quadrant is the editor. It’s where you write R code you want to keep for later – functions, classes, packages, etc. This is, for all intents and purposes, identical to every other code editor’s main window. Apart from some self-explanatory buttons, and others that needn’t concern you at this starting point, there is also a “Source on Save” checkbox. This means “Load contents of file into my console’s runtime every time I save the file”. You should have this on at all times, it makes your development flow faster by one click.

左上象限是编辑器。 在这里您可以编写要保留的R代码-函数,类,程序包等。就所有目的和目的而言,这与其他代码编辑器的主窗口相同。 除了一些不言自明的按钮,以及在此开始时不需要您关注的其他按钮之外,还有一个“保存时来源”复选框。 这意味着“每次保存文件时,都将文件内容加载到控制台的运行时中”。 您应该始终启用它,一键即可加快您的开发流程。

控制台 (The Console)

The lower left quadrant is the console. It’s a REPL for R in which you can test out your ideas, datasets, filters, and functions. This is where you’ll be spending most of your time in the beginning – it’s here that you verify an idea you had works before copying it over into the editor above. This is also the environment into which your R files will be sourced on Save (see above), so whenever you develop a new function in an R file above, it automatically becomes available in this REPL. We’ll be spending a lot of time in the REPL in the remainder of this article.

左下象限是控制台。 这是R的REPL ,您可以在其中测试您的想法,数据集,过滤器和函数。 这是您一开始将花费大部分时间的地方–在这里,您可以验证自己的想法,然后再将其复制到上面的编辑器中。 这也是R文件将在Save上获取源的环境(请参见上文),因此,每当您在上面的R文件中开发新功能时,此功能就会自动在此REPL中可用。 在本文的其余部分中,我们将在REPL上花费大量时间。

历史/环境 (History / Environment)

The top right quadrant has two tabs: environment and history.

右上象限有两个选项卡:环境和历史记录。

Environment refers to the console environment (see above) and will list, in detail, every single symbol you defined in the console (whether via sourcing or directly). That is, if you have a function available in the REPL, it will be listed in the environment. If you have a variable, or a dataset, it will be listed there. This is where you can also import custom datasets manually and make them instantly available in the console, if you don’t feel like typing out the commands to do so. You can also inspect the environment of other packages you installed and loaded (more on packages at a later time). Play around with it – you can’t break anything.

环境是指控制台环境(请参见上文),将详细列出您在控制台中定义的每个符号(无论是通过采购还是直接)。 也就是说,如果您在REPL中具有可用的功能,它将在环境中列出。 如果您有变量或数据集,它将在此处列出。 如果您不想键入命令,也可以在此处手动导入自定义数据集,并使它们在控制台中立即可用。 您还可以检查已安装和加载的其他软件包的环境(稍后会介绍更多有关软件包的信息)。 试一试–您不会破坏任何东西。

History lists every single console command you executed since the last project started. It is saved into a hidden .Rhistory file in your project’s folder. If you don’t choose to save your environment after a session, the history won’t be saved.

历史记录列出了自上一个项目启动以来您执行的每个控制台命令。 它被保存到项目文件夹中的隐藏.Rhistory文件中。 如果您没有选择在会话后保存环境,则不会保存历史记录。

杂项 (Misc)

The bottom right panel is the misc panel, and contains five separate tabs. The first one, Files, is self-explanatory. The Plots tab will contain the graphs you generated with R. It is th

  • 4
    点赞
  • 15
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值