Reference no: EM131827142
Progamming in R Computer Language
Please put the R code in a word document. THAT is what I need. I will then try to run the code myself into R. It needs to run properly. Please add # comments where appropriate. The instructions are attached but I have repeated them here:
For each of the following problem parts, your submitted HW solution should contain R code lines. Don't include the lengthy output of R. You will not get credit for the answers without the associated code lines, together with some intermediate results as appropriate to indicate that your code lines did give the correct desired answer.
Problem 1: Access the data-set "nepali" within the R package "faraway", which contains information about children and their mothers. See the web-page brought up by the command "help(nepali)" for details on the data-frame "nepali" you will see by loading the "faraway" R package onto your computer.Answer the following questions about the dataset, giving R code to show how you obtained the answers.
(a) How many unique children (i.e., ID's) are represented in the dataset ?
(b) Some of the observations on children are missing the height ("ht") or weight ("wt")
data. Are there any observations missing one but not both of these data fields ?
(c) Use the appropriate function to delete the missing values from the data set "nepali".
(d) From the new data set "nepali"( after deleting the missing value), use the columns "wt"and "sex" in new data set "nepali" to create boxplot (indicate appropriate xlab,ylab and main).
(e) From the new data set "nepali"( after deleting the missing value), use the columns "wt"and "ht" in new data set "nepali" to create scatterplot (indicate appropriate xlab,ylab,xlim, ylim and main).
Problem 2: Create the following vectors in R.
x = (5, 10, 15, 20, ..., 175)
y = (88, 86, 85, ..., 54)
Use vector arithmetic to multiply these vectors and call the result z. Select subsets of z to identify the following.
(a) What are the 13th, 20th, and 25th elements of z?
(b) What are all of the elements of z which are less than 2500?
(c) How many elements of z are greater than 7000?
Problem 3: Using z from problem 2, use R to compute the following statistics of z:
(a) sum
(b) mean
(c) standard deviation