当前位置:网站首页>Extract field year / quarter effect based on date
Extract field year / quarter effect based on date
2022-06-27 16:25:00 【Analysis of breeding data】
1, The right person
By year - month - Japan , It's a year + season
- According to the year of the date , It's a year
- According to the month of the date , Extraction season
- Combine the two
2. Example
> head(test)
ID Ceding_dat
1 1 2015-07-10
2 2 2015-07-10
3 3 2015-08-12
4 4 2016-02-28
5 5 2016-04-26
6 6 2016-04-26
- 1.
- 2.
- 3.
- 4.
- 5.
- 6.
- 7.
- 8.
Data pair Ceding_dat, Extract year and season :
How to extract seasons , month , Use lubridate package :
test$CNJ = paste0(year(test$Ceding_dat),quarter(test$Ceding_dat))
head(test)
- 1.
- 2.
result :
> head(test)
ID Ceding_dat CNJ
1 1 2015-07-10 20153
2 2 2015-07-10 20153
3 3 2015-08-12 20153
4 4 2016-02-28 20161
5 5 2016-04-26 20162
6 6 2016-04-26 20162
- 1.
- 2.
- 3.
- 4.
- 5.
- 6.
- 7.
- 8.
3. Code interpretation
Use R package lubridate·, Year of extraction , Extraction season , Use paste0 Combine the two , And then copy it to test, Name it CNJ.
wish you success !
边栏推荐
- [Niuke's questions] nowcoder claims to have remembered all Fibonacci numbers between 1 and 100000. To test him, we gave him a random number N and asked him to say the nth Fibonacci number. If the nth
- EMQ 助力青岛研博建设智慧水务平台
- PolarDB-X现在版本的开源兼容什么?mysql8?
- 华为云DevCloud重磅发布四大新能力,创下国内两项第一
- 基于 Nebula Graph 构建百亿关系知识图谱实践
- SQL injection principle
- A distribution fission activity is more than just a circle of friends!
- Array represents a collection of several intervals. Please merge all overlapping intervals and return a non overlapping interval array. The array must exactly cover all the intervals in the input. 【Le
- Smart wind power | Tupu software digital twin wind turbine equipment, 3D visual intelligent operation and maintenance
- [pyGame games] this "eat everything" game is really wonderful? Eat them all? (with source code for free)
猜你喜欢

Four characteristics of transactions

# Cesium实现卫星在轨绕行

Leetcode daily practice (Yanghui triangle)

Redis Series 2: data persistence improves availability
![[pyGame games] this](/img/3c/e573106ec91441a554cba18d5b2253.png)
[pyGame games] this "eat everything" game is really wonderful? Eat them all? (with source code for free)

郎酒两大王牌产品成都联动共振,持续带动光瓶酒消费浪潮

开源二三事|ShardingSphere 与 Database Mesh 之间不得不说的那些事

EMQ helps Qingdao Yanbo build a smart water platform

Leetcode daily practice (main elements)

Bit. Store: long bear market, stable stacking products may become the main theme
随机推荐
What is RPC
Expert: those who let you go to a good school with a low score are all Scams
NFT双币质押流动性挖矿dapp合约定制
3.1 simple condition judgment
List转Table
Mode setting of pulseaudio (21)
C language set operation
What should the ultimate LAN transmission experience be like
What is the level 3 password complexity of ISO? How often is it replaced?
[pyGame games] this "eat everything" game is really wonderful? Eat them all? (with source code for free)
事务的四大特性
Distributed session solution
C language teacher workload management system
郎酒两大王牌产品成都联动共振,持续带动光瓶酒消费浪潮
SQL parsing practice of Pisa proxy
Introduce you to ldbc SNB, a powerful tool for database performance and scenario testing
字节跳动埋点数据流建设与治理实践
Domain name binding dynamic IP best practices
[Niuke's questions] nowcoder claims to have remembered all Fibonacci numbers between 1 and 100000. To test him, we gave him a random number N and asked him to say the nth Fibonacci number. If the nth
Hierarchical clustering and case analysis