|
1 | 1 | % File src/library/base/man/dput.Rd |
2 | 2 | % Part of the R package, https://www.R-project.org |
3 | | -% Copyright 1995-2014 R Core Team |
| 3 | +% Copyright 1995-2017 R Core Team |
4 | 4 | % Distributed under GPL 2 or later |
5 | 5 |
|
6 | 6 | \name{dput} |
|
13 | 13 | } |
14 | 14 | \usage{ |
15 | 15 | dput(x, file = "", |
16 | | - control = c("keepNA", "keepInteger", "showAttributes")) |
| 16 | + control = c("keepNA", "keepInteger", "niceNames", "showAttributes")) |
17 | 17 |
|
18 | 18 | dget(file, keep.source = FALSE) |
19 | 19 | } |
@@ -60,7 +60,7 @@ dget(file, keep.source = FALSE) |
60 | 60 | designed to be used for transporting \R data, and will work with \R |
61 | 61 | objects that \code{dput} does not handle correctly as well as being |
62 | 62 | much faster. |
63 | | - |
| 63 | + |
64 | 64 | To avoid the risk of a source attribute out of sync with the actual |
65 | 65 | function definition, the source attribute of a function will never |
66 | 66 | be written as an attribute. |
@@ -98,6 +98,12 @@ dput(xx, "foo", control = "digits17") |
98 | 98 | dget("foo") - xx # slight rounding on some platforms |
99 | 99 | dput(xx, "foo", control = "hexNumeric"); dget("foo") - xx |
100 | 100 | unlink("foo") |
| 101 | + |
| 102 | +xn <- setNames(xx, paste0("pi^",1:3)) |
| 103 | +dput(xn) # nicer, now "niceNames" being part of default 'control' |
| 104 | +dput(xn, control = "S_compat") # no names |
| 105 | +## explicitly asking for output as in R < 3.5.0: |
| 106 | +dput(xn, control = c("keepNA", "keepInteger", "showAttributes")) |
101 | 107 | } |
102 | 108 | \keyword{file} |
103 | 109 | \keyword{programming} |
|
0 commit comments