Skip to content

Instantly share code, notes, and snippets.

@abikoushi
Created November 25, 2014 11:01
Show Gist options
  • Save abikoushi/6359c379f2898744e531 to your computer and use it in GitHub Desktop.
Save abikoushi/6359c379f2898744e531 to your computer and use it in GitHub Desktop.
はてな記法の表を出力する関数
hatena <- function(x){
cn1 <- NULL
if(!is.null(colnames(x))) cn1 <- paste("|*",colnames(x))
dim1 <- dim(x)
x <- apply(x, 2,as.character)
x <- paste("|",x)
dim(x) <- dim1
if(is.null(cn1)){
write.table(x, quote=FALSE,col.names=FALSE, row.names=FALSE, eol="|\n")
}else{
colnames(x) <- cn1
write.table(x, quote=FALSE, row.names=FALSE, eol="|\n")}
}
@abikoushi
Copy link
Author

see also

xtable
kable

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment