due date : 07/12/2020 23:59
Part 1 - Basic Math
- Look at Figure - “Math Eq”
- Write the solution
# 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
- Print your new object
#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 ?
# 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.
# 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.
# 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.
# 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.
# my_data <-
# class()
# my_data$
# plot()
# which()
# <20
Use the Ninova Message Board for questions or problems
Emir