Difference between min(x) and floor(min(x)), and, max(x) and ceiling(max(x))

I learned to making histogram and CDF/ogive. There is a code looks like:

xs <- seq(floor(min(x)), ceiling(max(x)),0.1)

x is some vector in integers. What if i write the code without floor/ceiling function?

also, can anybody explain aboud ecdf function? I have code like this:

plot(xs,ecdf(x)(xs),type="l",
xlab="Height in Inches, ylab="F(x)")

if you don't mind, please explain about type function too

Each vector has a single minimum and maximum; ceiling and floor will round each element of your vector to the nearest integer; floor to the nearest lower integer, ceiling to the nearest upper integer.

And because verba docent, exempla trahunt consider this code:

asdf <- c(1/4, 7/4)

min(asdf)
[1] 0.25
max(asdf)
[1] 1.75

floor(asdf)
[1] 0 1
ceiling(asdf)
[1] 1 2

Note how min & max return a single value, and floor & ceiling return a vector of equal lenght of your input (just rounded, up or down).

Thank you so much for youe help! :grin:

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.