Add tags

Add tags to the following comment
例えば3分割なら1, 2, 3, 1, 2, 3, ... という配列を作ってソートし、1が並んでいるインデックスを1列目、
2が並んでいるインデックスを2列目・・・という風に文字列をスライスしています。
1
2
3
4
5
divid <- function(num, sample){
   string <- unlist(strsplit(sample, ""))
   breaks <- sort(rep(1:num, len=length(string)))
   cat(sapply(1:num, function(n)(paste(string[breaks==n], collapse=""))), sep="\n")
}

Add tags

The input will be splited to tags with space.

Index

Feed

Other

Link

Pathtraq

loading...