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.

# Using R

## Write the R command to make a vector with 30 even numbers starting from 6

```
[1] 6 8 10 12 14 16 18 20 22 24 26 28 30 32 34 36 38 40 42 44 46 48 50
[24] 52 54 56 58 60 62 64
```

`# write your answer here`

## Write the R command to make a vector with 20 copies of the number 9

```
[1] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
[36] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
```

`# write your answer here`

## Write the R command to produce this vector

`[1] "x" "y" "y" "z" "z" "z"`

`# write your answer here`

## Write the R command to produce this vector

```
[1] red white black blue brown
Levels: black blue brown red white
```

`# write your answer here`

## Write the R command to create a logic vector, which is `TRUE`

for the elements of `state.area`

that are greater than 5E4

```
[1] TRUE TRUE TRUE TRUE TRUE TRUE FALSE FALSE TRUE TRUE FALSE
[12] TRUE TRUE FALSE TRUE TRUE FALSE FALSE FALSE FALSE FALSE TRUE
[23] TRUE FALSE TRUE TRUE TRUE TRUE FALSE FALSE TRUE FALSE TRUE
[34] TRUE FALSE TRUE TRUE FALSE FALSE FALSE TRUE FALSE TRUE TRUE
[45] FALSE FALSE TRUE FALSE TRUE TRUE
```

`# write your answer here`

# Using indices

## Show the first 4 elements of the vector `state.abb`

`[1] "AL" "AK" "AZ" "AR"`

`# write your answer here`

## Show all the elements of the vector `state.abb`

, except the first 40

` [1] "SD" "TN" "TX" "UT" "VT" "VA" "WA" "WV" "WI" "WY"`

`# write your answer here`

## Show the elements of the vector `state.name`

corresponding to states whose area is greater than 2E5

`[1] "Alaska" "Texas" `

`# write your answer here`

## Create a vector with the values 1, 2, 3, and 4, and with names “one”, “two”, “three”, and “four”.

Assign this vector to the variable `x`

. Then show the content of `x`

```
one two three four
1 2 3 4
```

`# write your answer here`

## Using the name as index, show the value of `two`

in the vextor `x`

```
two
2
```

`# write your answer here`

# About Computing

Please provide an original answer the following questions, using your own words. All answers should be personal and original.

## What is a *computer*? what are computers useful for?

REPLACE THIS WITH YOUR ANSWER

## What are the parts of a computer?

REPLACE THIS WITH YOUR ANSWER

## What is a *prompt*? What is the interpretation?

REPLACE THIS WITH YOUR ANSWER

## Can you use *Microsoft Word* for scientific computing?

REPLACE THIS WITH YOUR ANSWER

## What are the advantages of *Markdown* as a way to represent documents?

REPLACE THIS WITH YOUR ANSWER

# About R

Please answer the following questions:

## Which are the basic *data types in R*?

REPLACE THIS WITH YOUR ANSWER

## What is the meaning of `NA`

? Why it is useful?

REPLACE THIS WITH YOUR ANSWER

## What types of data can be used as indices of vectors in R? What are the advantages of each one?

REPLACE THIS WITH YOUR ANSWER