R) 4.0.0 업데이트!

R) 4.0.0 업데이트!

2020년 4월 24일(금)에 “Arbor Day”라는 이름의 R 4.0.0 이 배포되었다. 어떤 사항이 바뀌었는지 알아보도록 하자.

기본적으로 원문을 기술하고 그 밑에 해석 전체 또는 일부를 덧붙여서 예상되는 이슈나 관련 예제를 추가하였다.

가시적인 변화(SIGNIFICANT USER-VISIBLE CHANGES)

  • Packages need to be (re-)installed under this version (4.0.0) of R.

    • 기존에 4.0.0 버전보다 낮은 R을 사용하고 있었다면 패키지를 다시 설치해야 한다.
    • 필자는 그래서 기존에 설치된 3.6.3 버전 및 패키지를 전부 삭제하고 재설치 하였다.
    • R 4.0.0은 최신 버전(40)의 Rtools 설치를 권장한다. cran에서 다운로드 할 수 있다.
  • matrix objects now also inherit from class “array”, so e.g., class(diag(1)) is c(“matrix”, “array”). This invalidates code incorrectly assuming that class(matrix_obj)) has length one.

    • matrix 객체는 이제 “array”객체에 상속된다. 예를 들어 class(diag(1))c("matrix", "array") 이다. class(matrix_obj)의 길이가 1이라고 잘못 가정하는 경우 코드가 무효화 된다.
    • 이 것은 코드 작성시 matrix 객체의 속성을 class() 함수로 검사할 때 결과 값의 길이를 1로 하는 경우 에러가 날 수 있다는 뜻이다.
    • 특히 패키지 레벨 코딩의 경우 특정 객체의 속성을 확인하여 별도 처리를 하는 경우가 있는데 기존에 class() 함수의 출력값 길이가 1이어서 2개 이상의 원소를 가지는 벡터에 대한 처리가 미흡할 것이라고 예상됨.
    • 관련 코드가 있는 패키지는 모두 이 부분을 반영해서 수정해야 할 것임

    S3 methods for class “array” are now dispatched for matrix objects.

    • “array” class에 대한 S3 메소드는 이제 matrix 객체에 전달된다.

버전별로 비교를 해보자.

R 3.6.3 의 결과는 다음과 같다.

1
2
class(matrix(1))
## [1] "matrix"

R 4.0.0 의 결과는 다음과 같다.

1
2
class(matrix(1))
## [1] "matrix" "array"

상위 class인 “array”가 뒤에 표시되는 것을 볼 수 있다.

  • There is a new syntax for specifying raw character constants similar to the one used in C++: r”(…)” with … any character sequence not containing the sequence )”. This makes it easier to write strings that contain backslashes or both single and double quotes. For more details see ?Quotes.

    • C++의 r"(...)" 처럼 원시(raw) 문자열을 ~~. 보다 자세한 내용은 ?Quotes 로 확인 가능.
  • R now uses a stringsAsFactors = FALSE default, and hence by default no longer converts strings to factors in calls to data.frame() and read.table().

    • R은 이제 stringsAsfactors = FALSE를 기본으로 사용한다. 이제 더이상 data.frame()이나 read.table() 함수가 string을 factor형식으로 변환하지 않는다.
    • 이것은 정말 반가워해야 할 일이다. 이것 때문에 파일을 읽을 때 stringsAsfactors = FALSE를 꼭 선언하거나 다음과 같은 코드를 사용했어야 했다.
1
# options(stringsAsfactors = FALSE)

A large number of packages relied on the previous behaviour and so have needed/will need updating.

  • 제법 많은 패키지가 이와 관련되어 있기 때문에 최신화가 필요할 것이다.
  • The plot() S3 generic function is now in package base rather than package graphics, as it is reasonable to have methods that do not use the graphics package. The generic is currently re-exported from the graphics namespace to allow packages importing it from there to continue working, but this may change in future.
    • S3 기본(generic) 함수인 plot() 함수는 이제 graphics 패키지가 아닌 base 패키지에 들어간다.
    • 이 기본 함수(plot())는 현재 관련 패키지가 이 버전에서도 잘 동작하도록 graphics 이름공간(namespace)에서 재추출 할 수 있도록 되어있으나, 향후 변경 예정.
    • 이 변경사항은 향후 기존 코드가 graphics::plot() 처럼 패키지를 포함하여 함수를 선언하였을 경우 문제가 발생할 수 있다.

R 4.0.0에서 확인하는 코드는 다음과 같다.

1
2
graphics::plot(1:10) # 1
base::plot(1:10) # 2

