Dear all,
I just installed R 3.4.1 and noticed a change in how user-defined functions
are printed. A small example:
string<-"f<-function(x){\n\tx^2\n}"
cat(string,file="tmp00a.R")
source("tmp00a.R")
f
And this is what I see:
#R 3.4.0
function(x){
x^2
}
#R 3.4.1
function(x){
\tx^2
}
Seems that in 3.4.1 the tab character isn't "rendered". This is rather
annoying since it becomes very difficult to inspect the source code of user
defined functions. This behaviour seems to be present just for the tab
character (\n and \r are displayed correctly).
I'm on Ubuntu 14, 64bit. If you need more details I will gladly provide
what I can. Here is my sessionInfo():
R version 3.4.1 (2017-06-30)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 14.04.5 LTS
Matrix products: default
BLAS: /usr/local/R-3.4.1/lib/libRblas.so
LAPACK: /usr/local/R-3.4.1/lib/libRlapack.so
locale:
[1] LC_CTYPE=it_IT.UTF-8 LC_NUMERIC=C
[3] LC_TIME=it_IT.UTF-8 LC_COLLATE=it_IT.UTF-8
[5] LC_MONETARY=it_IT.UTF-8 LC_MESSAGES=it_IT.UTF-8
[7] LC_PAPER=it_IT.UTF-8 LC_NAME=C
[9] LC_ADDRESS=C LC_TELEPHONE=C
[11] LC_MEASUREMENT=it_IT.UTF-8 LC_IDENTIFICATION=C
attached base packages:
[1] stats graphics grDevices utils datasets methods base
loaded via a namespace (and not attached):
[1] compiler_3.4.1 tools_3.4.1
(the value of sessionInfo() on R 3.4.0 is obviously identical aside from
the versions).
Thank you for your attention and your incredible work.
Nicola Farina
Change in print.function between R 3.4.1 and R 3.4.0
2 messages · nicola farina, Martin Maechler
nicola farina <farinan at gmail.com>
on Thu, 20 Jul 2017 16:51:54 +0200 writes:
> Dear all,
> I just installed R 3.4.1 and noticed a change in how user-defined functions
> are printed. A small example:
> string<-"f<-function(x){\n\tx^2\n}"
> cat(string,file="tmp00a.R")
> source("tmp00a.R")
> f
> And this is what I see:
> #R 3.4.0
> function(x){
> x^2
> }
> #R 3.4.1
> function(x){
> \tx^2
> }
> Seems that in 3.4.1 the tab character isn't "rendered". This is rather
> annoying since it becomes very difficult to inspect the source code of user
> defined functions. This behaviour seems to be present just for the tab
> character (\n and \r are displayed correctly).
[..............]
> Thank you for your attention and your incredible work.
Thank you for the flowers.
Believe it or not, I've detected this bug about 8 hours ago, after typing
menu
at the R prompt after receiving a bug report about it.
It came from fixing bug PR#16732 (which was about rendering
Japanese fonts in a function defintion when printing)
https://bugs.r-project.org/bugzilla/show_bug.cgi?id=16732
A (probably shortest possible!) symptom of the bug is
that in R <= 3.4.0,
quote(-"\n")
-"\n"
whereas in R 3.4.1 (and the current newer development versions of R)
quote(-"\n")
-"\\n"
Ideally, fixing this (wrong duplication of "\") will not make
bug 16732 resurface.
I expect a bug fix by tomorrow.
If this is a big problem for you, you will have to upgrade to
"R 3.4.1 patched"
during the weekend.
(Downgrading to R 3.4.0 is not a good idea, compared to the above!)
Martin Maechler,
ETH Zurich
> Nicola Farina
> [[alternative HTML version deleted]]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
(do learn to post in plain text on R-devel, please)