Update functions2.R

use min instead of 1se