Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
値によって変数を作成できることを知っています。eg はhereおよびhereで説明されています。同様の方法で、x の値によってリスト a からメンバー変数を作成することは可能ですか?
x<-"name" a<-list( [here should place the value of x to declare the variable "name"]=1:5)
S4オブジェクトの初期化でそれを行うのが好きなので、初期化後にdimnamesを変更するような回避策を探していません。
これが必要だと思います:
x<-"name" a<-list() a[[x]] <- 1:5
> a $name [1] 1 2 3 4 5