Answers for "r max and min functions"

0

r max and min functions

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
Posted by: Guest on April-05-2022
0

r max and min functions

max(c(mtcars$mpg, mtcars$cyl))                 # Max between two columns / vectors
# 33.9
Posted by: Guest on April-05-2022
0

r max and min functions

max(mtcars[5,])                               # Compute max of one row
# 360
Posted by: Guest on April-05-2022
0

r max and min functions

max(x2, na.rm = TRUE)                         # Specify na.rm = TRUE
# 20
Posted by: Guest on April-05-2022
0

r max and min functions

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
Posted by: Guest on April-05-2022
0

r max and min functions

max(mtcars)                                   # Apply max algorithm to whole data.frame
# 472
Posted by: Guest on April-05-2022
0

r max and min functions

min(c(mtcars$mpg, mtcars$cyl))                 # Min between two columns / vectors
# 4
Posted by: Guest on April-05-2022
0

r max and min functions

min(mtcars[5,])                               # Compute min of one row
# 0
Posted by: Guest on April-05-2022
0

r max and min functions

max(x)
min(x)
Posted by: Guest on April-05-2022
0

r max and min functions

max(mtcars$mpg)                               # Compute max of column mpg
# 33.9
Posted by: Guest on April-05-2022

Browse Popular Code Answers by Language