且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

R:如何计算一列中用逗号分隔的所有字符值?

更新时间:2022-12-11 23:04:16

要计算整列中 ICD10Code 的频率,我们可以将字符串拆分为逗号, unlist 并使用 table 进行计数.

To count the frequency of ICD10Code in the entire column, we can split the string on comma, unlist it and count it with table.

table(unlist(strsplit(as.character(data.1$ICD10Code), ',')))