R_concordancer - アールメカブ

アールメカブ


R_concordancer

Rでコンコーダンサー (とか言ってみる)

library(languageR)

place <- which(alice == "place")

for(i in place){
  x <- i - 2; y <- i + 2
  if(x< 0) x <- 0
  if(y > length(alice)) y <- length(alice)
#  cat(alice[x:y],"\n")
  for(z in x:y){
   cat(sprintf("%10s", alice[z]))
#    if(z == y){
#      cat("\n")
#    }
  }
  cat("\n")
}
       in     bill's      place        for          a
       an       open      place       with          a
       at        the      place      where         it
     move        one      place         on         he
      the dormouse's      place        and      alice
     took        the      place         of        the
      the      whole      place     around        her
     take        the      place         of        the

# 実際の出力表示は揃っているんです.

 
Link: R_old_tips2(1908d) Rの備忘録(3944d) 日録2007_11月(6153d)
Last-modified: 2007-11-23 (金) 18:01:04 (6161d)