当前位置:网站首页>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相等.
边栏推荐
猜你喜欢
【TypeScript】深入学习TypeScript类(下)
多租户的多种实现方案
Finally understand: With threads, why do we need coroutines?
采用QT进行OpenGL开发(三)着色器编程
Week 7 CNN Architectures - LeNet-5、AlexNet、VGGNet、GoogLeNet、ResNet
Kubernetes 进阶训练营 网络
目前为止 DAO靠什么盈利?
If the watermark according to how to realize the function
四、字符常量 & 字符串
用大白话解释“什么是ERP?” 看完这篇就全明白了
随机推荐
Finally understand: With threads, why do we need coroutines?
qt静态编译出现Project ERROR: Library ‘odbc‘ is not defined
kubernetes pod podsecurityPolicies(PSP)
IDO代币预售合约系统开发技术详细
执子手,到永恒
最近公共祖先(LCA)学习笔记 | P3379 【模板】最近公共祖先(LCA)题解
不堪哥哥殴打谩骂,妹妹申请人身安全保护令获支持
Learn more TypeScript 】 【 TypeScript modular
最新真实软件测试面试题分享,收藏了还怕进入不了大厂?
CodeTON Round 2 A - D
【C语言】带头双向循环链表(list)详解(定义、增、删、查、改)
搭建直播平台,使用node生成验证码图片,并进行验证
CTF命令执行题目解题思路
How to seize the new trend of NFT, yuan|universe|universe?
从月薪10k到30k的必走之路:自动化测试
gdb调试简要总结
如何通过开源数据库管理工具 DBeaver 连接 TDengine
Towards a General Purpose CNN for Long Range Dependencies in ND
mysql查询表中重复记录
today‘s task