r语言 分类变量 虚拟变量_R语言中的变量

r语言 分类变量 虚拟变量

R语言| 变数 (R Language | Variables)

In the previous tutorial, we have come across the basic information that stands as a pavement for understanding the R language in depth. Now moving future let us educate ourselves about the concept of Variables that are used in the R language.

在上一教程中,我们了解了一些基本信息,它们是深入理解R语言的基础。 现在,展望未来,让我们对R语言中使用的变量的概念进行自我教育。

Variables are the storage places in the R language: They stay responsible for creating a memory for storing the data after they are created. The variables are so powerful that if they are changed then the result of the program will change. That means the variables are the components in the R language in which they have the capability of manipulating the program whatever we have written.

变量是R语言的存储位置变量创建后,仍负责创建用于存储数据的内存。 变量是如此强大,以至于如果改变了它们,那么程序的结果将会改变。 这意味着变量是R语言中的组成部分,它们具有操纵我们所编写程序的能力。

变量中存储了什么? (What are stored in a variable?)

Every one of us is acquainted with the fact that the variables in the other programming languages also work on the same principle as that in the R language. In simple terms, we can confess that the variables act like the containers that store the data which is given by the user.

我们每个人都熟悉这样的事实,即其他编程语言中的变量也按照与R语言相同的原理工作。 简单来说,我们可以承认变量的作用类似于存储用户提供的数据的容器。

The variables in the R language are capable enough to store the atomic vector or a group of atomic vectors in them. In addition to that, they can also reserve R objects.

R语言中的变量足以存储原子向量或一组原子向量。 除此之外,它们还可以保留R对象。

Syntax followed to declare a variable in the r language:

遵循语法以r语言声明变量:

A variable name that exists to be valid should consist of numbers, letters, or dots. In addition to that one can also use the underline characters while giving a name to the variable.

存在的有效变量名应该由数字,字母或点组成。 除此以外,还可以在给变量命名的同时使用下划线字符。

But there is a strict rule in the R language which speaks about the concept I how to give a perfect name to the variable as per the conventions provided by the seniors. Whatever the name the user assigns for the variable but the name of the variable must start with a letter which should not be followed by a number. Also one can give a name with a dot at first followed by other letters.

但是R语言中有一个严格的规则,该规则涉及有关如何按照老年人提供的约定为变量赋予完美名称的概念。 用户为变量分配的名称是什么,但变量的名称必须以字母开头,字母后不能跟数字。 也可以先给一个名字加一个点,然后再加上其他字母。

Examples:

例子:

    var_name2 :     valid
var_name% :     invalid
2var_name :     invalid
_variable_name: invalid

变量分配 (Variable Assignment)

The general convention followed for assigning the values to the variables is by making the use of rightward, leftward, or the equal to operator. Furthermore, the value stored in ten variables can be displayed over the screen with the help of the below functions:

将值分配给变量的通用约定是使用向右,向左或等于运算符。 此外,借助以下功能,可以将十个变量中存储的值显示在屏幕上:

  • print()

    打印()

  • cat()

    猫()

The cat() function in the R language plays an important role in the process of combining various items as a part of the same or continuous output in the printing phase.

R语言中的cat()函数在将各种项目组合为打印阶段中相同或连续输出的一部分的过程中起着重要作用。

# Assignment using equal operator.
var.1 = c(0,1,2,3)           
# Assignment using leftward operator.
var.2 <- c("learn","R")   
# Assignment using rightward operator.   
c(TRUE,1) -> var.3           
print(var.1)
cat ("var.1 is ", var.1 ,"\n")
cat ("var.2 is ", var.2 ,"\n")
cat ("var.3 is ", var.3 ,"\n")

The above is the code that represents the concept of assigning the variable in the R language.

上面的代码代表了用R语言分配变量的概念。

Output

输出量

[1] 0 1 2 3
var.1 is  0 1 2 3 
var.2 is  learn R 
var.3 is  1 1

翻译自: https://www.includehelp.com/r/variables-in-the-r-language.aspx

r语言 分类变量 虚拟变量

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/377330.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

算法题复习(快排、链表、二分、哈希、双指针)

目录1、快速排序复习2、链表部分复习203. 移除链表元素707. 设计链表206. 反转链表142.环形链表 II3、二分法复习4、哈希法复习5、双指针复习**15. 三数之和****18. 四数之和****27. 移除元素****344. 反转字符串**,简单&#xff0c;双指针从两侧往中间靠拢&#xff0c;并随时s…

Cassandra1.2文档学习(7)—— 规划集群部署

数据参考&#xff1a;http://www.datastax.com/documentation/cassandra/1.2/webhelp/index.html#cassandra/architecture/architecturePlanningAbout_c.html 当规划一个Cassandra集群部署时&#xff0c;关于你初始存储的数据的数据量你应当有一个好的想法&#xff0c;并且对于…

虚拟机设置NAT

需要开启虚拟机网络相关服务&#xff0c; 安装虚拟网卡&#xff0c; 还有必须安装 VMware ToolsVMware虚拟机下实现NAT方式上网1. 把你的虚拟网卡VMnet8设置为自动获得IP、自动获得DNS服务器&#xff0c;启用。2. 把你虚拟机中操作系统的“本地连接”也设置为自动获得IP、自动获…

窗体震动 C# (不使用Timer控件,控制窗体震动)

private static Point plocation new Point(); public static void StartVibration(Form form)//Form 传入需要振动的窗体 { plocation form.Location; for (int i 1; i < 41; i)//41&#xff0c;可以理解为震动的时间。…

算法题复习(栈与队列、二叉树)

