当前位置:网站首页>1 - vector R language self-study
1 - vector R language self-study
2022-08-03 01:04:00 【JW0601】
R - 向量
RThe basic information unit of language is called vector(vector).There are different types of vector,包括数值向量(numeric)、整数向量(integer)、The text vector(character)、Boolean value vector(logical)、日期向量(Date)与Date/time vector(POSIXct).
1. 创建向量
用 <- Will be assigned to different types of data objects can create length as1的向量.使用函数class() Can know what type of objects is vector.
Create the length is more than1的向量
利用c()函数,The pen more information comma-separated placed into a thing of.
Generates repeat data vector
利用rep()函数,其中timesParameters can be specified in the vector to several duplicate values.
2. 数值向量
可以使用seq()函数或 : Which is based on symbols regularity value vector.
from指定起始值,toSpecify termination,bySpecify the numerical spacing.
Generate numerical spacing for1的数值向量.
No matter the input Numbers with or without decimal digits,RLanguage preset stored in numeric vector.
3. 整数向量
Enter an integer, and add capital English lettersLAs a note,RLanguage will be stored as an integer vector.
If the decimal digits with unnecessary zero,RLanguage will still be stored as an integer vector.
If the decimal digits with necessary zero,RLanguage will be stored as numeric vector.
数学运算
+、-、、/:加减乘除
^ 或 **:次方
%/%:Returns the quotient
%%:Back the remainder
4. The text vector
使用单引号 ’ ’ 或 双引号 " " Establish a text vector.
When in single quotes and single quotes,Or double quotation marks and the double quotes,You can use a jump backslash characters \ .
Embedded in the text vector has been declared a good vector
利用 sprintf() 函数,以 %s The text vector,以 %f As a numeric vector.
5. Boolean value vector
Boolean value vector is TRUE 与 FALSE 两个值,也可以简写成T和F.
R语言是 case-sensitive 的,True或者true不等于TRUE.
逻辑运算符号
- ==、!= :Is and is not equal to
- >、 >=、 <、 <= :大于、大于等于、小于、小于等于
- %in%:包含于
- !:非
TRUE跟数值1相等;FALSE跟数值0相等.
边栏推荐
猜你喜欢
matplotlib绘图的核心原理讲解(超详细)
在软件测试行业近20年的我,再来和大家谈谈今日的软件测试
[TypeScript] Deep Learning of TypeScript Classes (Part 1)
ML之PDP:基于titanic泰坦尼克是否获救二分类预测数据集利用PDP部分依赖图对RF随机森林和LightGBM模型实现可解释性案例
Shunted Self-Attention via Multi-Scale Token Aggregation
kubernetes pod podsecurityPolicies(PSP)
同样月薪6K,为什么同事跳槽月薪翻倍,而你只涨了1000?
在迁移测试中,源表、中间表、目标表的迁移规则
VMware workstation 程序启动慢
Jmeter二次开发实现rsa加密
随机推荐
搭建直播平台,使用node生成验证码图片,并进行验证
APT级全面免杀拿Shell
CS5213 chip | HDMI to VGA converter chip data sharing
你离「TDengine 开发者大会」只差一条 SQL 语句!
【TypeScript】深入学习TypeScript类(上)
go 反射 reflect 包
最近公共祖先(LCA)学习笔记 | P3379 【模板】最近公共祖先(LCA)题解
ssm整合(三)Controller 和 视图层编写
CentOS7 安装MySQL 图文详细教程
刚安装完win10专业工作站版,系统变量中Path默认值有哪些?重新建一个“PATH”变量名,会覆盖掉原先的“Path”。
Software testing pen questions 1 (with answers)
mysql根据多字段分组——group by带两个或多个参数
目前为止 DAO靠什么盈利?
多租户的多种实现方案
Shunted Self-Attention via Multi-Scale Token Aggregation
qt静态编译出现Project ERROR: Library ‘odbc‘ is not defined
MYSQL查看表结构
采用QT进行OpenGL开发(三)着色器编程
Sentinel vs Hystrix 限流对比,到底怎么选?
CKA、CKAD、CKS、KCNA、CFCD考试