R max und min Funktionen
max(x)
min(x)
Itchy Ibex
max(x)
min(x)
min(c(mtcars$mpg, mtcars$cyl)) # Min between two columns / vectors
# 4
max(mtcars$mpg) # Compute max of column mpg
# 33.9
sapply(mtcars, min) # Compute min of all columns
# mpg cyl disp hp drat wt qsec vs am gear carb
# 10.400 4.000 71.100 52.000 2.760 1.513 14.500 0.000 0.000 3.000 1.000
min(mtcars[5,]) # Compute min of one row
# 0
max(c(mtcars$mpg, mtcars$cyl)) # Max between two columns / vectors
# 33.9
max(x2, na.rm = TRUE) # Specify na.rm = TRUE
# 20
max(mtcars[5,]) # Compute max of one row
# 360
sapply(mtcars, max) # Compute max of all columns
# mpg cyl disp hp drat wt qsec vs am gear carb
# 33.900 8.000 472.000 335.000 4.930 5.424 22.900 1.000 1.000 5.000 8.000
max(mtcars) # Apply max algorithm to whole data.frame
# 472