- Advanced Analytics with R and Tableau
- Jen Stirrup Ruben Oliva Ramos
- 316字
- 2021-07-02 20:26:04
Core essentials of R programming
One of the reasons for R's success is its use of variables. Variables are used in all aspects of R programming. For example, variables can hold data, strings to access a database, whole models, queries, and test results. Variables are a key part of the modeling process, and their selection has a fundamental impact on the usefulness of the models. Therefore, variables are an important place to start since they are at the heart of R programming.
Variables
In the following section we will deal with the variables—how to create variables and working with variables.
It is very simple to create variables in R, and to save values in them. To create a variable, you simply need to give the variable a name, and assign a value to it.
In many other languages, such as SQL, it's necessary to specify the type of value that the variable will hold. So, for example, if the variable is designed to hold an integer or a string, then this is specified at the point at which the variable is created.
Unlike other programming languages, such as SQL, R does not require that you specify the type of the variable before it is created. Instead, R works out the type for itself, by looking at the data that is assigned to the variable.
In R, we assign variables using an assignment variable, which is a less than sign (<
) followed by a hyphen (-
). Put together, the assignment variable looks like so:
It is important to understand what is contained in the variables. It is easy to check the content of the variables using the ls
command. If you need more details of the variables, then the ls.str
command will provide you with more information.
If you need to remove variables, then you can use the rm
function.
- Learning Neo4j
- 大話PLC(輕松動漫版)
- Go Web編程
- Java Web開發之道
- Learn WebAssembly
- 零基礎學MQL:基于EA的自動化交易編程
- Apache Mesos Essentials
- JavaScript:Moving to ES2015
- Java程序設計
- Learning SciPy for Numerical and Scientific Computing(Second Edition)
- Scala Data Analysis Cookbook
- HTML5權威指南
- Python Interviews
- Hadoop大數據分析技術
- Visual Basic程序設計實驗指導及考試指南