有人可以告诉我如何从下面的句子中提取日期:
head(df)
,结果:
X..Indicadores...APM...Aplicacoes_e_Transacoes...PlainText
1 # Application: Central Analysis Server
2 # Application Id: CVENT
3 # Data View: Application, transaction, and tier data
4 # Data View Id: Tier
5 # Filters: Tier=LAN | WAN | Enterprise Synthetic
6 # 22/01/17 00:00 - 23/01/17 00:00
我只需要第一个日期,在6º行:
22/01/17
有人可以帮助我
答案 0 :(得分:0)
data.frame(
`X..Indicadores...APM...Aplicacoes_e_Transacoes...PlainText`=
c("# Application: Central Analysis Server",
"# Application Id: CVENT",
"# Data View: Application, transaction, and tier data",
"# Data View Id: Tier",
"# Filters: Tier=LAN | WAN | Enterprise Synthetic",
"# 22/01/17 00:00 - 23/01/17 00:00"), stringsAsFactors=FALSE) -> df
library(stringi)
stri_extract_first_regex(df[6,1], "([[:digit:]]+/[[:digit:]]+/[[:digit:]]+)")
## [1] "22/01/17"