R 2.5.0 の変更予定
注意:オリジナル文書中のすべてを翻訳・記載しているわけではありません。
> x <- rep(TRUE, 500) > str(x) logi [1:500] TRUE TRUE TRUE TRUE TRUE TRUE ...R2.4.0 まで
> x <- rep(TRUE, 500) > str(x) logi [1:500] TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE ...
> class(abs(-10L)) [1] "integer"R2.4.1 まで
> class(abs(-10L)) エラー:"class(abs(-10L" に構文エラーがありました
> file_test("-f", "test.dat") # ファイルか? [1] TRUE > file_test("-d", "test.dat") # ディレクトリか? [1] FALSE > file_test("-nt", "test.dat", "test2.dat") # 新しいか? [1] FALSE
> x <- "abc.def" > x [1] "abc.def" > x <- "abc\.def" Warning messages: 1: '\.' is an unrecognized escape in a character string 2: '\.' is an unrecognized escape in a character string > x [1] "abc.def" > x <- "abc\\.def" > x [1] "abc\\.def"R2.4.0 まで
> x <- "abc.def" > x [1] "abc.def" > x <- "abc\.def" > x [1] "abc.def" > x <- "abc\\.def" > x [1] "abc\\.def"
> vec <- c("formatUL", "formatOL") > formatUL(vec) # 番号なし箇条書き [1] "* formatUL" "* formatOL" > formatOL(vec) # 番号つき箇条書き [1] "1. formatUL" "2. formatOL" ----------- > lst <- matrix(c("formatDL", "formatUL", "項目名とその定義", "項目番号有り無しのリスト"), ncol=2) > formatDL(lst) # 項目と定義(表型) [1] "formatDL 項目名とその定義" [2] "formatUL 項目番号有り無しのリスト" > formatDL(lst, style="list") # 項目と定義(リスト型) [1] "formatDL: 項目名とその定義" [2] "formatUL: 項目番号有り無しのリスト"
> i <- sample(2006, 20, replace=TRUE) > r <- as.roman(i) > i [1] 1527 441 382 114 209 207 927 527 363 1563 1910 522 1203 [14] 705 88 1526 839 4 1977 1050 > r [1] MDXXVII CDXLI CCCLXXXII CXIV CCIX CCVII [7] CMXXVII DXXVII CCCLXIII MDLXIII MCMX DXXII [13] MCCIII DCCV LXXXVIII MDXXVI DCCCXXXIX IV [19] MCMLXXVII ML
> binom.test(1.000000001, 10.000000001, p=0.5) Exact binomial test data: 1.000000001 and 10.000000001 number of successes = 1, number of trials = 10, p-value = 0.02148 alternative hypothesis: true probability of success is not equal to 0.5 95 percent confidence interval: 0.002528579 0.445016117 sample estimates: probability of success 0.1R2.4.0 まで
> binom.test(1.000000001, 10.000000001, p=0.5) 以下にエラーbinom.test(1.000000001, 10.000000001, p = 0.5) : 'x' は非負整数でなければなりません
> withVisible(x <- 1) $value [1] 1 $visible [1] FALSE > withVisible((x <- 1)) $value [1] 1 $visible [1] TRUE
> system.time(sin(x)) user system total user.children system.children 0.000 0.001 0.013 0.000 0.000
> class(100) [1] "numeric" > class(100L) [1] "integer" > x <- 1:10L > class(x) [1] "integer"
> uniroot(function(x) (x-2)*(x+3), lower=2, upper=10) 以下にエラーuniroot(function(x) (x - 2) * (x + 3), lower = 2, upper = 10) : f() の端点での値が異なった符号を持ちませんR2.5.0
> uniroot(function(x) (x-2)*(x+3), lower=2, upper=10) $root [1] 2 $f.root [1] 0 $iter [1] 0 $estim.prec [1] 0
> cut(1:10, 3) [1] (0.991,4] (0.991,4] (0.991,4] (4,7] (4,7] (4,7] (4,7] [8] (7,10] (7,10] (7,10] Levels: (0.991,4] (4,7] (7,10] > cut(1:10, 3, ordered_result=TRUE) [1] (0.991,4] (0.991,4] (0.991,4] (4,7] (4,7] (4,7] (4,7] [8] (7,10] (7,10] (7,10] Levels: (0.991,4] < (4,7] < (7,10]Levels: の行を見ればわかるが < があるのとないのとの違い。また,class は,前者が "factor" だけであるのに対して,後者は "factor" と "ordered" である。
> apropos("AIC") [1] "AIC.independence" "AIC" "extractAIC" [4] "mosaicplot" > apropos("aic") [1] "AIC.independence" "AIC" "extractAIC" [4] "mosaicplot"R2.4.0 まで
> apropos("AIC") [1] "AIC.independence" "AIC" "extractAIC" > apropos("aic") [1] "mosaicplot"
> apropos(AIC) # 文字列でなくても良くなった [1] "AIC.independence" "AIC" "extractAIC" [4] "mosaicplot"
% cat test.R sqrt(8) sin(9) % R -f test.R R version 2.5.0 Under development (unstable) (2007-01-11 r40446) Copyright (C) 2007 The R Foundation for Statistical Computing ISBN 3-900051-07-0 【中略】 [以前にセーブされたワークスペースを復帰します] > sqrt(8) [1] 2.828427 > sin(9) [1] 0.4121185 %
> min("book", "apple", "pen") [1] "apple" > max("book", "apple", "pen") [1] "pen" > range("book", "apple", "pen") [1] "apple" "pen"
> substr("abcdef", NA, 3) [1] NA > substr("abcdef", 2, NA) [1] NA > substr("abcdef", NA, NA) [1] NAR2.4.1 まで
> substr("abcdef", NA, 3) [1] "abc" > substr("abcdef", 2, NA) [1] "" > substr("abcdef", NA, NA) [1] ""