2013/01/24
Many people are of the opinion that R has a corner on convenient data analysis. That may or may not be true.
But now R literally has a corner that makes data analysis more convenient. If you have a data frame or a matrix with a few columns, then you can use head and/or tail to make sure that it looks as you expect. However, the result is unappetizing if there are hundreds or thousands of columns.
That is is where corner comes in. It shows you the first or last few rows of the first or last few columns.
The mtcars dataset can serve as an example even though it isn’t exactly a gigantic dataset.
By default the first 6 rows and first 6 columns are extracted:
> corner(mtcars)
mpg cyl disp hp drat wt
Mazda RX4 21.0 6 160 110 3.90 2.620
Mazda RX4 Wag 21.0 6 160 110 3.90 2.875
Datsun 710 22.8 4 108 93 3.85 2.320
Hornet 4 Drive 21.4 6 258 110 3.08 3.215
Hornet Sportabout 18.7 8 360 175 3.15 3.440
Valiant 18.1 6 225 105 2.76 3.460
The same thing is done with: Read more →