# What’s the difference between the two following sentence?

Can someone explain what’s the differences?
check<-(check,tm2)
check<-tm2

Hi,

In this context it is not possible to say. You'll have to define for us what `check` is and what `tm2` is.

``````bingo <- LETTERS[1:4]
my <- NULL
check <- NULL
i <- 1
for (i in 1:10) {
tmp1 <- sample(x = LETTERS, size = 4, replace = F)
tmp2 <- sum(tmp1 %in% bingo)
check <- c(check, tmp2)
}
``````

oohhh!sorry!
you mean just like this?

Hello,

Yes that makes it a lot more clear.

``````set.seed(1)

bingo <- LETTERS[1:4]
my <- NULL
check <- NULL

for (i in 1:10) {
tmp1 <- sample(x = LETTERS, size = 4, replace = F)
tmp2 <- sum(tmp1 %in% bingo)
check <- c(check, tmp2)
}

tmp1
#> [1] "J" "F" "O" "T"
tmp2
#> [1] 0
check
#>  [1] 2 1 1 0 0 0 1 1 1 0
``````

Created on 2020-10-01 by the reprex package (v0.3.0)

Okay so you will see I have added a `set.seed` here just so we can understand more what is happening. For this run it seems you want the random output you're getting from `sample` as it needs to match the letters in `bingo`.

Essentially what is happening is the following, `check` needs to be defined as:

``````check <- c(check, tmp2)
``````

As it gives the loop the ability to keep track of how many letters you matched with. If you only did the below:

``````check <- tmp2
``````

`check` will only have stored the last value obtained in `tmp2` so as you will see it would have been 0 and not the whole vector of values as printed above.