Even spacing of a numeric vector in R-Markdown
I am currently in an intermediate statistics class. I ran into a problem in my homework assignment and it is as follows:
From the assignment: "Create a vector x with these 25 observations of BMI for patients with cystic fibrosis...
68, 65, 64, 67, 93, 68, 89, 69, 67, 68, 89, 90, 93, 93, 66, 70, 70, 92, 69, 72, 86, 86, 97, 71, 95
The parts I would like help with:
a. Create a histogram going from 60-100 with breaks at 60, 65, 70, 75, 80, 85, 90, 95, 100."
b. Compute the percentage of observations that fall into the following classes:
- 60-65
- 65-70
- 70-75
- 75-80
- 80-85
- 85-90
- 90-95
- 95-100 total 100%
I created an object named cyst_fibro_sample
to contain the observations. The assignment instructs us to use R to compute some basic statistics such as five number summaries, interquartile range, and standard deviation. I am using the built in hist()
function as I have no variables and only observations to plot and I don't know how to plot the observations using ggplot()
hist(x, breaks = 60,65,70...)
I would like to avoid doing punching in all the values by hand as this is grossly inefficient. However, I can't seem the vector operation for even spacing.
I would like for that argument to be hist(x, breaks = c(60:100, increasing by = 5)
For part b of the assignment, I think we are being asked to compute the density of each category of observation but I am not sure.
Any help is appreciated!
from Recent Questions - Stack Overflow https://ift.tt/3qUeZfR
https://ift.tt/eA8V8J
Comments
Post a Comment