Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/r/76.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
R 匹配一个矩阵的多行_R_Matrix_Match - Fatal编程技术网

R 匹配一个矩阵的多行

R 匹配一个矩阵的多行,r,matrix,match,R,Matrix,Match,我有一个大矩阵(超过10.000.000行),其中包含事务和列: TransactionDate、Verified(“Verified”或NULL)、UUID(可能出现多次)、n_UUID(此UUID有一个事务的次数)、旅程_UUID(也可能出现多次)和n_旅程(此旅程中的事务数)。以下是摘录: "TransactionDate" "Verified" "UUID" "n_UUID" "journey_UUID" "n_journey" 2014-10-04 23:18:58 ""

我有一个大矩阵(超过10.000.000行),其中包含事务和列: TransactionDate、Verified(“Verified”或NULL)、UUID(可能出现多次)、n_UUID(此UUID有一个事务的次数)、旅程_UUID(也可能出现多次)和n_旅程(此旅程中的事务数)。以下是摘录:

"TransactionDate" "Verified" "UUID" "n_UUID" "journey_UUID" "n_journey"
2014-10-04 23:18:58     ""     247538     118     679237     10
2014-10-04 23:19:04     ""     620831     79     1221991     5
2014-10-04 23:19:05     ""     247538     118     679237     10
2014-10-04 23:19:16     ""     103757     52     377034     1
2014-10-04 23:19:17     ""     23031     177     113316     1
2014-10-04 23:19:25     "VERIFIED"     1539737     1     2195168     1
2014-10-04 23:19:25     ""     1539738     2     2195169     1
2014-10-04 23:19:25     ""     620831     79     1221991     5
2014-10-04 23:19:33     ""     247538     118     679237     10
2014-10-04 23:19:33     ""     1539739     11     2195171     11
2014-10-04 23:19:34     ""     954364     50     1565701     7
2014-10-04 23:19:37     "VERIFIED"     197254     56     575615     1
2014-10-04 23:19:38     ""     1539740     1     2195172     1
2014-10-04 23:19:40     ""     620831     79     1221991     5
2014-10-04 23:19:41     ""     954364     50     1565701     7
2014-10-04 23:19:42     ""     500642     7     1070762     1
2014-10-04 23:19:42     ""     1539741     1     2195173     1
2014-10-04 23:19:43     ""     1539742     1     2195174     1
2014-10-04 23:19:43     ""     23322     162     116724     10
2014-10-04 23:19:45     ""     247538     118     679237     10
2014-10-04 23:19:48     "VERIFIED"     620831     79     1221991     5
2014-10-04 23:19:52     ""     247538     118     679237     10
2014-10-04 23:19:58     ""     481173     55     1047024     1
2014-10-04 23:20:02     ""     620831     79     1221991     5
2014-10-04 23:20:22     ""     1539743     1     2195175     1
2014-10-04 23:20:33     ""     612282     17     1212634     1
2014-10-04 23:20:38     ""     1539739     11     2195171     11
2014-10-04 23:20:40     ""     1539744     2     2195176     1
2014-10-04 23:20:42     ""     1539745     1     2195178     1
2014-10-04 23:20:45     ""     1539746     14     2195179     3
我想知道有多少n_UUID“X”的交易得到了验证,n_旅程也是如此。我还想知道订单是否有影响(通过TransactionDate)

到目前为止,我按n_旅程(或n_UUID)分割矩阵:

Journey4鉴于您的数据帧“df”包含名为TransactionDate、Verified、UUID、n_UUID、Travely_UUID、n_Travely的列,您可以通过“Verified”列对df进行子集划分,如下所示:

df.new <- subset(df, df$Verified == "Verified")

df.new假设您的数据保存在一个名为d的数据框中。您可以简单地使用
d[d$Verified%in%“Verified”,]
来获取所有已验证的事务。您希望在这里得到的输出是什么?@Jimbou为什么不直接使用
d[d$Verified==“Verified”,]
?@Jaap我在%
中使用
%而不是
=
,因为有时会出现数据丢失的问题。尽管示例文件中没有NAs,但尝试避免这些问题。
Journey4$NR <- 1:(Journey4$n_journey)
GSfirst <- Journey4[grep("\\b1\\b" , NR)]
GSsecond  <- Journey4[grep("\\b2\\b" , NR)]
GSthird <- Journey4[grep("\\b3\\b" , NR)]
GSfourth  <- Journey4[grep("\\b4\\b" , NR)]
df.new <- subset(df, df$Verified == "Verified")