
作業フォルダを指定
必ず作業フォルダを指定しておいてください(ファイルの読み込み Step2 参照)
行と列
Rではデータをベクトルの形にして処理します.「治療前」というベクトル(列)を作ってみましょう.
R
治療前 <- c(112, 138, 124, 120, 136, 142)
これを、Rにコピペしてみてください

このようになったら、「治療前」というベクトルをRが認識したことになります.ちゃんと入っているか確認してみましょう.
R
print(治療前)
と入力してリターンをクリックしてください(print関数はなくても出力できます)

Rは青文字で答えを返してくれます.これは、エクセルの列に該当します.
イメージはこんな感じです
R
View(治療前)

ベクトルは縦に並ばずに、横に並ぶので気持ち悪いかもしれませんが、慣れてください.横に並べたい場合は転置します.
R
t(治療前)

[1,]は1行目、[,1] は1列目を示します.よって、これは1行6列のことを意味しています.イメージはこんな感じです.
R
View(t(治療前))

次に2列のデータセットを作ってみます.イメージしやすくなります.data.frame関数で、2つのベクトルを合体させて2列のデータセットを作ります.dat という文字の中に2列からなるデータセットを格納します.
R
治療前 <- c(112, 138, 124, 120, 136, 142)
治療後 <- c(138, 139, 136, 130, 143, 140)
dat <- data.frame(治療前, 治療後)
print(dat)

イメージ
R
View(dat)

列の追加
dat というデータセットの中に性別というベクトル(列)を追加します.$は「~の中に」とか「~の中の」とか・・・いうイメージです.
R
dat$性別 <- c("男性", "男性", "女性", "男性", "女性", "女性")
print(dat)

R
View(dat)

要約
summary関数でデータセットの要約を出力できます
R
summary(dat)

性別がcharacterになっているので、factorに変更します
R
dat$性別 <- factor(dat$性別)
summary(dat)
性別の詳細を出力してくれます

コメント欄 『間違い』や『分かりにくい部分』などのご意見もお寄せください