위 코드는 모두 정상 동작하며 오류가 발생하지 않는다. 하지만 향후 버전업이 되면서 1번 코드는 동작하지 않을 것이다.

Packages which define S4 generics for plot() should be re-installed and package code using such generics from other packages needs to ensure that they are imported rather than rely on their being looked for on the search path (as in a namespace, the base namespace has precedence over the search path).

참조 계산(REFERENCE COUNTING)

  • Reference counting is now used instead of the NAMED mechanism for determining when objects can be safely mutated in base C code. This reduces the need for copying in some cases and should allow further optimizations in the future. It should help make the internal code easier to maintain.

    • ~~??. 이는 내부 코드 유지보수를 보다 쉽게 해줄것이다.

    This change is expected to have almost no impact on packages using supported coding practices in their C/C++ code.

    • 이 변경사항은 C/C++ 코드를 사용하는 패키지에 거의 영향이 었을 것으로 예상된다.

PCRE2 ??? (MIGRATION TO PCRE2)

  • This version of R is built against the PCRE2 library for Perl-like regular expressions, if available. (On non-Windows platforms PCRE1 can optionally be used if PCRE2 is not available at build time.) The version of PCRE in use can be obtained via extSoftVersion(): PCRE1 (formerly known as ‘PCRE’) has versions <= 8, PCRE2 versions >= 10.

  • Making PCRE2 available when building R from source is strongly recommended (preferably version 10.30 or later) as PCRE1 is no longer developed: version 8.44 is ‘likely to be the final release’.

  • PCRE2 reports errors for some regular expressions that were accepted by PCRE1. A hyphen now has to be escaped in a character class to be interpreted as a literal (unless first or last in the class definition). \R, \B and \X are no longer allowed in character classes (PCRE1 treated these as literals).

  • Option PCRE_study is no longer used with PCRE2, and is reported as FALSE when that is in use.

신규 기능(NEW FEATURES)

  • assertError() and assertWarning() (in package tools) can now check for specific error or warning classes via the new optional second argument classes (which is not back compatible with previous use of an unnamed second argument).

    • (패키지 도구에 있는) assertError()assertWarning() 함수로 이제 두 번째 선택적 인자의 속성(class)에 따라서 특정한 error 또는 warning 클래스를 확인할 수 있다.
  • DF2formula(), the utility for the data frame method of formula(), now works without parsing and explicit evaluation, starting from Suharto Anggono’s suggestion in PR#17555.

    • DF2formula() 함수는 formula() 함수의 데이터프레임 메서드를 위한 응용 함수이며, 이제

그렇다면 데이터프레임을 DF2formula() 함수에 넣어보면 어떨까?

1
2
DF2formula(head(iris))
## Sepal.Length ~ Sepal.Width + Petal.Length + Petal.Width + Species

기존에는 formula를 만들기 위해 colnames()paste() 함수를 쓰던지 꽤나 번거로웠다. 물론 사용자 정의 함수로 이를 만드는 것은 그리 어려운 일은 아니나 이 것을 기본함수로 지정해주는 것은 매우 반가운 일이다. 이 함수를 사용함으로 해서 cbind(), tibble::add_column() 함수를 추가로 사용할 수 있으며 예제는 다음과 같다.

1
2
3
4
5
6
7
8
9
10
df = data.frame(x1 = 20:22, x2 = 30:32)
df_bind = cbind(y = 10:12, df)
df_bind
## y x1 x2
## 1 10 20 30
## 2 11 21 31
## 3 12 22 32

DF2formula(df_bind)
## y ~ x1 + x2

1
2
3
4
5
6
7
8
9
10
11
library("tibble")
df = data.frame(x1 = 20:22, x2 = 30:32)
df = add_column(df, y = 10:12, .before = "x1")
df
## y x1 x2
## 1 10 20 30
## 2 11 21 31
## 3 12 22 32

DF2formula(df)
## y ~ x1 + x2
  • approxfun() and approx() gain a new argument na.rm defaulting to true. If set to false, missing y values now propagate into the interpolated values.

    • approxfun()approx() 함수는 이제 na.rm 인자의 기본값이 TRUE로 지정된다. FALSE로 지정되는 경우 결측치가 보간된(interpolated) 값으로 전달된다.
  • Long vectors are now supported as the seq argument of a for() loop.

  • str(x) gets a new deparse.lines option with a default to speed it up when x is a large call object.

    • str(x) 함수는 객체 x가 큰 경우 속도를 내기 위해서 새로운 deparse.lines 인자가 기본값으로 지정된다.
    • 즉, str() 함수가 입력되는 객체 x의 특성상 출력물이 많은 경우 속도가 좀 느렸는데 이를 개선함.
  • The internal traceback object produced when an error is signalled (.Traceback), now contains the calls rather than the deparse()d calls, deferring the deparsing to the user-level functions .traceback() and traceback(). This fulfils the wish of PR#17580, reported including two patch proposals by Brodie Gaslam.

  • data.matrix() now converts character columns to factors and from this to integers.

    • data.matrix() 함수는 이제 문자 변수를 factor로 변환하고 factor에서 정수를 뽑아낸다.

