Reputation: 11944
I like to use ascii output of my results.
There is always an extra 'h' in the header of my table which I and up removing manually.
I can not not figure out how to fix it in my code. See the code and result. E.g., how many cars have how many cilinders.
data(mtcars)
library(ascii)
ascii(as.data.frame(table(mtcars$cyl)),include.rownames=F,format='nice')
|================
h| Var1 h| Freq
| 4 | 11
| 6 | 7
| 8 | 14
|================
I would like to remove the extra h characters from the header. so that the output looks like this:
|================
| Var1 | Freq
| 4 | 11
| 6 | 7
| 8 | 14
|================
Is it a bug in ascii library or in my code? I want to do it via correct params of the ascii call rather then post processing the output, but would consider any "fix" if the proper solution is not possible.
Upvotes: 0
Views: 191
Reputation: 263451
It's not entirely obvious but the ascii.data.frame
function takes a header
argument that when set to FALSE will eliminate the undesired "h"s. There's also an include.colnames
argument, should one want to get rid of what I would have called the "header".
> ascii(as.data.frame(table(mtcars$cyl)),include.rownames=F,header=FALSE,format='nice')
|==============
| Var1 | Freq
| 4 | 11
| 6 | 7
| 8 | 14
|==============
Upvotes: 2