Rで何かをしたり、読書をするブログ

政府統計の総合窓口のデータや、OECDやUCIやのデータを使って、Rの練習をしています。ときどき、読書記録も載せています。

UCI Machine Learning RepositoryのLetter Recognitionのデータの分析1 - Rにデータを取り込む。

今回は、UCI Machine Learning RepositoryのLetter Recognition

(Slate, D. (1991). Letter Recognition [Dataset]. UCI Machine Learning Repository. https://doi.org/10.24432/C5ZP40.)のデータを分析してみようと思います。

ダウンロードしたデータは、

こんな感じのテキストファイルでした。これをRに読み込んで分析していきます。

まず、tidyverseパッケージの読み込みをします。

次に、read.table()関数でファイルを読み込みます。

glimpse()関数でデータが読み込まれたかどうか確認します。

問題なく、読み込んだようです。

V1がアルファベットで、V2からV17の変数から予測する、という分類問題ですね。

 1. lettr capital letter (26 values from A to Z)
  2. x-box horizontal position of box (integer)
  3. y-box vertical position of box (integer)
  4. width width of box (integer)
  5. high  height of box (integer)
  6. onpix total # on pixels (integer)
  7. x-bar mean x of on pixels in box (integer)
  8. y-bar mean y of on pixels in box (integer)
  9. x2bar mean x variance (integer)
 10. y2bar mean y variance (integer)
 11. xybar mean x y correlation (integer)
 12. x2ybr mean of x * x * y (integer)
 13. xy2br mean of x * y * y (integer)
 14. x-ege mean edge count left to right (integer)
 15. xegvy correlation of x-ege with y (integer)
 16. y-ege mean edge count bottom to top (integer)
 17. yegvx correlation of y-ege with x (integer)

というのが各変数の意味ですが、今回は分類をすればいいので、V1, V2~ のままでいきます。

今回は以上です。

次回は、

www.crosshyou.info

です。

今回のコードは

#
# パッケージの読み込み
library(tidyverse)
#
# ファイルの読み込み
df_raw <- read.table("letter_recog.txt", sep = ",", header = FALSE)
#
# glimpse()関数で確認
glimpse(df_raw)
#

(冒頭の画像は Bing Image Creator で生成しました。プロンプトは Close up of Lagerstroemia indica flowers, landscape of vast green grass field under the sky, photo. です。)