当前位置:网站首页>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相等.
边栏推荐
- 【使用pyside2遇到的问题】This application failed to start because no Qt platform plugin could be initialized.
- Word2Vec词向量训练、使用及可视化操作
- Sentinel vs Hystrix 限流对比,到底怎么选?
- GameStop NFT 市场分析
- group of people
- 同样月薪6K,为什么同事跳槽月薪翻倍,而你只涨了1000?
- CS5213 chip | HDMI to VGA converter chip data sharing
- mysql 错误:The driver has not received any packets from the server.
- redis的学习笔记
- openssl源码下载
猜你喜欢
随机推荐
无代码开发平台表单样式设置步骤入门课程
kubernetes pod podsecurityPolicies(PSP)
反弹shell原理与实现
threejs dynamically adjust the camera position so that the camera can see the object exactly
mysql根据多字段分组——group by带两个或多个参数
“百日行动”进行时:700余交通安全隐患被揪出
R语言自学 1 - 向量
Kubernetes 进阶训练营 网络
基于奇异谱分析法和长短时记忆网络组合模型的滑坡位移预测
我用这一招让团队的开发效率提升了 100%!
严格反馈非线性系统基于事件触发的自抗扰预设有限时间跟踪控制
任务四 机器学习库Scikit-learn
创建型模式 - 简单工厂模式StaticFactoryMethod
【TypeScript】深入学习TypeScript类(下)
go exec 包
threejs 动态调整相机位置,使相机正好能看到对象
ML之PDP:基于titanic泰坦尼克是否获救二分类预测数据集利用PDP部分依赖图对RF随机森林和LightGBM模型实现可解释性案例
MySQL 用id分库使用name查询
B站回应HR称用户是Loser:涉事面试官去年底已被劝退
你离「TDengine 开发者大会」只差一条 SQL 语句!