0
0

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 1

Rを学びたい(VSCodeで動かす)

Posted at

はじめに

最近、データ分析に興味を持ち始め、Rを学ぼうと思います。
PythonorRかちょっと悩んでたんですが、Rにしました。

環境構築

事前にRはインストールしてください。

サンプルコードの実行

sample.R
data <- data.frame(
  Name = c("Alice", "Bob", "Charlie", "David", "Eva"),
  Age = c(25, 30, 35, 40, 45),
  Score = c(90, 85, 88, 92, 95)
)

# データの確認
print("データフレームの内容:")
print(data)

# 平均年齢の計算
average_age <- mean(data$Age)
cat("平均年齢:", average_age, "\n")

# スコアの棒グラフを作成
barplot(
  data$Score,
  names.arg = data$Name,
  col = "blue",
  main = "Score by Person",
  xlab = "Person",
  ylab = "Score"
)

→実行すると下記のようなものができます。
image.png

0
0
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
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?