Search
 
SCRIPT & CODE EXAMPLE
 

R

r max and min functions

max(mtcars)                                   # Apply max algorithm to whole data.frame
# 472
Comment

r max and min functions

max(x)
min(x)
Comment

r max and min functions

max(x2, na.rm = TRUE)                         # Specify na.rm = TRUE
# 20
Comment

r max and min functions

max(mtcars$mpg)                               # Compute max of column mpg
# 33.9
Comment

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
Comment

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
Comment

r max and min functions

max(c(mtcars$mpg, mtcars$cyl))                 # Max between two columns / vectors
# 33.9
Comment

r max and min functions

min(c(mtcars$mpg, mtcars$cyl))                 # Min between two columns / vectors
# 4
Comment

r max and min functions

max(mtcars[5,])                               # Compute max of one row
# 360
Comment

r max and min functions

min(mtcars[5,])                               # Compute min of one row
# 0
Comment

PREVIOUS NEXT
Code Example
R :: extract residual standard error from lm in r 
R :: connect excel to r 
R :: Significance codes 
R :: index in r 
R :: diff division R 
R :: pdlyr mutate string extract 
R :: combine scripts into a pipeline 
R :: take node names from nodes to edges tidygraph 
R :: rename vector in r 
R :: how to pull all 500 stocks r 
R :: r while loop 
Rust :: rust random number in range 
Rust :: rust implement debug for struct 
Rust :: rust simple search and replace regex 
Rust :: rust implement clone for struct 
Rust :: rust square root 
Rust :: rust lang start a new project 
Rust :: how to make a sorting algorithim rust 
Rust :: does rust support classes 
Rust :: armanriazi•rust•thread•recv•try_recv 
Rust :: rust•armanriazi•concept•borrowchecker 
Rust :: loop label in rust 
Rust :: rust•armanriazi•modified•data•by•compiler•cast•number•i32•to•u8 
Rust :: rust•armanriazi•capacity•reserve 
Lua :: luau how to make rainbow part 
Lua :: how to make a part rotate roblox 
Lua :: open gui script 
Lua :: prompt game pass purchase 
Lua :: json resume shema 
Lua :: function return lua 
ADD CONTENT
Topic
Content
Source link
Name
7+8 =