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.
リストを任意の方法で並べ替える方法はありますか? たとえば、ベクトルを使用してリストを並べ替えます。
> a [[1]] [1] 1 [[2]] [1] "B" [[3]] [1] 2 > b = c(3, 1, 2) > magicfunction(a, b) [[1]] [1] 2 [[2]] [1] 1 [[3]] [1] "B"
単に再注文するということですか?
##Create some dummy data R> a = list(3) R> a[[1]] = 1; a[[2]] = "B"; a[[3]] = 2 R> b = c(3, 1, 2)
次に、数値ベクトルを使用して注文します。
R> a[b] [[1]] [1] 2 [[2]] [1] 1 [[3]] [1] "B"