| Line 1... |
Line 1... |
| 1 |
|
1 |
|
| 2 |
R Under development (unstable) (2022-03-19 r81942) -- "Unsuffered Consequences"
|
2 |
R Under development (unstable) (2026-07-08 r90215) -- "Unsuffered Consequences"
|
| 3 |
Copyright (C) 2022 The R Foundation for Statistical Computing
|
3 |
Copyright (C) 2026 The R Foundation for Statistical Computing
|
| 4 |
Platform: x86_64-pc-linux-gnu (64-bit)
|
4 |
Platform: x86_64-pc-linux-gnu
|
| 5 |
|
5 |
|
| 6 |
R is free software and comes with ABSOLUTELY NO WARRANTY.
|
6 |
R is free software and comes with ABSOLUTELY NO WARRANTY.
|
| 7 |
You are welcome to redistribute it under certain conditions.
|
7 |
You are welcome to redistribute it under certain conditions.
|
| 8 |
Type 'license()' or 'licence()' for distribution details.
|
8 |
Type 'license()' or 'licence()' for distribution details.
|
| 9 |
|
9 |
|
| Line 22... |
Line 22... |
| 22 |
> ## The mapping is
|
22 |
> ## The mapping is
|
| 23 |
> ## as printed: "dim", "dimnames", "names", "tsp", "levels"
|
23 |
> ## as printed: "dim", "dimnames", "names", "tsp", "levels"
|
| 24 |
> ## deparsed: ".Dim", ".Dimnames", ".Names", ".Tsp", ".Label"
|
24 |
> ## deparsed: ".Dim", ".Dimnames", ".Names", ".Tsp", ".Label"
|
| 25 |
> ## structure() remaps to the printed form.
|
25 |
> ## structure() remaps to the printed form.
|
| 26 |
>
|
26 |
>
|
| 27 |
> ## The remapping in deparse will be removed in R 4.2.0.
|
27 |
> ## The remapping in deparse has been removed in R 4.2.0.
|
| - |
|
28 |
> ## The re-remapping (e.g. from ".Dim" to "dim") is deprecated for R 4.7.0
|
| - |
|
29 |
>
|
| - |
|
30 |
> ## Now __warn__ about old names use:
|
| - |
|
31 |
> options(keep.parse.data = FALSE) -> op
|
| - |
|
32 |
> getVaW <- function(expr) { # obj = TRUE - version
|
| - |
|
33 |
+ W <- NULL
|
| - |
|
34 |
+ withCallingHandlers(val <- expr,
|
| - |
|
35 |
+ warning = function(w) {
|
| - |
|
36 |
+ W <<- w
|
| - |
|
37 |
+ invokeRestart("muffleWarning") })
|
| - |
|
38 |
+ structure(val %||% quote(._NULL_()), warning = W) # NULL cannot have attr.
|
| - |
|
39 |
+ }
|
| - |
|
40 |
> noW <- function(x) {attr(x, "warning") <- NULL ; x }
|
| - |
|
41 |
> chk_n_prt <- function(w) {
|
| - |
|
42 |
+ w <- attr(w,"warning")
|
| - |
|
43 |
+ cat(conditionMessage(w), "\n")
|
| - |
|
44 |
+ inherits(w, "deprecatedWarning")
|
| - |
|
45 |
+ }
|
| 28 |
>
|
46 |
>
|
| 29 |
> X <- matrix(1:4, 2, 2, dimnames=list(c("A", "B"), 1:2))
|
47 |
> X <- matrix(1:4, 2, 2, dimnames=list(c("A", "B"), 1:2))
|
| 30 |
> names(attributes(X))
|
48 |
> names(attributes(X))
|
| 31 |
[1] "dim" "dimnames"
|
49 |
[1] "dim" "dimnames"
|
| 32 |
> cat(deparse(X), "\n")
|
50 |
> cat(deparse(X), "\n")
|
| 33 |
structure(1:4, dim = c(2L, 2L), dimnames = list(c("A", "B"), c("1", "2")))
|
51 |
structure(1:4, dim = c(2L, 2L), dimnames = list(c("A", "B"), c("1", "2")))
|
| 34 |
> Y <- structure(1:4, .Dim = c(2L, 2L),
|
52 |
> w1 <- getVaW(structure(1:4, .Dim = c(2L, 2L),
|
| 35 |
+ .Dimnames = list(c("A", "B"), c("1", "2")))
|
53 |
+ .Dimnames = list(c("A", "B"), c("1", "2"))))
|
| 36 |
> identical(X, Y)
|
54 |
> stopifnot(chk_n_prt(w1), identical(noW(w1), X))
|
| 37 |
[1] TRUE
|
- |
|
| - |
|
55 |
Replacing special names '.Dim', '.Dimnames' is deprecated; use 'dim', 'dimnames' instead.
|
| 38 |
>
|
56 |
>
|
| 39 |
> z <- ts(1:10, frequency = 4, start = c(1959, 2))
|
57 |
> z <- ts(1:10, frequency = 4, start = c(1959, 2))
|
| 40 |
> attributes(z)
|
58 |
> attributes(z) # had '.Tsp' component, now 'tsp'
|
| 41 |
$tsp
|
59 |
$tsp
|
| 42 |
[1] 1959.25 1961.50 4.00
|
60 |
[1] 1959.25 1961.50 4.00
|
| 43 |
|
61 |
|
| 44 |
$class
|
62 |
$class
|
| 45 |
[1] "ts"
|
63 |
[1] "ts"
|
| 46 |
|
64 |
|
| 47 |
> cat(deparse(z), "\n")
|
65 |
> cat(deparse(z), "\n")
|
| 48 |
structure(1:10, tsp = c(1959.25, 1961.5, 4), class = "ts")
|
66 |
structure(1:10, tsp = c(1959.25, 1961.5, 4), class = "ts")
|
| 49 |
> z2 <- structure(1:10, .Tsp = c(1959.25, 1961.5, 4), class = "ts")
|
67 |
> w2 <- getVaW(structure(1:10, .Tsp = c(1959.25, 1961.5, 4), class = "ts"))
|
| 50 |
> identical(z, z2)
|
68 |
> stopifnot(chk_n_prt(w2), identical(noW(w2), z))
|
| 51 |
[1] TRUE
|
- |
|
| - |
|
69 |
Replacing special names '.Tsp' is deprecated; use 'tsp' instead.
|
| 52 |
>
|
70 |
>
|
| 53 |
> ## levels <-> .Label is most relevant to factors, but is always remapped.
|
71 |
> ## levels <-> .Label is most relevant to factors, but is always remapped; also .Dim :
|
| 54 |
> x <- 1:3
|
72 |
> x <- array(1:3, 3)
|
| 55 |
> attr(x, "levels") <- letters[x]
|
73 |
> attr(x, "levels") <- letters[x]
|
| 56 |
> cat(deparse(x), "\n")
|
74 |
> cat(deparse(x), "\n") # did show ' .Label = ..' but shows "levels = .." since 2021
|
| 57 |
structure(1:3, levels = c("a", "b", "c"))
|
75 |
structure(1:3, dim = 3L, levels = c("a", "b", "c"))
|
| 58 |
> y <- structure(1:3, .Label = c("a", "b", "c"))
|
76 |
> w3 <- getVaW(structure(1:3, .Label = c("a", "b", "c"), .Dim = 3L))
|
| 59 |
> identical(x, y)
|
77 |
> stopifnot(chk_n_prt(w3), identical(noW(w3), x))
|
| 60 |
[1] TRUE
|
- |
|
| - |
|
78 |
Replacing special names '.Label', '.Dim' is deprecated; use 'levels', 'dim' instead.
|
| 61 |
>
|
79 |
>
|
| 62 |
>
|
80 |
>
|
| 63 |
> ## Factors were long deparsed with double (rather than integer codes).
|
81 |
> ## factors were long deparsed with double (rather than integer codes).
|
| 64 |
> ## As from R 2.5.0 parsing such a deparse will given an error, so
|
82 |
> ## As from R 2.5.0 parsing such a deparse will given an error, so
|
| 65 |
> ## structure() coerces the codes to an integer vector.
|
83 |
> ## structure() coerces the codes to an integer vector.
|
| 66 |
> ## Example from an earlier version of Puromycin.R
|
84 |
> ## Example from an earlier version of Puromycin.R
|
| 67 |
> state <- structure(c(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
85 |
> state <- structure(c(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
| 68 |
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2),
|
86 |
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2),
|
| 69 |
+ .Label = c("treated", "untreated"), class = "factor")
|
87 |
+ levels = c("treated", "untreated"), class = "factor")
|
| 70 |
> typeof(state)
|
88 |
> typeof(state) # "integer" -- probably will become "double"
|
| 71 |
[1] "integer"
|
89 |
[1] "integer"
|
| 72 |
> storage.mode(state)
|
90 |
> storage.mode(state) # ditto
|
| 73 |
[1] "integer"
|
91 |
[1] "integer"
|
| 74 |
> attributes(state)
|
92 |
> attributes(state)
|
| 75 |
$levels
|
93 |
$levels
|
| 76 |
[1] "treated" "untreated"
|
94 |
[1] "treated" "untreated"
|
| 77 |
|
95 |
|
| Line 84... |
Line 102... |
| 84 |
+ 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L),
|
102 |
+ 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L),
|
| 85 |
+ levels = c("treated", "untreated"), class = "factor")
|
103 |
+ levels = c("treated", "untreated"), class = "factor")
|
| 86 |
> identical(state,state2)
|
104 |
> identical(state,state2)
|
| 87 |
[1] TRUE
|
105 |
[1] TRUE
|
| 88 |
>
|
106 |
>
|
| - |
|
107 |
> options(op) # in case this is source()d
|
| - |
|
108 |
>
|