Davis-height-weight Excel file: http://www.mediafire.com/file/qhi34owgd8o8cw2/Da
ID: 3579833 • Letter: D
Question
Davis-height-weight Excel file: http://www.mediafire.com/file/qhi34owgd8o8cw2/Davis-height-weight.csv
Please do the script in R and show me how to do it. Thank you. I need help.
Davis-height-weight Excel file: http: llwww.mediafire.com/file/qhi34owgd808cw2/Davis-height-weight. csv Consider Davis-height-wei which gives 5 variables for 200 people who exercise sex A factor with levels: F, female; M, male; weight Measured weight in kg; height Measured height in cm; repwt Reported weight in kg, repht Reported height in cm. Consider the height of all males. Put the title as Histogram of height of all males Draw a histogram with these numbers with 10 bins.Explanation / Answer
#read.csv is used for reading .csv file
Davis<- read.csv(D:davis-height.csv")
#na.omit is used for replacing missing values
#Get type of input data frame columns
col.type <- data.frame("varType"=sapply(Davis-height, function (x) class(x)))
# Convert rownames/variable names to a data frame column
col.type$varName <- rownames(col.type)
# Set row names of data frame to null
rownames(col.type) <- NULL
#here no.of breaks=10
noBreaks <- 10
nCol <- nrow(col.type)
# for loop and if statement running to find the male candidates heights
for(i in 1:nCol){
if(col.type[i,1]=="M"){
# hist function is used for histogram and main indicates title=” Histogram Height males” and xlabel and y label also
hist(Davis-height [,col.type[i,3]],
breaks=noBreaks,
main=paste(" Histogram Height ",col.type[i,3],sep=""),
xlab=paste(" Breaks : ",col.type[i,3],sep=""),
ylab="count",
col="red",
border="green"
)
}
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.