YYY
YYY

Reputation: 89

How to apply multiple functions to a dataframe in R

I am working with a relatively large dataset with a lot of attributes, is there any simple way(no extra packages) to let the output be like this row names as attributes name and col names as the function:

               Min   Max                       
Sepal.Length   4.3   7.9
Sepal.Width    2.0   4.4
Petal.Length   1.0   6.9
Petal.Width    0.1   2.5

Currently, when I sapply multiple functions to the data, the output is this

     Sepal.Length Sepal.Width Petal.Length Petal.Width
min      4.300000    2.000000        1.000    0.100000
max      7.900000    4.400000        6.900    2.500000
mean     5.843333    3.057333        3.758    1.199333

However, this output will be too wide to fit in a pdf when knitting when dealing with large number of attributes.

Upvotes: 0

Views: 48

Answers (1)

VictorJimenez99
VictorJimenez99

Reputation: 375

you can use the t function

transposed_table <- t(normal_table)

Upvotes: 2

Related Questions