请教正则表达式相关问题
#101
Replies: 1 comment 2 replies
-
|
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
bxb_in='白血病|髓系(白血症|白细胞病)'
bxb_out='白血病(待[查排定]|?|\?|不(排除|除外))'
bxb<-(str_subset(data$'最终临床诊断(合)','bxb_in'))&!(str_subset(data$'最终临床诊断(合)','bxb_out')) #R这一步报错,显示operations are possible only for numeric, logical or complex types,不知道什么原因呢?
想实现和python同样的功能,python代码如下:
bxb_in = '白血病|髓系白血症'
bxb_out = '白血病(待[查排定]|?|?|不(排除|除外))'
bxb = (data['最终临床诊断(合)'].str.contains(bxb_in, case = False)) & (~data['最终临床诊断(合)'].str.contains(bxb_out, case = False))
Beta Was this translation helpful? Give feedback.
All reactions