225k views
16 votes
Consider the following heights 1.55, 1.92, 1.60, 1.75, 1.58, 1.67, 1.63, 1.82, 1.76, 1.77, 1.72, 1.85. Use R script to finish the following questions

(1) Assign all these heights as vector "height".
(2) Compute the mean and sd of "height".
(3) What is the length of "height"?
(4) How many heights are less than 1.65?
(5) Show if each height is larger than 1.60 and smaller than 1.75.

User Compman
by
4.0k points

1 Answer

7 votes

Answer:

1.718333

0.114957

12

1 3 5 7

Explanation:

Given the following height values :

Height values : 1.55, 1.92, 1.60, 1.75, 1.58, 1.67, 1.63, 1.82, 1.76, 1.77, 1.72, 1.85

1.) Assign all height values to a vector height :

R code:

height - - -> c(1.55, 1.92, 1.60, 1.75, 1.58, 1.67, 1.63, 1.82, 1.76, 1.77, 1.72, 1.85)

2.) To compute the mean and standard deviation of "height"

R code for mean height:

mean(height)

R code for height standard deviation :

sd(height)

3.) The length of "height" ; This gives the number of data values in the vector variable "height"

R_code for length:

length(height)

4.) Number of heights less than 1.65

R_code :

which(height < 1.65)

Gives the index values where height values is less than 1.65

5.) Show if each height is larger than 1.6 and less Than 1.75

R_code :

1.6 < height < 1.75

User Srikanth Chundi
by
4.8k points