1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

RAdvent Calendar 2024

Day 12

Rを学びたい Step11 Excelデータを読み込む

Posted at

はじめに

Rを学びたいStep11です。今回はExcelデータを読み込みます。

読み込む対象

スクリーンショット 2024-11-23 19.07.25.png

ソースコード

excel_read.r
# パッケージをインストール
install.packages("readxl", repos = "https://cran.rstudio.com/")
library(readxl)  # パッケージの読み込み

# Excelファイルのパスを指定
file_path <- "./user_list.xlsx"

# シートを読み込む(適切なシート名を指定)
data <- read_excel(file_path, sheet = 1)

# データの確認
head(data)
実行結果
    `#` ユーザ名  年齢
  <dbl> <chr>    <dbl>
1     1 user_1      21
2     2 user_2      22
3     3 user_3      23
4     4 user_4      24
5     5 user_5      25
6     6 user_6      26
1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?