0
这是卡矢量:分配卡(模拟R)
Cards
[1] 2 3 4 5 6 7 8 9 10 11 12 13 14 2 3 4 5 6 7 8 9 10 11 12 13 14 2 3 4 5 6 7 8 9
[35] 10 11 12 13 14 2 3 4 5 6 7 8 9 10 11 12 13 14
1时14分 - 卡值:
我要2个玩家之间分发此卡:26卡都其中。
hand_1 <- sample(cards,size = length(cards)/2)
这是玩家1
手我怎么样才能得到玩家2正确的手?我需要以某种方式删除cards
中的所有元素,这些元素存在于hand_1
中。我怎样才能做到这一点,而不使用循环技术。
'hand_2 < - 样品(卡片[!卡片%的%手1],大小=长度(卡片)/ 2)'也许? – Carl
哎呀!好吧然后'拆分(卡片,样品(代表(1:2,长度(卡片)/ 2)))' –
删除了评论,并发布了一个答案,我认为更好。 – nicola