[Rd] allocMatrix error
On Sat, Feb 14, 2009 at 00:17, wrote: Hi, I was trying to read ~400 chips in an affybatch and I got the same message. Could you find a remedy for that. My server has 128 GB of RAM. However, R halted ever before it uses the memory. I have been able to load upto 250 CEL files but this time I wanted to test what would happen if I want to normalize 400 chips. Thanks for your prompt response. Hamid > > > > Martin Maechler wrote: >> >>> "VK" == Vadim Kutsyy >>> on Fri, 01 Aug 2008 07:35:01 -0700 writes: >> >> VK> Martin Maechler wrote: >> >> >> VK> The problem is in array.c, where allocMatrix check for >> VK> "if ((double)nrow * (double)ncol > INT_MAX)". But why >> VK> itn is used and not long int for indexing? (max int is >> VK> 2147483647, max long int is 9223372036854775807) >> >> >> >> Well, Brian gave you all info: >> >> >> VK> exactly, and given that most modern system used for >> VK> computations (i.e. 64bit system) have long int which is >> VK> much larger than int, I am wondering why long int is not >> VK> used for indexing (I don't think that 4 bit vs 8 bit >> VK> storage is an issue). >> >> Did you really carefully read ?Memory-limits ?? >> >> >> VK> Yes, it is specify that 4 bit int is used for indexing >> VK> in all version of R, but why? I think 2147483647 >> VK> elements for a single vector is OK, but not as total >> VK> number of elements for the matrix. I am running out of >> VK> indexing at mere 10% memory consumption. >> >> Hmm, do you have 160 GBytes of RAM? >> But anyway, let's move this topic from R-help to R-devel. >> >>[...] >> >> VK> PS: I have no problem to go and modify C code, but I am >> VK> just wondering what are the reasons for having such >> VK> limitation. >> >> This limitation and its possible remedies are an interesting topic, >> but really not for R-help: >> >> It will be a lot about C programming the internal represenation of R >> objects, etc. >> Very fascinating but for R-devel. >> >> "See you there!" >> Martin >> >> __ >> r-h...@r-project.org mailing list >> https://stat.ethz.ch/mailman/listinfo/r-help >> PLEASE do read the posting guide >> http://www.R-project.org/posting-guide.html >> and provide commented, minimal, self-contained, reproducible code. >> >> > Quoted from: > http://www.nabble.com/allocMatrix-limits-tp18763791p18776531.html > > [[alternative HTML version deleted]] __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
Re: [Rd] allocMatrix error
On Tue, 17 Feb 2009, Hamid Ashafi wrote: On Sat, Feb 14, 2009 at 00:17, wrote: Hi, I was trying to read ~400 chips in an affybatch and I got the same message. Could you find a remedy for that. My server has 128 GB of RAM. However, R halted ever before it uses the memory. We don't have anything like sufficient details (please do read the posting guide). If the issue is the size of matrices, you possibly (depending on the compiler) could arrange to compile R (and any relevant system libraries) to use 64-bit ints. For C code in R there is typedef to change, and you would need integer*8 in the Fortran. We would be interested to know the results if you do so, but the developers are unlikely to do so for you. In any case, since you mention 'affybatch' it looks like this might be a design issue in that BioC package and the BioC lists might be the appropriate place to discuss it. It is not obvious to me why ~400 datasets need a single large R object rather than, say, a list of 400 smaller ones, if that is indeed the problem. So, to return to my first point: We don't have anything like sufficient details. Please give us the full details of your system, the memory in use (see ?gc) and what you were trying to do. I have been able to load upto 250 CEL files but this time I wanted to test what would happen if I want to normalize 400 chips. R can handle up to 16GB objects, which even for a 64-bit OS and 128GB of RAM are pretty large objects and do not arise naturally from many small files. Thanks for your prompt response. Hamid Martin Maechler wrote: "VK" == Vadim Kutsyy on Fri, 01 Aug 2008 07:35:01 -0700 writes: VK> Martin Maechler wrote: >> VK> The problem is in array.c, where allocMatrix check for VK> "if ((double)nrow * (double)ncol > INT_MAX)". But why VK> itn is used and not long int for indexing? (max int is VK> 2147483647, max long int is 9223372036854775807) >> >> Well, Brian gave you all info: >> VK> exactly, and given that most modern system used for VK> computations (i.e. 64bit system) have long int which is VK> much larger than int, I am wondering why long int is not VK> used for indexing (I don't think that 4 bit vs 8 bit VK> storage is an issue). >> Did you really carefully read ?Memory-limits ?? >> VK> Yes, it is specify that 4 bit int is used for indexing VK> in all version of R, but why? I think 2147483647 VK> elements for a single vector is OK, but not as total VK> number of elements for the matrix. I am running out of VK> indexing at mere 10% memory consumption. Hmm, do you have 160 GBytes of RAM? But anyway, let's move this topic from R-help to R-devel. [...] VK> PS: I have no problem to go and modify C code, but I am VK> just wondering what are the reasons for having such VK> limitation. This limitation and its possible remedies are an interesting topic, but really not for R-help: It will be a lot about C programming the internal represenation of R objects, etc. Very fascinating but for R-devel. "See you there!" Martin __ r-h...@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Quoted from: http://www.nabble.com/allocMatrix-limits-tp18763791p18776531.html [[alternative HTML version deleted]] __ 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
[Rd] getGraphicsEvent in an example
Hi the list, Is there a way to include a function using a getGraphicsEvent in the \examples section? Christophe __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
Re: [Rd] demo enhancement
On 16/02/2009 6:42 AM, Kjell Konis wrote: I put the diff here http://smat.epfl.ch/~konis/grabbag/demo.diff Kjell I've added this in R-devel, and also added "ask" at the same time. Duncan Murdoch On 16 févr. 09, at 12:35, Duncan Murdoch wrote: Kjell Konis wrote: Hello, I have a package for working with Bayesian networks (RHugin - on R- Forge for those interested). It contains a function RHExample that does the same thing as the demo function in the utils package except that it does not display any output in the R console. I use it to build simple networks in the examples section of my .Rd documentation files. Anyway, I thought it would be useful if this functionality was also part of the demo function. The attached diff adds an echo argument to demo which, when set to FALSE, makes demo behave the same as my RHExample function. Please feel free to use it if you think it would be helpful. Your attachment got lost, but by coincidence, I was wanting an echo=FALSE argument to demo a couple of days ago. I didn't add it yet, because - I'd like consistency with example(), which suggests putting echo ahead of verbose - I'd rather not add a parameter in the middle of the list, just in case someone has used positional args - example() has other args not in demo(), i.e. local, setRNG, ask, prompt.prefix. Should some or all of those be added at the same time? Since the first two items above are contradictory, I decided this needed thinking about, but I haven't taken the time to do that yet. Duncan Murdoch __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
Re: [Rd] allocMatrix error
Prof Brian Ripley writes: > On Tue, 17 Feb 2009, Hamid Ashafi wrote: > >> On Sat, Feb 14, 2009 at 00:17, wrote: >> >> Hi, >> >> I was trying to read ~400 chips in an affybatch and I got the same message. >> Could you find a remedy for that. My server has 128 GB of RAM. However, R >> halted ever before it uses the memory. > > We don't have anything like sufficient details (please do read the > posting guide). > > If the issue is the size of matrices, you possibly (depending on the > compiler) could arrange to compile R (and any relevant system > libraries) to use 64-bit ints. For C code in R there is typedef to > change, and you would need integer*8 in the Fortran. We would be > interested to know the results if you do so, but the developers are > unlikely to do so for you. > > In any case, since you mention 'affybatch' it looks like this might be > a design issue in that BioC package and the BioC lists might be the > appropriate place to discuss it. It is not obvious to me why ~400 > datasets need a single large R object rather than, say, a list of 400 > smaller ones, if that is indeed the problem. So, to return to my > first point: > >> We don't have anything like sufficient details. > > Please give us the full details of your system, the memory in use (see > ?gc) and what you were trying to do. > > >> I have been able to load upto 250 CEL files but this time I wanted to test >> what would happen if I want to normalize 400 chips. > > R can handle up to 16GB objects, which even for a 64-bit OS and 128GB > of RAM are pretty large objects and do not arise naturally from many > small files. Hamid -- Prof. Ripley is correct in pointing you toward the Bioconductor mailing list http://bioconductor.org/docs/mailList.html The usual solution for very large sets of array is to use packages like aroma.affymetrix or xps that do not put the objects entirely in memory, or the AffyPara package to divide large jobs into smaller ones that are processed in parallel. Also of course to think about whether it is statistically reasonable to normalize across all arrays. There are discussions of this topic on the Bioc mailing list, so look in the archive for additional hints. Martin >> Thanks for your prompt response. >> >> >> >> Hamid >> >>> >> >>> >> >>> >> >>> Martin Maechler wrote: >> >> > "VK" == Vadim Kutsyy >> > on Fri, 01 Aug 2008 07:35:01 -0700 writes: >> >> VK> Martin Maechler wrote: >> >> >> VK> The problem is in array.c, where allocMatrix check for >> VK> "if ((double)nrow * (double)ncol > INT_MAX)". But why >> VK> itn is used and not long int for indexing? (max int is >> VK> 2147483647, max long int is 9223372036854775807) >> >> >> >> Well, Brian gave you all info: >> >> >> VK> exactly, and given that most modern system used for >> VK> computations (i.e. 64bit system) have long int which is >> VK> much larger than int, I am wondering why long int is not >> VK> used for indexing (I don't think that 4 bit vs 8 bit >> VK> storage is an issue). >> >> Did you really carefully read ?Memory-limits ?? >> >> >> VK> Yes, it is specify that 4 bit int is used for indexing >> VK> in all version of R, but why? I think 2147483647 >> VK> elements for a single vector is OK, but not as total >> VK> number of elements for the matrix. I am running out of >> VK> indexing at mere 10% memory consumption. >> >> Hmm, do you have 160 GBytes of RAM? >> But anyway, let's move this topic from R-help to R-devel. >> >> [...] >> >> VK> PS: I have no problem to go and modify C code, but I am >> VK> just wondering what are the reasons for having such >> VK> limitation. >> >> This limitation and its possible remedies are an interesting topic, >> but really not for R-help: >> >> It will be a lot about C programming the internal represenation of R >> objects, etc. >> Very fascinating but for R-devel. >> >> "See you there!" >> Martin >> >> __ >> r-h...@r-project.org mailing list >> https://stat.ethz.ch/mailman/listinfo/r-help >> PLEASE do read the posting guide >> http://www.R-project.org/posting-guide.html >> and provide commented, minimal, self-contained, reproducible code. >> >> >> >>> Quoted from: >> >>> http://www.nabble.com/allocMatrix-limits-tp18763791p18776531.html >> >>> >> >>> >> >> >> >> >> [[alternative HTML version deleted]] >> >> __ >> 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/
Re: [Rd] Update today broke foreign package (PR#13533)
Prof Brian Ripley wrote: > foregin_0.8-32 was testsd aginst 2.8.1 prior to release, and I've just > tested it again. > > This might be a locale issue (but I also tested in a latin1 and C > locale), but I think it is specific to some files. I have this with a codepage 1252 file as well. From my reply to Harry Haupt on R-help (copied here for the sake of the bug repository): Yes, something in the logic appears to have gotten garbled. It's in this part of read,spss: if (is.character(reencode)) { cp <- reencode reencode <- TRUE } else if (codepage <= 500 || codepage >= 2000) { attr(rval, "codepage") <- NULL reencode <- FALSE } else if (m <- match(cp, knownCP, 0L)) cp <- names(knownCP)[m] if you get to the 2nd "else if" then cp is unset. Possible the attempted match should be of codepage? But it still looks wrong: Why restrict to codepages between 500 and 2000 when knownCP contains several values above 1??? A workaround is to set reencode="ascii" (or whatever is relevant). > So can we have both the output of sessionInfo() and a file that causes > the problem (it appears not to be one of the test files in the 'tests' > subdirectory), and I'll investigate further. > > On Mon, 16 Feb 2009, ru...@msu.edu wrote: > >> Hi, >> >> I'm running R 2.8.1 on Ubuntu, and today I got updates for a couple of >> packages, including foreign (r-cran-foreign, now at version 0.8.32). >> Subsequent to the upgrade, attempts to invoke read.spss produce the >> following error: >> >> Error in inherits(x, "factor") : object "cp" not found >> >> and the call to read.spss fails. I forced a downgrade to 0.8.26, and >> read.spss works again. >> >> Cheers, >> Paul Rubin >> >> __ >> R-devel@r-project.org mailing list >> https://stat.ethz.ch/mailman/listinfo/r-devel >> > -- O__ Peter Dalgaard Øster Farimagsgade 5, Entr.B c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~ - (p.dalga...@biostat.ku.dk) FAX: (+45) 35327907 __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
Re: [Rd] getGraphicsEvent in an example
Just wrap the example in either \dontrun{} or if(interactive()){ } That way that example will be skipped when the automatic tests are done, but will still be available for a reader to run by copy/paste or the examples function (2nd case above). This has worked for me, examples using these are playSudoku in the sudoku package and dynIdentify in TeachingDemos. Hope this helps, -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare greg.s...@imail.org 801.408.8111 > -Original Message- > From: r-devel-boun...@r-project.org [mailto:r-devel-boun...@r- > project.org] On Behalf Of Christophe Genolini > Sent: Tuesday, February 17, 2009 5:07 AM > To: r-devel@r-project.org > Subject: [Rd] getGraphicsEvent in an example > > Hi the list, > Is there a way to include a function using a getGraphicsEvent in the > \examples section? > Christophe > > __ > 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] getGraphicsEvent in an example
Also any demos in the demo directory will be skipped by the automated checks. On Tue, Feb 17, 2009 at 12:01 PM, Greg Snow wrote: > Just wrap the example in either \dontrun{} or > if(interactive()){ > > } > > That way that example will be skipped when the automatic tests are done, but > will still be available for a reader to run by copy/paste or the examples > function (2nd case above). > > This has worked for me, examples using these are playSudoku in the sudoku > package and dynIdentify in TeachingDemos. > > Hope this helps, > > -- > Gregory (Greg) L. Snow Ph.D. > Statistical Data Center > Intermountain Healthcare > greg.s...@imail.org > 801.408.8111 > > >> -Original Message- >> From: r-devel-boun...@r-project.org [mailto:r-devel-boun...@r- >> project.org] On Behalf Of Christophe Genolini >> Sent: Tuesday, February 17, 2009 5:07 AM >> To: r-devel@r-project.org >> Subject: [Rd] getGraphicsEvent in an example >> >> Hi the list, >> Is there a way to include a function using a getGraphicsEvent in the >> \examples section? >> Christophe >> >> __ >> 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 > __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
[Rd] C basic indentation
I use the recommendations in "R coding standards", i.e., I put ;;; C (add-hook 'c-mode-hook (lambda () (c-set-style "bsd"))) ;;; ESS (add-hook 'ess-mode-hook (lambda () (ess-set-style 'C++ 'quiet) (add-hook 'local-write-file-hooks (lambda () (ess-nuke-trailing-whitespace) (setq ess-nuke-trailing-whitespace-p 'ask) ;;; Perl (add-hook 'perl-mode-hook (lambda () (setq perl-indent-level 4))) into my .emacs file. IIRC, back in 2005 it gave me a basic indentation of 4 in C (good), but only 2 in R (not so good, but I fixed it with the aid of this excellent list). But now it gives me a basic indentation of eight (8!) in C code. This is not what I want. I think I saw somewhere that the bsd standard actually has changed from four to eight recently (but I cannot find it now). Two points given that the standard really has changed: (i) The text in "R coding standards" should be changed accordingly. (ii) How do I get back to a basic indentation of 4 in C and R code? Göran > sessionInfo() R version 2.8.1 Patched (2009-01-03 r47458) i686-pc-linux-gnu locale: LC_CTYPE=en_US.UTF-8;LC_NUMERIC=C;LC_TIME=en_US.UTF-8;LC_COLLATE=en_US.UTF-8; LC_MONETARY=C;LC_MESSAGES=en_US.UTF-8;LC_PAPER=en_US.UTF-8;LC_NAME=C;LC_ADDRESS=C; LC_TELEPHONE=C;LC_MEASUREMENT=en_US.UTF-8;LC_IDENTIFICATION=C attached base packages: [1] stats graphics grDevices utils datasets methods base GNU Emacs 22.2.1 on Ubuntu 8.10 x64 -- Göran Broström phone: 46 90 786 5223; 46 705 197 507 Department of Statistics fax: 46 90 786 6614 Umeå University email: g...@stat.umu.se SE-90187 Umeå, Swedenhttp://tal.stat.umu.se/~gb __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
[Rd] plot.lm: "Cook's distance" label can overplot point labels
The following code demonstrates an annoyance with plot.lm(): library(DAAGxtras) x11(width=3.75, height=4) nihills.lm <- lm(log(time) ~ log(dist) + log(climb), data = nihills) plot(nihills.lm, which=5) OR try the following xy <- data.frame(x=c(3,1:5), y=c(-2, 1:5)) plot(lm(y ~ x, data=xy), which=5) The "Cook's distance" text overplots the label for the point with the smallest residual. This is an issue when the size of the plot is much less than the default, and the pointsize is not reduced proportionately. I suggest the following: xx <- hii xx[xx >= 1] <- NA ## Insert new code fracht <- (1.25*par()$cin[2])/par()$pin[2] ylim[1] <- ylim[1] - diff(ylim)*max(0, fracht-0.04) ## End insert new code plot(xx, rsp, xlim = c(0, max(xx, na.rm = TRUE)), ylim = ylim, main = main, xlab = "Leverage", ylab = ylab5, type = "n", ...) Then, about 15 lines further down, replace legend("bottomleft", legend = "Cook's distance", lty = 2, col = 2, bty = "n") by legend("bottomleft", legend = "Cook's distance", lty = 2, col = 2, bty = "n", y.intersp=0.5) If this second change is not made, then one wants fracht <- (1.5*par() $cin[2])/par()$pin[2] I prefer the "Cook's distance" text to be a bit closer to the x-axis, as it separates it more clearly from any point labels. John Maindonald email: john.maindon...@anu.edu.au phone : +61 2 (6125)3473fax : +61 2(6125)5549 Centre for Mathematics & Its Applications, Room 1194, John Dedman Mathematical Sciences Building (Building 27) Australian National University, Canberra ACT 0200. __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
Re: [Rd] plot.lm: "Cook's distance" label can overplot point labels
Dear John, It occurs to me that the title above the graph, "Residuals vs. Leverage," is entirely redundant since the x-axis is labelled "Leverage" and the y-axis "Studentized residuals." Why not use the title above the graph for "Cook's distance countours"? Regards, John > -Original Message- > From: r-devel-boun...@r-project.org [mailto:r-devel-boun...@r-project.org] On > Behalf Of John Maindonald > Sent: February-17-09 5:54 PM > To: r-devel@r-project.org > Cc: Martin Maechler > Subject: [Rd] plot.lm: "Cook's distance" label can overplot point labels > > The following code demonstrates an annoyance with plot.lm(): > > library(DAAGxtras) > x11(width=3.75, height=4) > nihills.lm <- lm(log(time) ~ log(dist) + log(climb), data = nihills) > plot(nihills.lm, which=5) > > OR try the following > xy <- data.frame(x=c(3,1:5), y=c(-2, 1:5)) > plot(lm(y ~ x, data=xy), which=5) > > The "Cook's distance" text overplots the label for the point with the > smallest residual. This is an issue when the size of the plot is much > less than the default, and the pointsize is not reduced proportionately. > > > I suggest the following: >xx <- hii >xx[xx >= 1] <- NA > ## Insert new code >fracht <- (1.25*par()$cin[2])/par()$pin[2] >ylim[1] <- ylim[1] - diff(ylim)*max(0, fracht-0.04) > ## End insert new code >plot(xx, rsp, xlim = c(0, max(xx, na.rm = TRUE)), > ylim = ylim, main = main, xlab = "Leverage", > ylab = ylab5, type = "n", ...) > > Then, about 15 lines further down, replace > legend("bottomleft", legend = "Cook's distance", > lty = 2, col = 2, bty = "n") > > by > legend("bottomleft", legend = "Cook's distance", > lty = 2, col = 2, bty = "n", y.intersp=0.5) > > If this second change is not made, then one wants fracht <- (1.5*par() > $cin[2])/par()$pin[2] > I prefer the "Cook's distance" text to be a bit closer to the x-axis, > as it separates it more clearly from any point labels. > > John Maindonald email: john.maindon...@anu.edu.au > phone : +61 2 (6125)3473fax : +61 2(6125)5549 > Centre for Mathematics & Its Applications, Room 1194, > John Dedman Mathematical Sciences Building (Building 27) > Australian National University, Canberra ACT 0200. > > __ > 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] C basic indentation
This seems a question for the ESS-help list. But you should be using Emacs customization these days: I have in my .emacs '(c-basic-offset 4) '(c-default-style "bsd") in custom-set-variables, and that is what the 'R Internals' manual says for Emacs >= 21. (You can set that from the 'Customize Emacs' menu item, Programming, Languages, C group.) On Tue, 17 Feb 2009, Göran Broström wrote: I use the recommendations in "R coding standards", i.e., I put Those are recommendations for Emacs < 21. ;;; C (add-hook 'c-mode-hook (lambda () (c-set-style "bsd"))) ;;; ESS (add-hook 'ess-mode-hook (lambda () (ess-set-style 'C++ 'quiet) (add-hook 'local-write-file-hooks (lambda () (ess-nuke-trailing-whitespace) (setq ess-nuke-trailing-whitespace-p 'ask) ;;; Perl (add-hook 'perl-mode-hook (lambda () (setq perl-indent-level 4))) into my .emacs file. IIRC, back in 2005 it gave me a basic indentation of 4 in C (good), but only 2 in R (not so good, but I fixed it with the aid of this excellent list). But now it gives me a basic indentation of eight (8!) in C code. This is not what I want. I think I saw somewhere that the bsd standard actually has changed from four to eight recently (but I cannot find it now). Two points given that the standard really has changed: (i) The text in "R coding standards" should be changed accordingly. It has been (long ago): Alternatively, (for @acronym{GNU} Emacs 21 or later), use customization to set the @code{c-default-style} to @code{"bsd"} and @code{c-basic-offset} to @code{4}.) (ii) How do I get back to a basic indentation of 4 in C and R code? Follow the above. Göran sessionInfo() R version 2.8.1 Patched (2009-01-03 r47458) i686-pc-linux-gnu locale: LC_CTYPE=en_US.UTF-8;LC_NUMERIC=C;LC_TIME=en_US.UTF-8;LC_COLLATE=en_US.UTF-8; LC_MONETARY=C;LC_MESSAGES=en_US.UTF-8;LC_PAPER=en_US.UTF-8;LC_NAME=C;LC_ADDRESS=C; LC_TELEPHONE=C;LC_MEASUREMENT=en_US.UTF-8;LC_IDENTIFICATION=C attached base packages: [1] stats graphics grDevices utils datasets methods base GNU Emacs 22.2.1 on Ubuntu 8.10 x64 -- Göran Broström phone: 46 90 786 5223; 46 705 197 507 Department of Statistics fax: 46 90 786 6614 Umeå University email: g...@stat.umu.se SE-90187 Umeå, Swedenhttp://tal.stat.umu.se/~gb __ 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] C basic indentation
Prof Brian Ripley wrote: This seems a question for the ESS-help list. But you should be using Emacs customization these days: I have in my .emacs '(c-basic-offset 4) '(c-default-style "bsd") in custom-set-variables, and that is what the 'R Internals' manual says for Emacs >= 21. (You can set that from the 'Customize Emacs' menu item, Programming, Languages, C group.) On Tue, 17 Feb 2009, Göran Broström wrote: I use the recommendations in "R coding standards", i.e., I put Those are recommendations for Emacs < 21. IMHO, this is not clear from the text, see below. ;;; C (add-hook 'c-mode-hook (lambda () (c-set-style "bsd"))) ;;; ESS (add-hook 'ess-mode-hook (lambda () (ess-set-style 'C++ 'quiet) (add-hook 'local-write-file-hooks (lambda () (ess-nuke-trailing-whitespace) (setq ess-nuke-trailing-whitespace-p 'ask) ;;; Perl (add-hook 'perl-mode-hook (lambda () (setq perl-indent-level 4))) into my .emacs file. IIRC, back in 2005 it gave me a basic indentation of 4 in C (good), but only 2 in R (not so good, but I fixed it with the aid of this excellent list). But now it gives me a basic indentation of eight (8!) in C code. This is not what I want. I think I saw somewhere that the bsd standard actually has changed from four to eight recently (but I cannot find it now). Two points given that the standard really has changed: (i) The text in "R coding standards" should be changed accordingly. It has been (long ago): Alternatively, (for @acronym{GNU} Emacs 21 or later), use customization to set the @code{c-default-style} to @code{"bsd"} and @code{c-basic-offset} to @code{4}.) To me, the word "Alternatively" suggests that I can do it either way. My suggestion was to change this sentence, maybe by simply deleting the first word. (ii) How do I get back to a basic indentation of 4 in C and R code? Follow the above. Thanks for the help, as usual much appreciated! Göran __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel