Re: [Rd] Unexpected behavior with \r in Rgui 2.12.0
First, I don't think cat(70,"\r") has ever been useful in Rgui. It outputs and then deletes a line: Rgui has never supported overwriting. I think you really want cat('\r', i, sep=""). Second, in some circumstances in 2.12.0 only, some storage was discarded too early and so random characters might appear. This has now been fixed, so please try a recent R-patched. But the main problem was the expectation: there is nothing that I know of which says that '\r' works in the way it does in some (but not all) Unix terminals. On Sun, 7 Nov 2010, Russell Pierce wrote: I am experiencing unexpected behavior with the command cat under Window GUI builds of R version 2.12.0 (it does not seem to be an issue in Rterm). For example if I issue the command cat(70,"\r") I get back text that looks like Asian characters. If I highlight and copy that text, it is the text I would regularly expect, e.g. the number 70 and the prompt line. Highlighting the text changes what is shown on the screen, but the screen never displays the number 70. This error is not idiosyncratic to 70 but happens with a fairly wide range of numbers. Notably no error like this occurs when I use \n. I use \r for large simulation runs when I don't want my progress to spam the display. e.g. for (i in 1:1000) {cat(i,"\r");flush.console();Sys.sleep(.100)} sessionInfo() where I first saw the problem: R version 2.12.0 (2010-10-15) on Windows Vista Platform: i386-pc-mingw32/i386 (32-bit) locale: [1] LC_COLLATE=English_United States.1252 [2] LC_CTYPE=English_United States.1252 [3] LC_MONETARY=English_United States.1252 [4] LC_NUMERIC=C [5] LC_TIME=English_United States.1252 attached base packages: [1] stats graphics grDevices utils datasets methods base Also experienced here: R version 2.12.0 (2010-10-15) on Windows XP R version 2.12.0 Patched (2010-11-04 r53530) on Windows Vista R version 2.13.0 Under development (unstable) (2010-11-04 r53530) on Windows Vista But not here: Not under R version 2.10.1 (2009-12-14) on Windows XP If this is expected behavior would you please kindly explain it to me? I am not a member of this list, so please address replies both to my email address and (if appropriate) the list. Best, Russell Pierce __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel -- Brian D. Ripley, rip...@stats.ox.ac.uk Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UKFax: +44 1865 272595__ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
Re: [Rd] Unexpected behavior with \r in Rgui 2.12.0
I downloaded the latest patch today and the problem still persists. AFAIK, "\r" can be useful to give a counter that stays in place, or is there another way of doing that in a Windows environment? Funny thing is : if you copy-paste the strange characters, you get the correct counts, but you get the \n characters that seperate them as well. > for (i in 1:5) {cat(i,"\n\r");flush.console();Sys.sleep(.100)} gives a series of funny characters. If you hover over them or select them for copying, they change into other ones. If you copy-paste those characters however, you get strangely enough: > for (i in 1:5) {cat(i,"\n\r");flush.console();Sys.sleep(.100)} 1 2 3 4 5 > which includes the \n character. I attached a screenshot of the signs I have on my screen. Cheers Joris On Thu, Nov 25, 2010 at 2:36 PM, Prof Brian Ripley wrote: > First, I don't think cat(70,"\r") has ever been useful in Rgui. > It outputs and then deletes a line: Rgui has never supported overwriting. I > think you really want cat('\r', i, sep=""). > > Second, in some circumstances in 2.12.0 only, some storage was discarded too > early and so random characters might appear. This has now been fixed, so > please try a recent R-patched. > > But the main problem was the expectation: there is nothing that I know of > which says that '\r' works in the way it does in some (but not all) Unix > terminals. > > On Sun, 7 Nov 2010, Russell Pierce wrote: > >> I am experiencing unexpected behavior with the command cat under >> Window GUI builds of R version 2.12.0 (it does not seem to be an issue >> in Rterm). For example if I issue the command cat(70,"\r") I get back >> text that looks like Asian characters. If I highlight and copy that >> text, it is the text I would regularly expect, e.g. the number 70 and >> the prompt line. Highlighting the text changes what is shown on the >> screen, but the screen never displays the number 70. This error is >> not idiosyncratic to 70 but happens with a fairly wide range of >> numbers. Notably no error like this occurs when I use \n. I use \r >> for large simulation runs when I don't want my progress to spam the >> display. >> >> e.g. >> for (i in 1:1000) {cat(i,"\r");flush.console();Sys.sleep(.100)} >> >> sessionInfo() where I first saw the problem: >> R version 2.12.0 (2010-10-15) on Windows Vista >> Platform: i386-pc-mingw32/i386 (32-bit) >> >> locale: >> [1] LC_COLLATE=English_United States.1252 >> [2] LC_CTYPE=English_United States.1252 >> [3] LC_MONETARY=English_United States.1252 >> [4] LC_NUMERIC=C >> [5] LC_TIME=English_United States.1252 >> >> attached base packages: >> [1] stats graphics grDevices utils datasets methods base >> >> Also experienced here: >> R version 2.12.0 (2010-10-15) on Windows XP >> R version 2.12.0 Patched (2010-11-04 r53530) on Windows Vista >> R version 2.13.0 Under development (unstable) (2010-11-04 r53530) on >> Windows Vista >> >> But not here: >> Not under R version 2.10.1 (2009-12-14) on Windows XP >> >> If this is expected behavior would you please kindly explain it to me? >> I am not a member of this list, so please address replies both to my >> email address and (if appropriate) the list. >> >> Best, >> >> Russell Pierce >> >> __ >> R-devel@r-project.org mailing list >> https://stat.ethz.ch/mailman/listinfo/r-devel >> > > -- > Brian D. Ripley, rip...@stats.ox.ac.uk > Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ > University of Oxford, Tel: +44 1865 272861 (self) > 1 South Parks Road, +44 1865 272866 (PA) > Oxford OX1 3TG, UK Fax: +44 1865 272595 > __ > R-devel@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-devel > > -- Joris Meys Statistical consultant Ghent University Faculty of Bioscience Engineering Department of Applied mathematics, biometrics and process control tel : +32 9 264 59 87 joris.m...@ugent.be --- Disclaimer : http://helpdesk.ugent.be/e-maildisclaimer.php <>__ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
Re: [Rd] Reference Classes: how to clone/copy instances?
No reference class method explicitly does this, but it's a natural utility. Some form of $copy() will be added. It needs a shallow/deep option; i.e., if a field is itself a reference class object, should that field be cloned as well. The full reflectance available should make a single method (for the "envRefClass") work generally, although classes with non-standard accessor functions may need to have their own method. Any contributions or suggestions are welcome, particularly with respect to features from other OOP languages that should be accommodated. Lazy copy would be attractive, but harder to implement. John On 11/24/10 1:47 AM, Janko Thyson wrote: Dear list, I don't know what's the correct term for this in the OOP context, but is it possible to "clone"/copy an instance of a reference class (say 'a') so that I get an *autonomous* second instance 'b'? Autonomous in the sense that changes to 'a' do not affect 'b'. I know that this is somewhat against the pass-by-reference paradigm, but the motive behind this is to generalize the 'undo()' functionality described in the example of 'setRefClass()' to entire objects: I'd like to generate "images" of my object via a '$imageAdd()" method in order to generate a change history of the object (images are assigned to a field '.IMAGES' of class 'environment') that I can "load()" on demand to undo changes to my object. Obviously, simply assigning 'b<- a' does not work with respect to autonomy. Nor does exporting the object via 'b<- a$export(Class="A")'. I thought about creating a new instance b and then defining a function that maps the field values from a to b: b<- getRefClass("A")$new() fieldsMap(src=a, tgt=b) Is there already some functionality I can use? Thanks, Janko ## SYSTEM INFO ## Windows XP SP3 R 2.12.0 (patched as of 2010-11-22) Eclipse 3.6.1 (Helios) StatET 0.9.x ### __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
[Rd] minor typo in biplot.rd
Dear R developers, There is a minor typo in the documentation for biplot (in Version 2.12.0 as well as 2.13.0 ) "is the the dimname is NULL" should be "if the dimname is NULL" xlabs A vector of character strings to label the first set of points: the default is to use the row dimname of x, or 1:n is the dimname is NULL. if ylabs A vector of character strings to label the second set of points: the default is to use the row dimname of y, or 1:n is the dimname is NULL. if Bill sessionInfo() R version 2.13.0 Under development (unstable) (2010-11-05 r53534) Platform: i386-apple-darwin9.8.0/i386 (32-bit) locale: [1] en_US.UTF-8/en_US.UTF-8/C/C/en_US.UTF-8/en_US.UTF-8 attached base packages: [1] stats graphics grDevices utils datasets methods base other attached packages: [1] psych_1.0-93 loaded via a namespace (and not attached): [1] tools_2.13.0 -- William Revelle http://personality-project.org/revelle.html Professor http://personality-project.org Department of Psychology http://www.wcas.northwestern.edu/psych/ Northwestern University http://www.northwestern.edu/ Use R for psychology http://personality-project.org/r It is 6 minutes to midnight http://www.thebulletin.org __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
Re: [Rd] installing RMySQL (PR#13633)
I attempted to install the linux package "r-cran-rmysql", and it was successful to install the R package "RMySQL" in Ubuntu 10.10. Thank you. 2010/11/24 Dirk Eddelbuettel > > On 24 November 2010 at 04:06, Wonsang You wrote: > | > | I guess that you already solved the error in installing the R package > RMySQL. > | Recently, I also suffered from the same problem in Ubuntu 10.10. I would > | like to report my solution. > | > | I just installed a linux package "libmysqlclient-dev" which contains > MySQL > | database development files and headers. Then, I attempted to install the > | RMySQL package again, and there was no error. > > What was wrong with > > sudo apt-get install r-cran-rmysql > > that make you compile locally? > > Dirk > > -- > Dirk Eddelbuettel | e...@debian.org | http://dirk.eddelbuettel.com > [[alternative HTML version deleted]] __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
Re: [Rd] Unexpected behavior with \r in Rgui 2.12.0
Prof. Ripley & Joris, I concur with Joris, the behavior persists in R version 2.12.0 Patched (2010-11-24 r53655) and under Windows XP. The current development build for Windows did not have an RGui at the time I wrote this. I did not realize that the functionality of "\r" to return to the beginning of the line in Windows was undocumented/unsupported. ?Quotes lists \r as carriage return without any warning that it is unsupported in RGui, perhaps a notice should be put in? Since "\r" is not supported, I would like to express a desire that it at least do something predictable. Certainly, it seems doubtful that these "strange characters" (with the copying characteristics described) is what a user expects. If "\r" is not usable under RGui perhaps it would be better to ignore it entirely than to parse it and return the odd output that I am seeing? In the RGui for Windows prior to this version "\r" returned to the beginning of the line without deleting the already written content. Thus cat(70,"\r") and cat("\r",70) only differed in terms of where the cursor was left. I started using "\r" because I had seen it in the code for txtProgressBar. The help for txtProgressBar does note that it "uses \r to return to the left margin the interpretation of carriage return is up to the terminal or console in which *R* is running". For Jorris' reference, in a windows environment there are several methods to produce keep track of progress: tcltk::tkProgressBar, utils::txtProgressBar , and utils::winProgressBar. None of them are as "user friendly" as cat and "\r" because you have to create the progress bar, increment it, then destroy it. If you want to output debugging information as well as increment a counter you need to tweak the title attribute as you go. Best, Russell S. Pierce [[alternative HTML version deleted]] __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
Re: [Rd] Unexpected behavior with \r in Rgui 2.12.0
FYI, this topic was discussed in R-help thread 'cat(), Rgui, and support for carriage return \r...' on March 17-29, 2006: https://stat.ethz.ch/pipermail/r-help/2006-March/101863.html Some modifications to Rgui's behavior was brought up and (I think) implemented at the time. As far as I remember, after that discussion ASCII carriage return did indeed *move* the point/cursor to the beginning of the current line. I remember trying it at the time, but I admit I haven't verified it in several years now. However, I believe that that was before Unicode character support was introduced, and my best guess is that support for the latter may have changed the expected behavior of carriage return. My $.02 on the history /Henrik On Thu, Nov 25, 2010 at 7:49 AM, Russell Pierce wrote: > Prof. Ripley & Joris, > > I concur with Joris, the behavior persists in R version 2.12.0 Patched > (2010-11-24 r53655) and under Windows XP. The current development build > for Windows did not have an RGui at the time I wrote this. > > I did not realize that the functionality of "\r" to return to > the beginning of the line in Windows was undocumented/unsupported. ?Quotes > lists \r as carriage return without any warning that it is unsupported in > RGui, perhaps a notice should be put in? > > Since "\r" is not supported, I would like to express a desire that it at > least do something predictable. Certainly, it seems doubtful that > these "strange characters" (with the copying characteristics described) is > what a user expects. If "\r" is not usable under RGui perhaps it would be > better to ignore it entirely than to parse it and return the odd output that > I am seeing? > > In the RGui for Windows prior to this version "\r" returned to > the beginning of the line without deleting the already written content. > Thus cat(70,"\r") and cat("\r",70) only differed in terms of where the > cursor was left. > > I started using "\r" because I had seen it in the code for txtProgressBar. > The help for txtProgressBar does note that it "uses \r to return to the > left margin – the interpretation of carriage return is up to the terminal or > console in which *R* is running". For Jorris' reference, in a windows > environment there are several methods to produce keep track of progress: > tcltk::tkProgressBar, utils::txtProgressBar , and utils::winProgressBar. > None of them are as "user friendly" as cat and "\r" because you have to > create the progress bar, increment it, then destroy it. If you want to > output debugging information as well as increment a counter you need to > tweak the title attribute as you go. > > Best, > > Russell S. Pierce > > [[alternative HTML version deleted]] > > > __ > R-devel@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-devel > > __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
Re: [Rd] Unexpected behavior with \r in Rgui 2.12.0
On Thu, Nov 25, 2010 at 10:02 AM, Henrik Bengtsson wrote: > FYI, this topic was discussed in R-help thread 'cat(), Rgui, and > support for carriage return \r...' on March 17-29, 2006: > > https://stat.ethz.ch/pipermail/r-help/2006-March/101863.html > > Some modifications to Rgui's behavior was brought up and (I think) > implemented at the time. > > As far as I remember, after that discussion ASCII carriage return did > indeed *move* the point/cursor to the beginning of the current line. I > remember trying it at the time, but I admit I haven't verified it in > several years now. [scrap] > However, I believe that that was before Unicode > character support was introduced, and my best guess is that support > for the latter may have changed the expected behavior of carriage > return. [/scrap] Remove that last guess of mine; know I re-read Ripley's message and see that the displaying of odd characters was due to a bug, which was just fixed. It will take a couple of days before binaries of that patched version are available on CRAN. /Henrik > > My $.02 on the history > > /Henrik > > > On Thu, Nov 25, 2010 at 7:49 AM, Russell Pierce wrote: >> Prof. Ripley & Joris, >> >> I concur with Joris, the behavior persists in R version 2.12.0 Patched >> (2010-11-24 r53655) and under Windows XP. The current development build >> for Windows did not have an RGui at the time I wrote this. >> >> I did not realize that the functionality of "\r" to return to >> the beginning of the line in Windows was undocumented/unsupported. ?Quotes >> lists \r as carriage return without any warning that it is unsupported in >> RGui, perhaps a notice should be put in? >> >> Since "\r" is not supported, I would like to express a desire that it at >> least do something predictable. Certainly, it seems doubtful that >> these "strange characters" (with the copying characteristics described) is >> what a user expects. If "\r" is not usable under RGui perhaps it would be >> better to ignore it entirely than to parse it and return the odd output that >> I am seeing? >> >> In the RGui for Windows prior to this version "\r" returned to >> the beginning of the line without deleting the already written content. >> Thus cat(70,"\r") and cat("\r",70) only differed in terms of where the >> cursor was left. >> >> I started using "\r" because I had seen it in the code for txtProgressBar. >> The help for txtProgressBar does note that it "uses \r to return to the >> left margin – the interpretation of carriage return is up to the terminal or >> console in which *R* is running". For Jorris' reference, in a windows >> environment there are several methods to produce keep track of progress: >> tcltk::tkProgressBar, utils::txtProgressBar , and utils::winProgressBar. >> None of them are as "user friendly" as cat and "\r" because you have to >> create the progress bar, increment it, then destroy it. If you want to >> output debugging information as well as increment a counter you need to >> tweak the title attribute as you go. >> >> Best, >> >> Russell S. Pierce >> >> [[alternative HTML version deleted]] >> >> >> __ >> R-devel@r-project.org mailing list >> https://stat.ethz.ch/mailman/listinfo/r-devel >> >> > __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
[Rd] Request: kronecker to get a sep= argument
kronecker, with make.dimnames=TRUE uses a hardwired sep=":" in the line tmp <- outer(dnx[[i]], dny[[i]], FUN = "paste", sep = ":") For an application in which dimnames arise from an n-way array, where different dimensions have different roles, and I would like to be able to use kronecker in the form kronecker(A, B, make.dimnames=TRUE, sep='/') All this requires is to change the following two lines: kronecker <- function (X, Y, FUN = "*", make.dimnames = FALSE, sep=":" ...) { ... tmp <- outer(dnx[[i]], dny[[i]], FUN = "paste", sep = sep) } Otherwise, I have to reproduce the logic inside kronecker() in my application function. -Michael -- Michael Friendly Email: friendly AT yorku DOT ca Professor, Psychology Dept. York University Voice: 416 736-5115 x66249 Fax: 416 736-5814 4700 Keele StreetWeb: http://www.datavis.ca Toronto, ONT M3J 1P3 CANADA __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
Re: [Rd] Request: kronecker to get a sep= argument
On Thu, 25 Nov 2010, Michael Friendly wrote: kronecker, with make.dimnames=TRUE uses a hardwired sep=":" in the line tmp <- outer(dnx[[i]], dny[[i]], FUN = "paste", sep = ":") For an application in which dimnames arise from an n-way array, where different dimensions have different roles, and I would like to be able to use kronecker in the form kronecker(A, B, make.dimnames=TRUE, sep='/') All this requires is to change the following two lines: kronecker <- function (X, Y, FUN = "*", make.dimnames = FALSE, sep=":" ...) { ... tmp <- outer(dnx[[i]], dny[[i]], FUN = "paste", sep = sep) } Otherwise, I have to reproduce the logic inside kronecker() in my application function. Or add one line of code: res <- kronecker(m1,m3,make.dimnames=T) dimnames(res) <- lapply( dimnames(res), sub, pattern=":", replacement="/" ) HTH, Chuck p.s. your suggestion could break code that others may have written like kronecker( letters[1:3], diag(LETTERS[1:2]), paste, sep='*' ) -Michael -- Michael Friendly Email: friendly AT yorku DOT ca Professor, Psychology Dept. York University Voice: 416 736-5115 x66249 Fax: 416 736-5814 4700 Keele StreetWeb: http://www.datavis.ca Toronto, ONT M3J 1P3 CANADA __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel Charles C. BerryDept of Family/Preventive Medicine cbe...@tajo.ucsd.eduUC San Diego http://famprevmed.ucsd.edu/faculty/cberry/ La Jolla, San Diego 92093-0901 __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
Re: [Rd] Request: kronecker to get a sep= argument
On Thu, 25 Nov 2010, Charles C. Berry wrote: On Thu, 25 Nov 2010, Michael Friendly wrote: kronecker, with make.dimnames=TRUE uses a hardwired sep=":" in the line tmp <- outer(dnx[[i]], dny[[i]], FUN = "paste", sep = ":") For an application in which dimnames arise from an n-way array, where different dimensions have different roles, and I would like to be able to use kronecker in the form kronecker(A, B, make.dimnames=TRUE, sep='/') All this requires is to change the following two lines: kronecker <- function (X, Y, FUN = "*", make.dimnames = FALSE, sep=":" ...) { ... tmp <- outer(dnx[[i]], dny[[i]], FUN = "paste", sep = sep) } Otherwise, I have to reproduce the logic inside kronecker() in my application function. Or add one line of code: res <- kronecker(m1,m3,make.dimnames=T) dimnames(res) <- lapply( dimnames(res), sub, pattern=":", replacement="/" ) HTH, Chuck p.s. your suggestion could break code that others may have written like kronecker( letters[1:3], diag(LETTERS[1:2]), paste, sep='*' ) make that kronecker( letters[1:3], diag(LETTERS[1:2]), paste ) -Michael -- Michael Friendly Email: friendly AT yorku DOT ca Professor, Psychology Dept. York University Voice: 416 736-5115 x66249 Fax: 416 736-5814 4700 Keele StreetWeb: http://www.datavis.ca Toronto, ONT M3J 1P3 CANADA __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel Charles C. BerryDept of Family/Preventive Medicine cbe...@tajo.ucsd.eduUC San Diego http://famprevmed.ucsd.edu/faculty/cberry/ La Jolla, San Diego 92093-0901 __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel Charles C. BerryDept of Family/Preventive Medicine cbe...@tajo.ucsd.eduUC San Diego http://famprevmed.ucsd.edu/faculty/cberry/ La Jolla, San Diego 92093-0901 __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel