---
title: "Software Tools for Earth System Sciences"
output:
  html_document:
    df_print: paged
  pdf_document: default
date: "01/12/2020"
subtitle: Homework-II
---

*due date : 07/12/2020 23:59*

*** 

**Part 1 - Basic Math**

- Look at Figure - "Math Eq"
- Write the solution  


```{r echo=FALSE, out.width="120px", results='asis'}
download.file(url = "https://web.itu.edu.tr/~tokerem/mat1.png",
          destfile = "mat1.png",
          mode = 'wb')
knitr::include_graphics(path = "mat1.png")
```


   


```{r}
# aritmetic operators

```

*** 

**Part 2 - Assignment**

- Create a new object with one value. 
- ***hint*** *: For example, use Part 1 for value, assign it in a new variable like <my_new_var>*
- Print your new object

```{r}
#assignment arrow
#print()

```

*** 

**Part 3 - Class**

- Print your name as a character string.
- Print your age as a numeric type.
- Print your age as a character type.
- Try to print your name as a numeric type. (?!) 
- ***hint*** *: kidding*
- Check classes for all.
- What is the class of TRUE and NA ?


```{r}
# print()
# " ... " 
# class()

```

*** 

**Part 4 - Vector**

- Create a new vector which has 4 elements with **numeric** class.
- Print your vector with **sorting**. *(decreasing = TRUE)*
- Add a new **character** element at your vector.
- Now you must have 5 elemets. Learn the **length** of your vector.
- Check the class of your vector. *(Numeric or Character ?)*
- Now create another new vector, but now use **sequence** function.

```{r}
# combine them
# my_new_vector <-
# sort
# length()
# seq()

```

*** 

**Part 5 - Matrice**

- Create a new **matrice** with 4 rows and 5 colomns, using **random** variables.*(random for the uniform distribution)*
- Select the grid (or cell) located in 2nd row and 3rd coloms. *(indexing)*
- Change it with **TRUE**. *(assigment)*
- Check the **dimension**, **structure**, **length** and **class** of your **matrice**
- BONUS: Print values **which** is greater than or equal to 5 in your **matrice**.


```{r}
# runif()
# matrix()
# indexing with []
# length()
# dim()
# str()
# class()
# which()
# >=

```

*** 

**Part 6 - Array**

- Create a new **vector** which has 4 elements, **character**.
- Create a new **matrice** with 2 rows and 4 colomns, **numeric**.
- Combine them, and create a new **array** with 3 rows, 4 columns and 2 layers. 
*(first row must be vector, second and third rows must be matrix for each layer)*
- ***hint*** *: you can use repetations function*
- Try to add **+2** for each values of 2nd layer of **array**.
- Check the **dimension**, **structure**, **length** and **class** of your array.

```{r}
# vector()
# matrix()
# array()
# length()
# dim()
# str()
# length()
# class()


```


*** 

**Part 7 - Data Frame**

- Create a new **vector** which has 4 elements, **numerical**.
- Create a new **vector** which has 4 elements, **logical**.
- Create a new **matrice** which has 4 rows and 2 columns, **numerical**.
- Create a **data frame** which has 4 rows and 4 columns with your numerical and logical vectors, and numreical matrice.
- Check the **class** and **structure** of your new data.
- Take the first column and assign it as a new variable. *(It will look like a vector)*
- **hint** *: you can use $ symbol*
- **Plot** this vector.
- BONUS: Find values **which** is lower than 20 and change them with **NA**. *(now your vector has changed)*
- Print and Plot this new vector. 

```{r}
# my_data <-
# class()
# my_data$
# plot()
# which()
# <20

```


*** 

*Use the Ninova Message Board for questions or problems*

***Emir***
