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.
行番号のベクトルに基づいて、データ フレームから値のベクトルを抽出しようとしています。
df<-iris x<-c(1,5,15,8,7,2)
ベクトル x にリストされている行番号の対応する Species が必要です。私は何かを試してみdf$Species[x,]ましdf$Species[list(x),]たが、役に立ちませんでした。答えは本当に単純なものだと確信していますが、私はそれを見ることができません!
df$Species[x,]
df$Species[list(x),]
前もって感謝します
試す
df[x,]$Species
また
df[,"Species"][x]
または実際に
df[x,"Species"]