Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

ASSIGNMENT 1 Write a code that contains the answers of the questions given below and save your file by using your name Name . R

ASSIGNMENT 1
Write a code that contains the answers of the questions given below and save your file by using your
name Name.R. Send me the .R file.
1. Add a comment line that contains your name, surname, student ID and department
2. Calculate the remainder of the devision and the integer division according to your student ID. Use the
last two digit of your student ID and 6th digit of your student ID.
For instance, if your student ID is 190208927 then calculate for 27 divided by 8.
If 8th digit is 0, take that number as 1.
For instance, if your student ID is 190204008 then calculate for 18 divided by 4.
Assign the results to variables. For the former calculation, use your first name as the name of the
variable. For the latter calculation, use your surname as the name of the variable.
3. Create a vector that contains the names of your family members (i.e., the first names of your parents,
sibling(s), if there is no sibling write your name). Use your SurnameName (e.g., GonenSeza) as the
name of the vector.
- Create a code that returns the length of this vector.
- Label the names of your family members by using an appropriate code.
- Create a code that returns the name of your mother.
4. Create a vector that contains the 9 digits of your student ID (i.e.,1,9,0,2,0,8,9,2,7). The name of
the vector should be NameID (i.e., SezaID). Add 2, multiply by 1.5 and take the square of each element
by using an appropriate code. Create a new vector for the new numbers. The name of the new vector
should be NewNameID (e.g., NewSezaID). For the NewNameID vector:
- Find the maximum, minimum, and mean values.
- Find the elements above mean values.
- Find the elements below mean values.
5. By using command rep(), create a SurnameID vector (i.e., GonenID). The vector should be created
by repeating the numbers of your birthday (e.g.,16,3,1985). The length of vector should be 12.
Transform this vector to a matrix (e.g., MGonenID). The matrix should have 3 rows and 4 columns. The
numbers must be placed in rows first.
For instance, if your vector is: 1,2,3,4,5,6,7,8,9
The matrix:
123
456
789
- Create a code that returns the division of the third row by second row.
- Add this division as a new row to this matrix.
- Calculate the sum of each row and add the results a new column.
- Add appropriate names to each column and row.
- Calculate the maximum, minimum, and mean values of 2nd column.
6. Create a matrix by using the vector you created in Question 3. The first row of the matrix should be
that vector. The second row should be the ages of family members. The third row should be their gender.
- Create a code that returns the dimension of this matrix.
- Create a code that returns the Gender row.
- Create a code that returns the Sibling column.
- Add a grandparent column to the current matrix.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Students also viewed these Databases questions

Question

Find the exact value of expression. cos 4 sin SI

Answered: 1 week ago