0% found this document useful (0 votes)
79 views2 pages

ITA 04 - Day3 - Assignment

The document outlines 5 assignments involving data manipulation and analysis using R: it includes tasks working with occupational data, reshaping data frames between wide and long format, analyzing quiz score data, and reading in a CSV file to analyze salaries and filter people by department, salary amount, and year joined. The final task is to filter the CSV data and write selected rows to a new output file.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
79 views2 pages

ITA 04 - Day3 - Assignment

The document outlines 5 assignments involving data manipulation and analysis using R: it includes tasks working with occupational data, reshaping data frames between wide and long format, analyzing quiz score data, and reading in a CSV file to analyze salaries and filter people by department, salary amount, and year joined. The final task is to filter the CSV data and write selected rows to a new output file.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

ITA 04 – Assignment – Day 3

1. Consider the data set occupationalStatus in the datasets package.


(a) What is the probability of a son having the same occupational status as his father? [Hint:
investigate what diag(x) does if x is a matrix.]
(b) Renormalize the data so that each row sums to 1. In the new data set the ith row
represents the conditional distribution of a son’s occupational status given that his father has
occupational status i.
(c) What is the probability that a son has occupational status between 1 and 3, given that his
father has status 1?
What if the father has occupational status 8?

2. Create the following data frame, subsequently invert Gender for all individuals.
a) Name Age Height Weight Gender
Alex 25 177 57 M
Lilly 31 163 69 M
Mark 23 190 83 F
b) Create the below data frame
Name Working
Alex Yes
Lilly No
Mark No
c) Add the data frame column-wise to the previous one.
How many rows and columns does the new data frame have?

3. A student recorded his/her scores on weekly R programming quizzes that were marked out
of a possible 10 points. His/Herscores were as follows:
8, 5, 8, 5, 7, 6, 7, 7, 5, 7, 5, 5, 6, 6, 9, 8, 9, 7, 9, 9, 6, 8, 6, 6, 7
What is the mode of his/her scores on the weekly R programming quizzes?

4. Construct the following data frame.

Countries population_in_million gdp_per_capita


A 100 2000
B 200 7000
C 120 15000

a) Write appropriate R code and reshape the above data frame from wide data format
to long data format.
b) Write R code and reshape from long to wide data format.

5. Consider the following data present. Create this file using windows notepad . Save the file
as input.csv using the save As All files(*.*) option in notepad.
i. Use appropriate R commands to read input.csv file.
ii. Analyze the CSV File and compute the following.
a. Get the maximum salary
b. Get the details of the person with max salary
c. Get all the people working in IT department
d. Get the persons in IT department whose salary is greater than 600
e. Get the people who joined on or after 2014

iii. Get the people who joined on or after 2014 and write the output onto a file called
output.csv

You might also like