0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

R > error > object of type 'closure' is not subsettable > オブジェクト名の入力間違い

Last updated at Posted at 2016-11-13
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」なのか分からなかった。
エラーメッセージを元に対応方法を探す前に、コマンドの打ち間違いの確認をすべきだろう。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?