Rで解析:listの操作に便利です。「listenv」パッケージ

Rを利用する上で欠かすことができないlist Class。list Classの操作に役に立つパッケージの紹介です。listの操作が楽々です。

パッケージのバージョンは0.9.0。実行コマンドはR version 4.2.2で確認しています。

パッケージのインストール

下記、コマンドを実行してください。

#パッケージのインストール
install.packages("listenv")

実行コマンド

詳細はコメント、パッケージのヘルプを確認してください。

#パッケージの読み込み
library("listenv")

#まずはlistenvの作成:listenvコマンド
TestList <- listenv(Int = 1:9, Cha = LETTERS[1:4])
TestList
A &lsquo;listenv&rsquo; vector with 2 elements (&lsquo;Int&rsquo;, &lsquo;Cha&rsquo;).

#list Class&#12395;&#22793;&#25563;&#12375;&#12390;&#12487;&#12540;&#12479;&#27083;&#36896;&#12434;&#30906;&#35469;
str(as.list(TestList))
List of 2
$ Int: int [1:9] 1 2 3 4 5 6 7 8 9
$ Cha: chr [1:4] "A" "B" "C" "D"

#listenv Class&#12395;&#12487;&#12540;&#12479;&#12434;&#36861;&#21152;
TestList$Karada <- "&#12363;&#12425;&#12384;&#12395;&#12356;&#12356;&#12418;&#12398;"
TestList
A &lsquo;listenv&rsquo; vector with 3 elements (&lsquo;Int&rsquo;, &lsquo;Cha&rsquo;, &lsquo;Karada&rsquo;).

#list Class&#12395;&#22793;&#25563;&#12375;&#12390;&#12487;&#12540;&#12479;&#27083;&#36896;&#12434;&#30906;&#35469;
str(as.list(TestList))
List of 3
$ Int   : int [1:9] 1 2 3 4 5 6 7 8 9
$ Cha   : chr [1:4] "A" "B" "C" "D"
$ Karada: chr "&#12363;&#12425;&#12384;&#12395;&#12356;&#12356;&#12418;&#12398;"

#&#25104;&#20998;&#25968;&#12398;&#30906;&#35469;
length(TestList)
[1] 3

少しでも、あなたの解析が楽になりますように!!

Prices and shipping availability may change. Please refer to the product page at time of purchase.
Content displayed on this site is provided by Amazon and may be updated or removed.
Amazon Associate, This site earns income through qualifying sales.
タイトルとURLをコピーしました