科学の箱

科学・IT・登山の話題

R

Rで日付データをhistgramで表示するときのポイント

投稿日:

Rでヒストグラムはhist()関数を使って描画する。この時与えるデータによりブレーク引数が異なることがわかった。

まず下記がデフォルトのhist()関数のヘルプである。

hist(x, breaks = "Sturges",
     freq = NULL, probability = !freq,
     include.lowest = TRUE, right = TRUE,
     density = NULL, angle = 45, col = NULL, border = NULL,
     main = paste("Histogram of" , xname),
     xlim = range(breaks), ylim = NULL,
     xlab = xname, ylab,
     axes = TRUE, plot = TRUE, labels = FALSE,
     nclass = NULL, warn.unused = TRUE, ...)

http://stat.ethz.ch/R-manual/R-devel/library/graphics/html/hist.html

次にこちらがDateをヒストグラムで描画するときのヘルプとなる。

## S3 method for class 'POSIXt'
hist(x, breaks, ...,
     xlab = deparse(substitute(x)),
     plot = TRUE, freq = FALSE,
     start.on.monday = TRUE, format)

## S3 method for class 'Date'
hist(x, breaks, ...,
     xlab = deparse(substitute(x)),
     plot = TRUE, freq = FALSE,
     start.on.monday = TRUE, format)

breaksについては以下のように説明している。

breaks a vector of cut points or number giving the number of intervals which x is to be cut into or an interval specification, one of "days", "weeks", "months", "quarters" or "years", plus "secs", "mins", "hours" for date-time objects.

Dateのデータである場合にはbreaksに指定するのは “days”, “weeks”,,,といった期間を意味する文字列である。

同じ関数であってもデータ型により引数も異なることは覚えておいたほうがよい。

メタ情報

inarticle



メタ情報

inarticle



-R
-

執筆者:


comment

メールアドレスが公開されることはありません。 * が付いている欄は必須項目です

関連記事

no image

conjoint分析の資料

マニュアル conjointパッケージ caFactorialDesign Rでconjointパッケージを利用した例 Rでコンジョイント分析 Rでコンジョイント分析 |極めて個人的なメモ コンジョイ …

no image

diag

3×3の対角行列を生成する > diag(3) [,1] [,2] [,3] [1,] 1 0 0 [2,] 0 1 0 [3,] 0 0 1 3×3の対角行列を生成し、対角 …

no image

検定力分析(パワーアナリシス)

研究に必要な精度に対するサンプル数を求めるための分析方法 下記が詳しい http://miuse.mie-u.ac.jp/bitstream/10076/11867/1/10C15625.pdf ht …

no image

Rによるやさしい統計学/7-分散分析

(1)学部によりテストの結果に有意な差があるかを調べる。 データはcsv形式で作成し、7_1_test_score.csvとする。以下はデータの内容。 法学部,文学部,理学部,工学部 75,62,65 …

no image

回帰分析

回帰分析の手順 データを取得する。 回帰分析をする意味があるかを検討する 回帰分析のモデルを検討する 回帰分析をする 回帰分析の結果について考察する 回帰分析のメモ 回帰分析では目的変数を説明できる変 …

2014年7月
« 6月   8月 »
 123456
78910111213
14151617181920
21222324252627
28293031  

side bar top



アーカイブ

カテゴリー