当前位置:网站首页>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相等.
边栏推荐
猜你喜欢
随机推荐
MySQL 与InnoDB 下的锁做朋友 (四)行锁/记录锁
CTF命令执行题目解题思路
测试ESP32-Zigbee转发命令 : 滑轨、继电器控制
FastCorrect:语音识别快速纠错模型丨RTC Dev Meetup
如何通过开源数据库管理工具 DBeaver 连接 TDengine
基于奇异谱分析法和长短时记忆网络组合模型的滑坡位移预测
学习基因富集工具DAVID(3)
Word2Vec词向量训练、使用及可视化操作
vscode 自定义快捷键——设置eslint
Image recognition from zero to write DNF script key points
Broadcast platform, the use of the node generated captcha image, and validate
【学习笔记】博弈论
创建型模式 - 单例模式Singleton
第十章 时序与延迟
软件测试笔试题1(附答案)
H.265视频流媒体播放器EasyPlayer.js集成时出现“SourceBuffer ”报错,该如何解决?
如何通过 IDEA 数据库管理工具连接 TDengine?
go os 包
技术分享 | 接口自动化测试中如何对xml 格式做断言验证?
虚拟内存 virualmemory








![[论文总结] 深度学习在农业领域应用论文笔记10](/img/e8/0ba741980495cd81ca30bf269d1111.jpg)