R 3.6.3 의 결과는 다음과 같다.

1
2
3
4
5
data.matrix(data.frame(aa = 1:3, bb = letters[1:3]))
## aa bb
## [1,] 1 NA
## [2,] 2 NA
## [3,] 3 NA

R 4.0.0 의 결과는 다음과 같다.

1
2
3
4
5
6
7
8
9
aa = data.matrix(data.frame(aa = 1:3, bb = letters[1:3]))
aa
## aa bb
## [1,] 1 1
## [2,] 2 2
## [3,] 3 3

class(aa)
## [1] "matrix" "array"

matrix 객체는 숫자 또는 문자 하나의 class만 허용한다. 하지만 기존에 data.matrix() 함수를 사용하는 경우 두 변수가 같이 유입이 되는 경우 이를 처리할 방법이 마땅히 없어 결측치를 출력하였다. 하지만 4.0.0 버전에서는 factor의 성질을 이용하여 결측치 대신 숫자만 남기고 있다.

  • package.skeleton() now explicitly lists all exports in the NAMESPACE file.

  • New function .S3method() to register S3 methods in R scripts.

    • R 스크립트에 S3 메서드를 등록하기 위한 .S3methos() 함수 신규 등록.
  • file.path() has some support for file paths not in the session encoding, e.g. with UTF-8 inputs in a non-UTF-8 locale the output is marked as UTF-8.

    • file.path() 함수는 현재 세션과 맞지 않은 인코딩의 파일 경로도 지원함. 예를 들어 UTF-8이 아닌(non-UTF-8) 환경(locale)에서 UTF-8이 입력된경우 UTF-8로 명시되어 출력됨.
    • R의 단점 중 하나가 인코딩 관련 지원이 취약했는데 이 부분이 개선됨
    • Windows 운영체제에서 한글 계정명을 사용하는 경우 경로문제로 패키지를 사용하지 못하는 등 문제가 좀 있는데 이 점이 해결될 것으로 예상됨(확인 필요)
  • Most functions with file-path inputs will give an explicit error if a file-path input in a marked encoding cannot be translated (to the native encoding or in some cases on Windows to UTF-8), rather than translate to a different file path using escapes. Some (such as dir.exists(), file.exists(), file.access(), file.info(), list.files(), normalizePath() and path.expand()) treat this like any other non-existent file, often with a warning.

  • There is a new help document accessed by help(“file path encoding”) detailing how file paths with marked encodings are handled.

    • 새로운 도움말 문서는 help("file path encoding")를 입력해서 확인할 수 있으며 지정된 인코딩을 가지는 파일 경로를 다루는 방법을 자세하게 소개함.
  • New function list2DF() for creating data frames from lists of variables.

    • 리스트를 데이터프레임으로 만들기 위해 list2DF() 함수 신규 등록.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
list2DF(x = list(aa = 1:3, bb = LETTERS[1:5])) # 1
## aa bb
## 1 1 A
## 2 2 B
## 3 3 C
## 4 1 D
## 5 2 E

as.data.frame(list(aa = 1:3, bb = LETTERS[1:5])) # 2
## Error in (function (..., row.names = NULL, check.rows = FALSE, check.names = TRUE, :
## arguments imply differing number of rows: 3, 5

as.data.frame(list(aa = 1:3, bb = LETTERS[1:3])) # 3
## aa bb
## 1 1 A
## 2 2 B
## 3 3 C

