等値性と論理ベクトル
比較の結果は長い方に揃える、と思いきや。
> length(1)
[1] 1
> length(c(1, 2))
[1] 2
> 1 == c(1, 2)
[1] TRUE FALSE
> length(numeric(0))
[1] 0
> mode(numeric(0))
[1] "numeric"
> 1 == numeric(0)
logical(0)
>
このブログは、旧・はてなダイアリー「檜山正幸のキマイラ飼育記 メモ編」(http://d.hatena.ne.jp/m-hiyama-memo/)のデータを移行・保存したものであり、今後(2019年1月以降)更新の予定はありません。
今後の更新は、新しいブログ http://m-hiyama-memo.hatenablog.com/ で行います。
比較の結果は長い方に揃える、と思いきや。
> length(1)
[1] 1
> length(c(1, 2))
[1] 2
> 1 == c(1, 2)
[1] TRUE FALSE
> length(numeric(0))
[1] 0
> mode(numeric(0))
[1] "numeric"
> 1 == numeric(0)
logical(0)
>