我想从Oracle表中选择数据,而表列包含的数据为,[ex:key,value]分隔值;所以在这里我要选择第二个分割,即值
表列数据如下:
column_data
++++++++++++++
asper,worse
tincher,good
golder
null -- null values need to eliminate while selection
www,ewe
根据上述数据,所需的输出如下:
column_data
+++++++++++++
worse
good
golder
ewe
请帮助我进行查询
答案 0 :(得分:1)
根据您提供的数据,有两个选项:
library(dplyr)
example %>%
group_by(Report) %>%
mutate(DiffPeriod= difftime(ObsDate, lag(ObsDate), units = "hours"),
DiffPeriod = replace(DiffPeriod, is.na(DiffPeriod),
ReportPeriod[1] - sum(DiffPeriod, na.rm = TRUE)))
# Report ReportPeriod ObsDate DiffPeriod
# <dbl> <dbl> <dttm> <time>
#1 1 15 2017-12-31 00:00:00 2.5 hours
#2 1 15 2017-12-31 06:00:00 6.0 hours
#3 1 15 2017-12-31 12:30:00 6.5 hours
#4 2 11 2018-01-01 07:00:00 1.5 hours
#5 2 11 2018-01-01 13:00:00 6.0 hours
#6 2 11 2018-01-01 16:30:00 3.5 hours
:正则表达式一个(如果存在第二个 word ;否则,获取第一个)result1
:result2
+ SUBSTR
组合INSTR