R_concordancer - RとLinuxと...

RとLinuxと...


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の備忘録(1737d) 日録2007_11月(3946d)
Last-modified: 2007-11-23 (金) 18:01:04 (3954d)