Built in Data In R:
This Question uses "cystfibr" data found in "ISwR" package. to access this data you need to first install "ISwR" package. then load the library.
Type data() to check which built in data are in the package "ISwR". This should show all the available built in data as:
We use nickel data for this part.
Type >cystfibr to see the data, and then answer the following questions using the data:
(a) type ?cystfibr this will open up a help file explaining about the 'cystfibr' data. What is cystfibr data about?
(b) How many Males and how many Females are in the study?
(c). Construct a bar diagram of the male and female. Change color to Red. {hint: barplot(table(sex))}
(d.) Calculate the average height of the participants
(e). Calculate the variance of the weight of the participants.
(f). Calculate the Standard Deviation of the weight of the participants.
(g). Construct a histogram of weight of the participants.
(h). Construct a scattered plot height and weight [hint: plot(height, weight)]
The r-codes are given below along with outputs
> library(ISwR)
> data=cystfibr
> attach(data)
> barplot(table(sex),col="red")
(#here male=14 and female=9)
> mean(height)
[1] 152.8
> var(weight)
[1] 320.3429
> standard_deviation=sqrt(var(weight))
> standard_deviation
[1] 17.89813
>
hist(weight,prob=FALSE,labels=FALSE,col='green',border='#000000',lty=1,xlab='weight',main='',sub='',col.lab='#000000',col.main='#000000',col.sub='#000000',col.axis='#000000',cex.lab=1,cex.main=1,cex.sub=1,cex.axis=1)
> plot(height,weight, col='red')
Get Answers For Free
Most questions answered within 1 hours.