RStudio 0.99.903 on Windows 7 pro
R version 3.3.1
R機能マップ
http://qiita.com/7of9/items/0f911bcb95d3a8bbd703
データの確認のためRStudioを使用していた。
> setwd("D:/Test/0_sampleData")
> xtable<-read.table("sample01.csv", sep=",")
ここまで問題なし。
以下を実行時にエラーが出た。
> xcol<-table[c(seq(7,246,2))]
Error in table[c(seq(7, 246, 2))] :
object of type 'closure' is not subsettable
read.table()で読込んだのはxtable
で、xcol
に代入しようとしていたのはtable
という間違いをしていた。以下のようにxtableにしたらエラーがなくなった。
> xcol<-xtable[c(seq(7,246,2))]
エラーメッセージを読んだだけでは何が「not subsettable」なのか分からなかった。
エラーメッセージを元に対応方法を探す前に、コマンドの打ち間違いの確認をすべきだろう。