Please download the answer file and edit it on *Rstudio*. Write your student number in the correct place at the beginning of the answer file. You should be able to **Knit HTML** and get the same results as the document you have in paper. Please do **Knit** often and verify that your document has no errors. **If your document does not Knit, you will not have full grade.**

When you finish, send the `answers.Rmd`

file to my mailbox (`andres.aravena+cmb@istanbul.edu.tr`

). Be sure to use the correct email address and send only one file.

**IMPORTANT:** Write your student number in the correct place at the beginning of the answer file.

For the following questions you will use `X`

and `Y`

defined as follows

```
X <- rep(c(TRUE, FALSE), 2)
X
```

`[1] TRUE FALSE TRUE FALSE`

```
Y <- rep(c(TRUE, FALSE), c(2, 2))
Y
```

`[1] TRUE TRUE FALSE FALSE`

These are all the possible combinations of two logic variables. Now we want to see what happens when we combine them

`X`

and `Y`

”`[1] TRUE FALSE FALSE FALSE`

`# write here`

`X`

or `Y`

”`[1] TRUE TRUE TRUE FALSE`

`# write here`

`X`

and not `Y`

”`[1] FALSE FALSE TRUE FALSE`

`# write here`

`X`

and not `Y`

”`[1] FALSE FALSE FALSE TRUE`

`# write here`

`X`

and not `Y`

” is the `X`

or `Y`

”. Print both results in different lines, so we can see they are the same. This is called `[1] FALSE FALSE FALSE TRUE`

`[1] FALSE FALSE FALSE TRUE`

`# write here`

`X`

or not `Y`

” is the negation of “`X`

and `Y`

”. Print both results in different lines, so we can see they are the same. This is also called `[1] FALSE TRUE TRUE TRUE`

`[1] FALSE TRUE TRUE TRUE`

`# write here`

`X`

and `Y`

are really all combinations of two logic variables?Write your comment here. Keep the

`>`

and delete the rest

Consider now `A`

, `B`

, and `C`

, defined as follows

```
A <- rep(c(TRUE, FALSE), 4)
A
```

`[1] TRUE FALSE TRUE FALSE TRUE FALSE TRUE FALSE`

```
B <- rep(c(TRUE, TRUE, FALSE, FALSE), 2)
B
```

`[1] TRUE TRUE FALSE FALSE TRUE TRUE FALSE FALSE`

```
C <- rep(c(TRUE, FALSE), c(4, 4))
C
```

`[1] TRUE TRUE TRUE TRUE FALSE FALSE FALSE FALSE`

These are all the combinations of three logic values.

`A`

and the result of`B`

or `C`

” is equivalent to “the result of `A`

and `B`

, or the result of `A`

and `C`

”. Print both results in different lines, so we can see they are the same. This is called `[1] TRUE FALSE TRUE FALSE TRUE FALSE FALSE FALSE`

`[1] TRUE FALSE TRUE FALSE TRUE FALSE FALSE FALSE`

`# write here`

`A`

or the result of`B`

and `C`

” is equivalent to “the result of `A`

or `B`

, and the result of `A`

or `C`

”. Print both results in different lines, so we can see they are the same. This is also called `[1] TRUE TRUE TRUE FALSE TRUE FALSE TRUE FALSE`

`[1] TRUE TRUE TRUE FALSE TRUE FALSE TRUE FALSE`

`# write here`

`# write here`

`# write here`

In contrast to single-value variables, when we use indices to modify a vector, it changes on place.

The answers to the following questions should work for any vector `v`

. For the sake of example, consider the vector `v`

defined as

```
v <- seq(from=7, to=1)
v
```

`[1] 7 6 5 4 3 2 1`

`# write here`

`8`

and show the updated vector `v`

.`[1] 8 6 5 4 3 2 1`

`# write here`

`v`

.`[1] 8 -6 5 4 3 2 1`

`# write here`

`v`

.`[1] 8 -6 12 11 3 2 1`

`# write here`

`v`

.`[1] 8 6 12 11 3 2 1`

`# write here`

`[1] 8.0 6.0 12.0 11.0 3.3 2.2 1.1`

`# write here`