目录栈与队列栈用于匹配的问题队列用于堆二叉树系列深度遍历&#xff0c;递归与迭代层序遍历二叉树属性二叉树修改与构造二叉搜索树公共祖先二叉搜索树的修改与构造栈与队列 栈用于匹配的问题 20. 有效的括号 https://leetcode-cn.com/problems/valid-parentheses/ 不匹配的三…

bpsk_BPSK的完整形式是什么?

bpskBPSK&#xff1a;二进制相移键控 (BPSK: Binary Phase Shift Keying) BPSK is an abbreviation of "Binary Phase Shift Keying". BPSK是“二进制相移键控”的缩写 。 BPSK is also occasionally called phase reversal keying (PRK), or 2PSK, which is the el…

win7 下安装oracle 10g

oracle 10g 在win7下安装&#xff0c;提示程序异常终止&#xff0c;发生未知错误 在网上搜结果&#xff1a; 修改Oracle 10G\database\stage\prereq\db\refhost.xml 在 </SYSTEM> <CERTIFIED_SYSTEMS>后面添加 <!--Microsoft Windows 7--> <OPERAT…

poj 1703 Find them, Catch them

题目链接&#xff1a;http://poj.org/problem?id1703 题目大意&#xff1a;警察抓获N个罪犯&#xff0c;这些罪犯只可能属于两个团伙中的一个&#xff0c;现在给出M个条件&#xff08;D a b表示a和b不在同一团伙&#xff09;&#xff0c;对于每一个询问(A a b)确定a&#xff0…

双向a*搜索算法_双向搜索算法

双向a*搜索算法什么是双音搜索&#xff1f; (What is bitonic search?) Searching a bitonic array is known as bitonic search. An array is said to be bitonic if it has an increasing sequence of integers followed immediately by a decreasing sequence of integers.…

关于LRU缓存简单记录以及代码补全。

目录大概思路时间空间复杂度分析指针操作具体细节代码双向链表设计私有成员变量设计:构造函数和析构函数设计&#xff1a;get与put具体设计双向指针的具体细节添加到头节点函数删除尾节点函数删除节点函数删除节点函数感想今天面试考到LRU&#xff0c;太紧张了&#xff0c;完全…

码农干货系列【4】--图像识别之矩形区域搜索

简介 定位某个图片的矩形区域是非常有用的&#xff0c;这个可以通过手动的选择某个区域来实现定位&#xff0c;图片相关的软件都提供了这个功能&#xff1b;也可以像本篇一个通过程序来实现智能定位。前者会有误差&#xff0c;效率低下&#xff1b;后者选区精度高&#xff0c;效…

算法题复习(回溯)

目录base code棋盘问题51. N 皇后37. 解数独组合问题77. 组合未剪枝优化剪枝优化216. 组合总和 III未剪枝优化剪枝优化17. 电话号码的字母组合39. 组合总和未剪枝优化剪枝优化40. 组合总和 II,挺重要的&#xff0c;涉及到去重了切割问题131. 分割回文串子集问题78. 子集90. 子集…

pfa是什么意思_PFA的完整形式是什么?

pfa是什么意思PFA&#xff1a;预测性故障分析 (PFA: Predictive Failure Analysis) PFA is an abbreviation of Predictive Failure Analysis. It is a technique of a mechanism of the computer that is used to predict impending failures of software or hardware compone…

SqlServer视图(view)

--上节回顾--1.什么是事务--2.事务的特征--原子性、一致性、隔离性、持久性--3.与事务相关的t-sql命令--开启事务&#xff1a;begin transaction--提交事务&#xff1a;commit transaction--回滚事务&#xff1a;rollback transaction ----------------视图-------------------…

Android中的广播Broadcast详解

今天来看一下Android中的广播机制&#xff0c;我们知道广播Broadcast是Android中的四大组件之一&#xff0c;可见他的重要性了&#xff0c;当然它的用途也很大的&#xff0c;比如一些系统的广播&#xff1a;电量低、开机、锁屏等一些操作都会发送一个广播&#xff0c;具体的And…

sql check约束_在SQL中使用CHECK约束

sql check约束Basically, CHECK constraint is used to LIMIT in columns for the range of values. We can use this constraint for single or multiple columns. 基本上&#xff0c; CHECK约束用于限制值范围内的列 。 我们可以将此约束用于单列或多列。 In single column,…

.NET线程池

摘要 深度探索 Microsoft .NET提供的线程池&#xff0c; 揭示什么情况下你需要用线程池以及 .NET框架下的线程池是如何实现的&#xff0c;并告诉你如何去使用线程池。 内容 介绍 .NET中的线程池 线程池中执行的函数 使用定时器 同步对象的执行 异步I/O操作 监视线程池 死锁 有关…

折线分割平面

Input输入数据的第一行是一个整数C,表示测试实例的个数&#xff0c;然后是C 行数据&#xff0c;每行包含一个整数n(0<n<10000),表示折线的数量。Output对于每个测试实例&#xff0c;请输出平面的最大分割数&#xff0c;每个实例的输出占一行。Sample Input2 1 2Sample Ou…

《c++特性》

目录多态构造函数和析构函数存在多态吗&#xff1f;虚函数表虚析构函数纯虚函数和抽象类运行时多态和编译时多态的区别继承设计实例指针对象和普通对象的区别正确初始化派生类方式继承和赋值的兼容规则protected 和 private 继承基类与派生类的指针强制转换如何用C实现C的三大特…

Scala中的while循环

在Scala中的while循环 (while loop in Scala) while loop in Scala is used to run a block of code multiple numbers of time. The number of executions is defined by an entry condition. If this condition is TRUE the code will run otherwise it will not run. Scala中…