[Rd] Inconsistent behavior of sQuote and dQuote
Dear all When comparing sQuote("text") and dQuote("text") on MacOS X and Linux FC4 I get an inconsistent behavior (using the new release version R-2.6.0): sQuote: On Mac I get the correct result "'text'", but on FC4 the incorrect result "`text´". dQuote: On Mac I get the correct result "\"text\"", but on FC4 the incorrect result ""text"". For this reason I cannot use these functions in my package. Best regards Christian _._._._._._._._._._._._._._._._ C.h.i.s.t.i.a.n S.t.r.a.t.o.w.a V.i.e.n.n.a A.u.s.t.r.i.a _._._._._._._._._._._._._._._._ __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
[Rd] bug (?) in [.data.frame with matrix-like indexing
Consider in R-2.6.0 (also R-patched from yesterday): iris[1, c(TRUE, FALSE, FALSE, FALSE, FALSE)] ## Error in .subset2(xx, j) : recursive indexing failed at level 2 iris[1, c(FALSE, FALSE, FALSE, FALSE, TRUE)] ## Error in .subset2(xx, j) : attempt to select less than one element i.e. matrix-like indexing on data.frames, one logically-indexed dimension with only one value TRUE in it. It is not documented to work, but it did so in former versions of R. Is it a bug or withdrawn support? Uwe Ligges __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
Re: [Rd] Inconsistent behavior of sQuote and dQuote
On 14/10/2007 10:44 AM, cstrato wrote: > Dear all > > When comparing sQuote("text") and dQuote("text") on MacOS X and Linux FC4 > I get an inconsistent behavior (using the new release version R-2.6.0): > > sQuote: On Mac I get the correct result "'text'", but on FC4 the > incorrect result "`text´". Those both look correct to me (but not the same). What do you see? > dQuote: On Mac I get the correct result "\"text\"", but on FC4 the > incorrect result ""text"". The second one looks wrong here (no escapes shown), but I suspect those inner quotes aren't really the same as the outer quotes, and that's why they're not escaped. If you don't want the fancyquotes at all, you can use options(useFancyQuotes=FALSE). In a package, it would be polite to do this only locally, i.e. have something like save <- options(useFancyQuotes=FALSE) on.exit(options(save)) in functions that call sQuote or dQuote, because options() belong to the user, not to you. Duncan Murdoch > > For this reason I cannot use these functions in my package. > > Best regards > Christian > _._._._._._._._._._._._._._._._ > C.h.i.s.t.i.a.n S.t.r.a.t.o.w.a > V.i.e.n.n.a A.u.s.t.r.i.a > _._._._._._._._._._._._._._._._ > > __ > 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] Inconsistent behavior of sQuote and dQuote
On Sun, 2007-10-14 at 11:56 -0400, Duncan Murdoch wrote: > On 14/10/2007 10:44 AM, cstrato wrote: > > Dear all > > > > When comparing sQuote("text") and dQuote("text") on MacOS X and Linux FC4 > > I get an inconsistent behavior (using the new release version R-2.6.0): > > > > sQuote: On Mac I get the correct result "'text'", but on FC4 the > > incorrect result "`text´". > > Those both look correct to me (but not the same). What do you see? > > > dQuote: On Mac I get the correct result "\"text\"", but on FC4 the > > incorrect result ""text"". > > The second one looks wrong here (no escapes shown), but I suspect those > inner quotes aren't really the same as the outer quotes, and that's why > they're not escaped. > > If you don't want the fancyquotes at all, you can use > options(useFancyQuotes=FALSE). In a package, it would be polite to do > this only locally, i.e. have something like > > save <- options(useFancyQuotes=FALSE) > on.exit(options(save)) > > in functions that call sQuote or dQuote, because options() belong to the > user, not to you. FWIW, on F7 I get: > sQuote("text") [1] "‘text’" > dQuote("text") [1] "“text”" options(useFancyQuotes = FALSE) > sQuote("text") [1] "'text'" > dQuote("text") [1] "\"text\"" The differing behavior between OS X and FC4 is perhaps due to the available character sets and the locales, presuming that they may not be the same. See the Details section of ?sQuote. I might also point out that FC4 has been EOL for some time. It would be prudent to consider updating to a more recent version. FC6 and F7 are the currently maintained releases, with F8 due to be released on November 8. HTH, Marc Schwartz __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
Re: [Rd] Inconsistent behavior of sQuote and dQuote
Dear Duncan and Marc Thank you for your comments, and please allow me to express my personal opinion: I have read the comments of Markus Kuhn mentioned in the help file to sQuote: http://www.cl.cam.ac.uk/~mgk25/ucs/quotes.html Since R is a programming language, the behavior should in my opinion be consistent for all platforms, and as default it should only rely on ASCII characters, in this case 0x22 and 0x27, so it is possible to pass these characters to other programming languages, in my case C++. Since shQuote(string,type) has already a type option, I would suggest to add options to sQuote() and dQuote(), too, with default being ASCII behavior. However, this is only my personal opinion. Best regards Christian Marc Schwartz wrote: > On Sun, 2007-10-14 at 11:56 -0400, Duncan Murdoch wrote: > >> On 14/10/2007 10:44 AM, cstrato wrote: >> >>> Dear all >>> >>> When comparing sQuote("text") and dQuote("text") on MacOS X and Linux FC4 >>> I get an inconsistent behavior (using the new release version R-2.6.0): >>> >>> sQuote: On Mac I get the correct result "'text'", but on FC4 the >>> incorrect result "`text´". >>> >> Those both look correct to me (but not the same). What do you see? >> >> >>> dQuote: On Mac I get the correct result "\"text\"", but on FC4 the >>> incorrect result ""text"". >>> >> The second one looks wrong here (no escapes shown), but I suspect those >> inner quotes aren't really the same as the outer quotes, and that's why >> they're not escaped. >> >> If you don't want the fancyquotes at all, you can use >> options(useFancyQuotes=FALSE). In a package, it would be polite to do >> this only locally, i.e. have something like >> >> save <- options(useFancyQuotes=FALSE) >> on.exit(options(save)) >> >> in functions that call sQuote or dQuote, because options() belong to the >> user, not to you. >> > > FWIW, on F7 I get: > > >> sQuote("text") >> > [1] "‘text’" > > >> dQuote("text") >> > [1] "“text”" > > > options(useFancyQuotes = FALSE) > > >> sQuote("text") >> > [1] "'text'" > > >> dQuote("text") >> > [1] "\"text\"" > > > The differing behavior between OS X and FC4 is perhaps due to the > available character sets and the locales, presuming that they may not be > the same. See the Details section of ?sQuote. > > I might also point out that FC4 has been EOL for some time. It would be > prudent to consider updating to a more recent version. FC6 and F7 are > the currently maintained releases, with F8 due to be released on > November 8. > > HTH, > > Marc Schwartz > > > > > __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
Re: [Rd] bug (?) in [.data.frame with matrix-like indexing
Uwe Ligges wrote: > Consider in R-2.6.0 (also R-patched from yesterday): > > iris[1, c(TRUE, FALSE, FALSE, FALSE, FALSE)] > ## Error in .subset2(xx, j) : recursive indexing failed at level 2 > > iris[1, c(FALSE, FALSE, FALSE, FALSE, TRUE)] > ## Error in .subset2(xx, j) : attempt to select less than one element > > i.e. matrix-like indexing on data.frames, one logically-indexed > dimension with only one value TRUE in it. > > It is not documented to work, but it did so in former versions of R. > Is it a bug or withdrawn support? > > > It's been reported before. Looks unintentional. As I also said last time, the log for the relevant revision has "make DF[, 1] and DF[1:m, 1] consistent" (and it doesn't...) > Uwe Ligges > > __ > 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 ~~ - ([EMAIL PROTECTED]) FAX: (+45) 35327907 __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
[Rd] data.frame row.names=NULL with named vector
A minor issue with data.frame is a change introduced leading to R 2.5.0, where row.names=NULL (i.e., do not name rows) is not honored with a named vector > x <- letters[1:3] > names(x) <- x > data.frame(x, row.names=NULL) x a a b b c c and a slightly more subtle example > data.frame(y=1:3, x, row.names=NULL) y x a 1 a b 2 b c 3 c A 2.5.0 news entry says o data.frame() ignored 'row.names' for 0-column data frames, and no longer treats an explicit row.names=NULL differently from the default value. The relevant section of ?data.frame however says If 'row.names' was supplied as 'NULL' or no suitable component was found the row names are the integer sequence starting at one This is not consistent with the current behavior, and is unchanged from the pre 2.5.0 version. The workaround is distinctly hackish > df <- data.frame(x) > row.names(df) <- NULL > sessionInfo() R version 2.7.0 Under development (unstable) (2007-10-13 r43163) x86_64-unknown-linux-gnu Martin __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
[Rd] Extending deriv3()
Hello, I was wondering if the functions deriv3(), deriv() etc. could be extended to handle psigamma() and its special cases (digamma(), trigamma() etc.). From the error message it seems that 'psigamma' needs to be added to the derivatives table. This might be easy since psigamma() has a deriv argument. Additionally, this error message is also obtained when requesting for the Hessian of the gamma and lgamma functions: d3 = deriv(~ gamma(y), namev="y", hessian= TRUE) d3 = deriv(~ lgamma(y), namev="y", hessian= TRUE) Another class of special functions worth adding are the Bessel functions. Thanks Thomas __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel