Lets take a veriable cars
as an example. Cars has two columns cars$speed
, cars$dist
.
I want to write a function that will print in one step summary for each column of a veriable(in this case cars). It would look like:
f<-function(x){
#do some stuff
}
The result:
name of first column:
Min. 1st Qu. Median Mean 3rd Qu. Max.
4.0 12.0 15.0 15.4 19.0 25.0
name of second column:
Min. 1st Qu. Median Mean 3rd Qu. Max.
2.00 26.00 36.00 42.98 56.00 120.00
How do I do that?