当前位置:网站首页>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相等.
边栏推荐
- 牛客刷题:手动实现数组filter方法
- CentOS7 安装MySQL 图文详细教程
- 多租户的多种实现方案
- Broadcast platform, the use of the node generated captcha image, and validate
- Ruoyi integrates minio to realize distributed file storage
- Sentinel vs Hystrix 限流对比,到底怎么选?
- 刚安装完win10专业工作站版,系统变量中Path默认值有哪些?重新建一个“PATH”变量名,会覆盖掉原先的“Path”。
- Interviewer: can you talk about optimistic locking and pessimistic locks
- ssm整合(三)Controller 和 视图层编写
- 了解 NFT 质押:Web3 中赚取被动收益的另一种方式
猜你喜欢
随机推荐
创建型模式 - 单例模式Singleton
MySql查询某个时间段内的数据(前一周、前三个月、前一年等)
Learn more TypeScript 】 【 TypeScript modular
Kubernetes 进阶训练营 网络
软件测试笔试题1(附答案)
MYSQL查看表结构
mysql 错误:The driver has not received any packets from the server.
kubernetes pod podsecurityPolicies(PSP)
go rand 包
牛客每日刷题之链表
go exec 包
「X」to「Earn」:赛道现状与破局思路
JS Date 时间戳 getTune data.parse 倒计时小程序
TDengine 在中天钢铁 GPS、 AIS 调度中的落地
Mysql查看慢查询日志
Ruoyi integrates minio to realize distributed file storage
目前为止 DAO靠什么盈利?
If the watermark according to how to realize the function
go os 包
【使用pyside2遇到的问题】This application failed to start because no Qt platform plugin could be initialized.