Comment detail

LL Golf Hole 4 - 文章から単語の索引を作る (Nested Flatten)

コード内にURLが出るかでないかで長さがだいぶ違ってくるのでは・・・。

とりあえず普通に。

1
2
f <- 'http://www.gnu.org/licenses/gpl.txt'
sapply(names(table(unlist(strsplit((l<-readLines(f)),"\\W+")))), function(s) grep(s,l))

ちょっと短くしました。

1
2
f <- 'http://www.gnu.org/licenses/gpl.txt'
sapply(unique(unlist(strsplit((l<-readLines(f)),"\\W+"))),grep,l)

Index

Feed

Other

Link

Pathtraq

loading...