신규 함수 list2DF() 함수를 사용한 1번 코드의 경우 list 객체 내부의 길이가 서로 상이해도 벡터 리사이클링이 적용되면서 정상적으로 데이터프레임이 반환된다. 하지만 as.data.frame() 함수를 사용한 2번 코드의 경우 row 개수가 다르다며 에러를 출력한다. 기존에 list 객체를 데이터프레임으로 바꾸기 위해 as.data.frame() 함수를 사용하여왔으나 list 내부 객체의 변수 길이가 같아야 비로소 변환되는 불편함이 있었다. 물론 벡터 리사이클링이 적용되면 에러가 발생하지 않는 장점이 있지만, 이를 사전에 인지하지 못할 경우 에러메세지가 발생하지 않아 문제가 생길 수 있다.

  • iconv() has a new option sub = “Unicode” to translate UTF-8 input invalid in the to encoding using <U+xxxx> escapes.

    • iconv() 함수가 <U+xxxx> 형식으로 입력된 UTF-8 형식을 변환하기 위해서 새로운 옵션 sub = "Unicode"를 지원한다.
  • There is a new function infoRDS() providing information about the serialization format of a serialized object.

    • 신규 함수 infoRDS()는 serialization 형식과 serialized 객체 정보를 지원한다.
    • 기존에는 saveRDS() 함수와 readRDS() 함수로 RDS 파일 입출력만 지원했으나 로컬 파일 또는 connection의 정보를 조회할 수 있게 되었다.
  • S3 method lookup now by default skips the elements of the search path between the global and base environments.

  • Added an argument add_datalist(*, small.size = 0) to allow the creation of a data/datalist file even when the total size of the data sets is small.

  • The backquote function bquote() has a new argument splice to enable splicing a computed list of values into an expression, like ,@ in LISP’s backquote.

  • The formula interface to t.test() and wilcox.test() has been extended to handle one-sample and paired tests.

  • The palette() function has a new default set of colours (which are less saturated and have better accessibility properties). There are also some new built-in palettes, which are listed by the new palette.pals() function. These include the old default palette under the name “R3”. Finally, the new palette.colors() function allows a subset of colours to be selected from any of the built-in palettes.

  • n2mfrow() gains an option asp = 1 to specify the aspect ratio, fulfilling the wish and extending the proposal of Michael Chirico in PR#17648.

  • For head(x, n) and tail() the default and other S3 methods notably for vector n, e.g. to get a “corner” of a matrix, has been extended to array’s of higher dimension thanks to the patch proposal by Gabe Becker in PR#17652. Consequently, optional argument addrownums is deprecated and replaced by the (more general) argument keepnums. An invalid second argument n now leads to typically more easily readable error messages.

  • New function .class2() provides the full character vector of class names used for S3 method dispatch.

  • Printing methods(..) now uses a new format() method.

  • sort.list(x) now works for non-atomic objects x and method = “auto” (the default) or “radix” in cases order(x) works.

  • Where they are available, writeBin() allows long vectors.

  • New function deparse1() produces one string, wrapping deparse(), to be used typically in deparse1(substitute(*)), e.g., to fix PR#17671.

  • wilcox.test() enhancements: In the (non-paired) two-sample case, Inf values are treated as very large for robustness consistency. If exact computations are used, the result now has “exact” in the method element of its return value. New arguments tol.root and digits.rank where the latter may be used for stability to treat very close numbers as ties.

  • readBin() and writeBin() now report an error for an invalid endian value. The affected code needs to be fixed with care as the old undocumented behavior was to swap endian-ness in such cases.

  • sequence() is now an S3 generic with an internally implemented default method, and gains arguments to generate more complex sequences. Based on code from the S4Vectors Bioconductor package and the advice of Herv’e Pag`es.

  • print()’s default method and many other methods (by calling the default eventually and passing …) now make use of a new optional width argument, avoiding the need for the user to set and reset options(“width”).

  • memDecompress() supports the RFC 1952 format (e.g. in-memory copies of gzip-compressed files) as well as RFC 1950.

    • memDecompress() 함수는 이제 RFC 1950 형식과 더불어 RFC 1952 형식(예시. gzip 압축파일 같은 인메모리 복사본)도 지원한다.
  • memCompress() and memDecompress() support long raw vectors for types “gzip” and “zx”.

    • memCompress()memDecompress() 함수는 이제 “gzip”과 “zx” 형식을 위한 긴 원시 벡터를 지원한다.
  • sweep() and slice.index() can now use names of dimnames for their MARGIN argument (apply has had this for almost a decade).

    • 이제 sweep()slice.index() 함수의 MARGIN 인자에 dimnames의 명칭을 사용할 수 있다(apply() 함수는 거의 10년 전 즈음에 적용됨).

sweep() 함수의 MARGIN 설명은 다음과 같다.

  • R 3.6.3: a vector of indices giving the extent(s) of x which correspond to STATS.
  • R 4.0.0: a vector of indices giving the extent(s) of x which correspond to STATS. Where x has named dimnames, it can be a character vector selecting dimension names.

matrix 객체의 apply() 함수 활용 연산은 다음과 같다.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
mat = matrix(1:6, nrow = 2, 
dimnames = list(row_name = c("A", "B"),
col_name = c("col1", "col2", "col3")))
mat
## col_name
## row_name col1 col2 col3
## A 1 3 5
## B 2 4 6

apply(X = mat, MARGIN = 1, FUN = "sum")
## A B
## 9 12

apply(X = mat, MARGIN = "row_name", FUN = "sum")
## A B
## 9 12

matrix 객체의 sweep() 함수 활용 연산은 다음과 같다.

1
2
3
4
5
6
7
8
9
10
11
sweep(x = mat, MARGIN = 1, STATS = c(2, 4), FUN = "+")
## col_name
## row_name col1 col2 col3
## A 3 5 7
## B 6 8 10

sweep(x = mat, MARGIN = "row_name", STATS = c(2, 4), FUN = "+")
## col_name
## row_name col1 col2 col3
## A 3 5 7
## B 6 8 10
  • New function proportions() and marginSums(). These should replace the unfortunately named prop.table() and margin.table(). They are drop-in replacements, but also add named-margin functionality. The old function names are retained as aliases for back-compatibility.

  • Functions rbinom(), rgeom(), rhyper(), rpois(), rnbinom(), rsignrank() and rwilcox() which have returned integer since R 3.0.0 and hence NA when the numbers would have been outside the integer range, now return double vectors (without NAs, typically) in these cases.

  • matplot(x,y) (and hence matlines() and matpoints()) now call the corresponding methods of plot() and lines(), e.g, when x is a “Date” or “POSIXct” object; prompted by Spencer Graves’ suggestion.

  • stopifnot() now allows customizing error messages via argument names, thanks to a patch proposal by Neal Fultz in PR#17688.

  • unlink() gains a new argument expand to disable wildcard and tilde expansion. Elements of x of value “~” are now ignored.

  • mle() in the stats4 package has had its interface extended so that arguments to the negative log-likelihood function can be one or more vectors, with similar conventions applying to bounds, start values, and parameter values to be kept fixed. This required a minor extension to class “mle”, so saved objects from earlier versions may need to be recomputed.

  • The default for pdf() is now useDingbats = FALSE.

  • The default fill colour for hist() and boxplot() is now col = “lightgray”.

  • The default order of the levels on the y-axis for spineplot() and cdplot() has been reversed.

  • If the R_ALWAYS_INSTALL_TESTS environment variable is set to a true value, R CMD INSTALL behaves as if the –install-tests option is always specified. Thanks to Reinhold Koch for the suggestion.

  • New function R_user_dir() in package tools suggests paths appropriate for storing R-related user-specific data, configuration and cache files.

  • capabilities() gains a new logical option Xchk to avoid warnings about X11-related capabilities.

  • The internal implementation of grid units has changed, but the only visible effects at user-level should be

    • a slightly different print format for some units (especially unit arithmetic), faster performance (for unit operations) and two new functions unitType() and unit.psum().

    Based on code contributed by Thomas Lin Pedersen.

  • When internal dispatch for rep.int() and rep_len() fails, there is an attempt to dispatch on the equivalent call to rep().

  • Object .Machine now contains new longdouble.* entries (when R uses long doubles internally).

  • news() has been enhanced to cover the news on R 3.x and 2.x.

  • For consistency, N <- NULL; N[[1]] <- val now turns N into a list also when val) has length one. This enables dimnames(r1)[[1]] <- “R1” for a 1-row matrix r1, fixing PR#17719 reported by Serguei Sokol.

  • deparse(..), dump(..), and dput(x, control = “all”) now include control option “digits17” which typically ensures 1:1 invertibility. New option control = “exact” ensures numeric exact invertibility via “hexDigits”.

  • When loading data sets via read.table(), data() now uses LC_COLLATE=C to ensure locale-independent results for possible string-to-factor conversions.

  • A server socket connection, a new connection type representing a listening server socket, is created via serverSocket() and can accept multiple socket connections via socketAccept().

  • New function socketTimeout() changes the connection timeout of a socket connection.

  • The time needed to start a homogeneous PSOCK cluster on localhost with many nodes has been significantly reduced (package parallel).

  • New globalCallingHandlers() function to establish global condition handlers. This allows registering default handlers for specific condition classes. Developed in collaboration with Lionel Henry.

  • New function tryInvokeRestart() to invoke a specified restart if one is available and return without signaling an error if no such restart is found. Contributed by Lionel Henry in PR#17598.

  • str(x) now shows the length of attributes in some cases for a data frame x.

  • Rprof() gains a new argument filter.callframes to request that intervening call frames due to lazy evaluation or explicit eval() calls be omitted from the recorded profile data. Contributed by Lionel Henry in PR#17595.

  • The handling of ${FOO-bar} and ${FOO:-bar} in Renviron files now follows POSIX shells (at least on a Unix-alike), so the first treats empty environment variables as set and the second does not. Previously both ignored empty variables. There are several uses of the first form in etc/Renviron.

  • New classes argument for suppressWarnings() and suppressMessages() to selectively suppress only warnings or messages that inherit from particular classes. Based on patch from Lionel Henry submitted with PR#17619.

  • New function activeBindingFunction() retrieves the function of an active binding.

  • New “cairoFT” and “pango” components in the output of grSoftVersion().

  • New argument symbolfamily in cairo-based graphics devices and new function cairoSymbolFont() that can be used to provide the value for that argument.

운영체제(Windows)

  • Rterm now works also when invoked from MSYS2 terminals. Line editing is possible when command winpty is installed.

  • normalizePath() now resolves symbolic links and normalizes case of long names of path elements in case-insensitive folders (PR#17165).

    • normalizaPath() 함수는 특정 경로를 정규화 해준다. 즉, 슬래시나 역슬래시 표기 문제로 파일 입출력 경로가 잘못되는 것을 사전에 방지하고자 하는 목적으로 사용되는 함수이다. 아무튼 이게 개선되었다고 한다. 예제는 다음과 같다.
1
2
3
4
5
6
7
8
R.home()
## [1] "C:/PROGRA~1/R/R-40~1.0"

normalizePath(path = R.home())
## [1] "C:\\Program Files\\R\\R-4.0.0"

normalizePath(path = "C:/Program Files")
## [1] "C:\\Program Files"
  • md5sum() supports UTF-8 file names with characters that cannot be translated to the native encoding (PR#17633).

  • Rterm gains a new option –workspace to specify the workspace to be restored. This allows equals to be part of the name when opening via Windows file associations (reported by Christian Asseburg).

  • Rterm now accepts ALT+xxx sequences also with NumLock on. Tilde can be pasted with an Italian keyboard (PR#17679).

  • R falls back to copying when junction creation fails during package checking (patch from Duncan Murdoch).

삭제 및 삭제 예정(DEPRECATED AND DEFUNCT)

  • Make macro F77_VISIBILITY has been removed and replaced by F_VISIBILITY.

    • F77_VISIBILITY가 제거되고 F_VISIBILITY로 대체됨.
  • Make macros F77, FCPIFCPLAGS and SHLIB_OPENMP_FCFLAGS have been removed and replaced by FC, FPICFLAGS and SHLIB_OPENMP_FFLAGS respectively. (Most make programs will set F77 to the value of FC, which is set for package compilation. But portable code should not rely on this.)

  • The deprecated support for specifying C++98 for package installation has been removed.

  • R CMD config no longer knows about the unused settings F77 and FCPIFCPLAGS, nor CXX98 and similar.

  • Either PCRE2 or PCRE1 >= 8.32 (Nov 2012) is required: the deprecated provision for 8.20-8.31 has been removed.

  • Defunct functions mem.limits(), .readRDS(), .saveRDS(),..find.package(), and .path.package() from package base and allGenerics(), getAccess(), getAllMethods(), getClassName(), getClassPackage(), getExtends(), getProperties(), getPrototype(), getSubclasses(), getVirtual(), mlistMetaName(), removeMethodsObject(), seemsS4Object(), traceOff(), and traceOn() from methods have been removed.

    • mem.limits() 함수는 메모리 상한을 조정하는 함수이다. 같은 기능을 하는 함수인 memory.limit()를 사용하면 된다.

C언어 수준의 기능 (C-LEVEL FACILITIES)

  • installChar is now remapped in Rinternals.h to installTrChar, of which it has been a wrapper since R 3.6.0. Neither are part of the API, but packages using installChar can replace it if they depend on R >= 3.6.2.

  • Header R_ext/Print.h defines R_USE_C99_IN_CXX and hence exposes Rvprintf and REvprintf if used with a C++11 (or later) compiler.

  • There are new Fortran subroutines dblepr1, realpr1 and intpr1 to print a scalar variable (gfortran 10 enforces the distinction between scalars and length-one arrays). Also labelpr to print just a label.

  • R_withCallingErrorHandler is now available for establishing a calling handler in C code for conditions inheriting from class error.

유닉스계열 운영체제에서의 설치(INSTALLATION on a UNIX-ALIKE)

  • User-set DEFS (e.g., in config.site) is now used for compiling packages (including base packages).

  • There is a new variant option –enable-lto=check for checking consistency of BLAS/LAPACK/LINPACK calls - see ‘Writing R Extensions’.

  • A C++ compiler default is set only if the C++11 standard is supported: it no longer falls back to C++98.

  • PCRE2 is used if available. To make use of PCRE1 if PCRE2 is unavailable, configure with option –with-pcre1.

  • The minimum required version of libcurl is now 7.28.0 (Oct 2012).

  • New make target distcheck checks

    • R can be rebuilt from the tarball created by make dist,

    • the build from the tarball passes make check-all,

    • the build installs and uninstalls,

    • the source files are properly cleaned by make distclean.

부가 지원 기능(UTILITIES)

  • R –help now mentions the option –no-echo (renamed from –slave) and its previously undocumented short form -s.

  • R CMD check now optionally checks configure and cleanup scripts for non-Bourne-shell code (‘bashisms’).

  • R CMD check –as-cran now runs \donttest examples (which are run by example()) instead of instructing the tester to do so. This can be temporarily circumvented during development by setting environment variable RCHECK_DONTTEST_EXAMPLES_ to a false value.

패키지 설치(PACKAGE INSTALLATION)

  • There is the beginnings of support for the recently approved C++20 standard, specified analogously to C++14 and C++17. There is currently only limited support for this in compilers, with flags such as -std=c++20 and -std=c++2a. For the time being the configure test is of accepting one of these flags and compiling C++17 code.

버그 수정(BUG FIXES)

  • formula(x) with length(x) > 1 character vectors, is deprecated now. Such use has been rare, and has ‘worked’ as expected in some cases only. In other cases, wrong x have silently been truncated, not detecting previous errors.

  • Long-standing issue where the X11 device could lose events shortly after startup has been addressed (PR#16702).

  • The data.frame method for rbind() no longer drops levels from factor columns by default (PR#17562).

  • available.packages() and hence install.packages() now pass their … argument to download.file(), fulfilling the wish of PR#17532; subsequently, available.packages() gets new argument quiet, solving PR#17573.

  • stopifnot() gets new argument exprObject to allow an R object of class expression (or other ‘language’) to work more consistently, thanks to suggestions by Suharto Anggono.

  • conformMethod() now works correctly in cases containing a “&& logic” bug, reported by Henrik Bengtsson. It now creates methods with “missing” entries in the signature. Consequently, rematchDefinition() is amended to use appropriate .local() calls with named arguments where needed.

  • format.default(*, scientific = FALSE) now corresponds to a practically most extreme options(scipen = n) setting rather than arbitrary n = 100.

  • format(as.symbol(“foo”)) now works (returning “foo”).

  • postscript(.., title = *) now signals an error when the title string contains a character which would produce corrupt PostScript, thanks to PR#17607 by Daisuko Ogawa.

  • Certain Ops (notably comparison such as ==) now also work for 0-length data frames, after reports by Hilmar Berger.

  • methods(class = class(glm(..))) now warns more usefully and only once.

  • write.dcf() no longer mangles field names (PR#17589).

  • Primitive replacement functions no longer mutate a referenced first argument when used outside of a complex assignment context.

  • A better error message for contour(*, levels = Inf).

  • The return value of contourLines() is no longer invisible().

  • The Fortran code for calculating the coefficients component in lm.influence() was very inefficient. It has (for now) been replaced with much faster R code (PR#17624).

  • cm.colors(n) etc no longer append the code for alpha = 1, “FF”, to all colors. Hence all eight *.colors() functions and rainbow() behave consistently and have the same non-explicit default (PR#17659).

  • dnorm had a problematic corner case with sd == -Inf or negative sd which was not flagged as an error in all cases. Thanks to Stephen D. Weigand for reporting and Wang Jiefei for analyzing this; similar change has been made in dlnorm().

  • The optional iter.smooth argument of plot.lm(), (the plot() method for lm and glm fits) now defaults to 0 for all glm fits. Especially for binary observations with high or low fitted probabilities, this effectively deleted all observations of 1 or 0. Also, the type of residuals used in the glm case has been switched to “pearson” since deviance residuals do not in general have approximately zero mean.

  • In plot.lm, Cook’s distance was computed from unweighted residuals, leading to inconsistencies. Replaced with usual weighted version. (PR#16056)

  • Time-series ts(*, start, end, frequency) with fractional frequency are supported more consistently; thanks to a report from Johann Kleinbub and analysis and patch by Duncan Murdoch in PR#17669.

  • In case of errors mcmapply() now preserves attributes of returned “try-error” objects and avoids simplification, overriding SIMPLIFY to FALSE. (PR#17653)

  • as.difftime() gets new optional tz = “UTC” argument which should fix behaviour during daylight-savings-changeover days, fixing PR#16764, thanks to proposals and analysis by Johannes Ranke and Kirill M”uller.

  • round() does a better job of rounding “to nearest” by measuring and “to even”; thanks to a careful algorithm originally prompted by the report from Adam Wheeler and then others, in PR#17668. round(x, dig) for negative digits is much more rational now, notably for large |dig|.

  • Inheritance information on S4 classes is maintained more consistently, particularly in the case of class unions (in part due to PR#17596 and a report from Ezra Tucker).

  • is() behaves more robustly when its argument class2 is a classRepresentation object.

  • The warning message when attempting to export an nonexistent class is now more readable; thanks to Thierry Onkelinx for recognizing the problem.

  • choose() misbehaved in corner cases where it switched n - k for k and n was only nearly integer (report from Erik Scott Wright).

  • mle() in the stats4 package had problems combining use of box constraints and fixed starting values (in particular, confidence intervals were affected).

  • Operator ? now has lower precedence than = to work as documented, so = behaves like <- in help expressions (PR#16710).

  • smoothEnds(x) now returns integer type in both cases when x is integer, thanks to a report and proposal by Bill Dunlap PR#17693.

  • The methods package does a better job of tracking inheritance relationships across packages.

  • norm(diag(c(1, NA)), “2”) now works.

  • subset() had problems with 0-col dataframes (reported by Bill Dunlap, PR#17721).

  • Several cases of integer overflow detected by the ‘undefined behaviour sanitizer’ of clang 10 have been circumvented. One in rhyper() may change the generated value for large input values.

  • dotchart() now places the y-axis label (ylab) much better, not overplotting labels, thanks to a report and suggestion by Alexey Shipunov.

  • A rare C-level array overflow in chull() has been worked around.

  • Some invalid specifications of the day-of-the-year (via %j, e.g. day 366 in 2017) or week plus day-of-the-week are now detected by strptime(). They now return NA but give a warning as they may have given random results or corrupted memory in earlier versions of R.

  • socketConnection(server = FALSE) now respects the connection timeout also on Linux.

  • socketConnection(server = FALSE) no longer leaks a connection that is available right away without waiting (e.g. on localhost).

  • Socket connections are now robust against spurious readability and spurious availability of an incoming connection.

  • blocking = FALSE is now respected also on the server side of a socket connection, allowing non-blocking read operations.

  • anova.glm() and anova.glmlist() computed incorrect score (Rao) tests in no-intercept cases. (Andr’e Gillibert, PR#17734)

  • summaryRprof() now should work correctly for the Rprof(*, memory.profiling=TRUE) case with small chunk size (and “tseries” or similar) thanks to a patch proposal by Benjamin Tyner, in PR#15886.

  • xgettext() ignores strings passed to ngettext(), since the latter is handled by xngettext(). Thanks to Daniele Medri for the report and all the recent work he has done on the Italian translations.

  • data(package = “P”) for P in base and stats no longer reports the data sets from package datasets (which it did for back compatibility for 16 years), fixing PR#17730.

  • x[[Inf]] (returning NULL) no longer leads to undefined behavior, thanks to a report by Kirill M”uller in PR#17756. Further, x[[-Inf]] and x[[-n]] now give more helpful error messages.

  • Gamma() family sometimes had trouble storing link name PR#15891

버그 수정 - Windows(BUG FIXES - Windows)

  • Sys.glob() now supports all characters from the Unicode Basic Multilingual Plane, no longer corrupting some (less commonly used) characters (PR#17638).

  • Rterm now correctly displays multi-byte-coded characters representable in the current native encoding (at least on Windows 10 they were sometimes omitted, PR#17632).

  • scan() issues with UTF-8 data when running in a DBCS locale have been resolved (PR#16520, PR#16584).

  • RTerm now accepts enhanced/arrow keys also with ConPTY.

  • R can can now be started via the launcher icon in a user documents directory whose path is not representable in the system encoding.

  • socketConnection(server = FALSE) now returns instantly also on Windows when connection failure is signalled.

  • Problems with UTF-16 surrogate pairs have been fixed in several functions, including tolower() and toupper() (PR#17645).

Your browser is out-of-date!

Update your browser to view this website correctly. Update my browser now

×