R 2.6.0 の変更予定
注意:オリジナル文書のすべてを翻訳・記載しているわけではありません。
> integrate(dnorm,0,2) 0.4772499 with absolute error < 5.3e-15 > integrate(dnorm,0,2,subdivisions=200) 0.4772499 with absolute error < 5.3e-15 > integrate(dnorm,0,2,subdiv=200) # 省略が許された 0.4772499 with absolute error < 5.3e-15
> integrate(dnorm,0,2) 0.4772499 with absolute error < 5.3e-15 > integrate(dnorm,0,2,subdivisions=200) 0.4772499 with absolute error < 5.3e-15 > integrate(dnorm,0,2,subdiv=200) # 省略は許されないようになった 以下にエラーf(x, ...) : 使われていない引数 (subdiv = 200) # subdib=20 は dnorm の引数だと思われてしまうのだ
> nchar("あいうえおabcde") [1] 20 > nchar("あいうえおabcde", type="chars") [1] 10 > nchar("あいうえおabcde", type="bytes") [1] 20 > nchar("あいうえおabcde", type="width") [1] 15
> nchar("あいうえおabcde") [1] 10 > nchar("あいうえおabcde", type="chars") [1] 10 > nchar("あいうえおabcde", type="bytes") [1] 20 > nchar("あいうえおabcde", type="width") [1] 15
> x <- c("abcd", "efgh", "abce") > abbreviate(x, 2) abcd efgh abce "abcd" "ef" "abce" > x <- c("abcd", "efgh", "abce") > abbreviate(x, 2, method="both") # "ce"が省略形といえるかどうかはかなり疑問 abcd efgh abce "ab" "ef" "ce"
> testDF <- data.frame(v1 = c(1,3,5,7,8,3,5,NA,4,5,7,9), + v2 = c(11,33,55,77,88,33,55,NA,44,55,77,99) ) > by1 <- c("red","blue",1,2,NA,"big",1,2,"red",1,NA,12) > by2 <- c("wet","dry",99,95,NA,"damp",95,99,"red",99,NA,NA) > df <- aggregate(x = testDF, by = list(by1, by2), FUN = "mean") > df Group.1 Group.2 v1 v2 1 1 95 5 55 2 2 95 7 77 3 1 99 5 55 4 2 99 NA NA 5 big damp 3 33 6 blue dry 3 33 7 red red 4 44 8 red wet 1 11 > class(df[,1]) # R 2.5.1 までは factor になった [1] "character" > class(df[,2]) # R 2.5.1 までは factor になった [1] "character"
> apropos("summary") [1] "summary.aov" "summary.aovlist" "summary.glm" [4] "summary.infl" "summary.lm" "summary.manova" [7] "summary.mlm" "summary.stepfun" "summaryRprof" [10] ".__C__summary.table" ".__M__Summary:base" ".__T__Summary:base" [13] "Summary" "Summary.Date" "Summary.POSIXct" [16] "Summary.POSIXlt" "Summary.data.frame" "Summary.difftime" [19] "Summary.factor" "Summary.package_version" "print.summary.table" [22] "summary" "summary.Date" "summary.POSIXct" [25] "summary.POSIXlt" "summary.connection" "summary.data.frame" [28] "summary.default" "summary.factor" "summary.matrix" [31] "summary.table"
> apropos("summary") [1] ".__C__summary.table" ".__M__Summary:base" ".__T__Summary:base" [4] "Summary" "Summary.Date" "Summary.POSIXct" [7] "Summary.POSIXlt" "Summary.data.frame" "Summary.difftime" [10] "Summary.factor" "Summary.numeric_version" "print.summary.table" [13] "summary" "summary.Date" "summary.POSIXct" [16] "summary.POSIXlt" "summary.aov" "summary.aovlist" [19] "summary.connection" "summary.data.frame" "summary.default" [22] "summary.factor" "summary.glm" "summary.infl" [25] "summary.lm" "summary.manova" "summary.matrix" [28] "summary.mlm" "summary.stepfun" "summary.table" [31] "summaryRprof"
> x <- 1:10 > attr(x, "dim") <- c(2,5) > attr(x, "dim") [1] 2 5 > attr(x, "di") [1] 2 5 > attr(x, "di", exact=TRUE) # 完全一致を要求する("di" というアトリビュートはない) NULL
> x <- c(1:5,3) > duplicated(x) [1] FALSE FALSE FALSE FALSE FALSE TRUE > duplicated(x, fromLast=TRUE) [1] FALSE FALSE TRUE FALSE FALSE FALSE > unique(x) [1] 1 2 3 4 5 > unique(x, fromLast=TRUE) [1] 1 2 4 5 3
> x <- data.frame(x=1:5, y=letters[1:5]) > row(x) 以下にエラーrow(x) : 'row/col' 関数の引数は行列でなければなりませんR 2.6.0 から
> x <- data.frame(x=1:5, y=letters[1:5]) > row(x) [,1] [,2] [1,] 1 1 [2,] 2 2 [3,] 3 3 [4,] 4 4 [5,] 5 5
> Add <- function(x) Reduce("+", x, 0) > Add(list(1, 2, 3)) > Filter function (f, x) { ind <- as.logical(sapply(x, f)) x[!is.na(ind) & ind] } <environment: namespace:base> > Map function (f, ...) mapply(f, ..., SIMPLIFY = FALSE) # mapply の特殊シュガーコートか <environment: namespace:base>
> sqrt(-1) [1] NaN Warning message: 計算結果が NaN になりました in: sqrt(-1) > read.table("foo") 以下にエラーfile(file, "r") : コネクションを開くことができません 追加情報: Warning message: ファイル 'foo' を開くことができません, 理由は'No such file or directory'です in: file(file, "r")
> sqrt(-1) [1] NaN Warning message: In sqrt(-1) : 計算結果が NaN になりました > read.table("foo") 以下にエラーfile(file, "r") : コネクションを開くことができません 追加情報: Warning message: In file(file, "r") : ファイル 'foo' を開くことができません, 理由は'No such file or directory'です
> sequence(c(3,2)) [1] 1 2 3 1 2 > sequence(c(-3,-2)) [1] 1 0 -1 -2 -3 1 0 -1 -2 > sequence(0) [1] 1 0 > sequence(-1) [1] 1 0 -1
> sequence(c(3,2)) [1] 1 2 3 1 2 > sequence(c(-3,-2)) 以下にエラーFUN(c(-3, -2)[[1L]], ...) : 引数は非負でなければなりません > sequence(0) integer(0) > sequence(-1) 以下にエラーFUN(-1[[1L]], ...) : 引数は非負でなければなりません
> match.arg(c("abcdef", "k"), c("abc", "defk", "jk"), several.ok=TRUE) 以下にエラーmatch.arg(c("abcdef", "jk"), c("abc", "defk", "jk"), several.ok = TRUE) : 'arg' は以下の一つでなければなりません: abc, defk, jk
> match.arg(c("abcdef", "j"), c("abc", "defk", "jk"), several.ok=TRUE) [1] "jk"
> julian(as.POSIXct("2007-09-01"), origin = as.POSIXct("1970-01-01", tz="GMT")) Time difference of 13756.62 days > julian(as.POSIXlt("2007-09-01"), origin = as.POSIXlt("1970-01-01", tz="GMT")) 以下にエラーjulian.POSIXt(as.POSIXlt("2007-09-01"), origin = as.POSIXlt("1970-01-01", : 'origin' は長さ 1 でなければなりません
> julian(as.POSIXct("2007-09-01"), origin = as.POSIXct("1970-01-01", tz="GMT")) Time difference of 13756.62 days > julian(as.POSIXlt("2007-09-01"), origin = as.POSIXlt("1970-01-01", tz="GMT")) Time difference of 13756.62 days
> HairEyeColor , , Sex = Male Eye Hair Brown Blue Hazel Green Black 32 11 10 3 Brown 38 50 25 15 Red 10 10 7 7 Blond 3 30 5 8 , , Sex = Female Eye Hair Brown Blue Hazel Green Black 36 9 5 2 Brown 81 34 29 14 Red 16 7 7 7 Blond 4 64 5 8
> HairEyeColor , , Sex = Male Eye Hair Brown Blue Hazel Green Black 32 11 10 3 Brown 53 50 25 15 Red 10 10 7 7 Blond 3 30 5 8 , , Sex = Female Eye Hair Brown Blue Hazel Green Black 36 9 5 2 Brown 66 34 29 14 Red 16 7 7 7 Blond 4 64 5 8
> chartr("a", "b", "abaあaba") [1] "bbb"
> chartr("a", "b", "abaあaba") [1] "bbbあbbb"