当前位置:网站首页>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相等.
边栏推荐
- 成功解决TypeError: can‘t multiply sequence by non-int of type ‘float‘
- Towards a General Purpose CNN for Long Range Dependencies in ND
- 同样月薪6K,为什么同事跳槽月薪翻倍,而你只涨了1000?
- CKA、CKAD、CKS、KCNA、CFCD考试
- 创建型模式 - 简单工厂模式StaticFactoryMethod
- 【TypeScript】深入学习TypeScript类(上)
- 任务四 机器学习库Scikit-learn
- 【C语言】带头双向循环链表(list)详解(定义、增、删、查、改)
- 在迁移测试中,源表、中间表、目标表的迁移规则
- How many ways do you know the singleton pattern?
猜你喜欢
随机推荐
CS5213 chip | HDMI to VGA converter chip data sharing
msys2下载地址
Learn more TypeScript 】 【 TypeScript modular
WebShell 木马免杀过WAF
牛客每日刷题之链表
牛客刷题:数组排序
The CTF command execution subject their thinking
Ruoyi integrates minio to realize distributed file storage
threejs dynamically adjust the camera position so that the camera can see the object exactly
同样月薪6K,为什么同事跳槽月薪翻倍,而你只涨了1000?
虚拟内存 virualmemory
CKA、CKAD、CKS、KCNA、CFCD考试
七夕到了——属于程序员的浪漫
学习Autodock分子对接
【Unity】Unity开发进阶(七)双刃剑:扩展方法
测试ESP32-Zigbee转发命令 : 滑轨、继电器控制
Finally understand: With threads, why do we need coroutines?
【TypeScript】深入学习TypeScript模块化
如何通过开源数据库管理工具 DBeaver 连接 TDengine
若依如何实现添加水印功能








