Re: [Rd] class() |--> c("matrix", "arrary") [was "head.matrix ..."]
>x %inherits% "data.frame" IMHO, I think that user-defined binary operators are being over-used within the R community. I don't think that they're "cute" or stylish. I think their use should be limited to cases, where they significantly increase the readability of the code. However, readability, is a (partly) subjective topic... __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
Re: [Rd] class() |--> c("matrix", "arrary") [was "head.matrix ..."]
On 11/12/19 12:21, Abby Spurdle wrote: > > >> x %inherits% "data.frame" > > IMHO, I think that user-defined binary operators are being over-used > within the R community. > > I don't think that they're "cute" or stylish. > I think their use should be limited to cases, where they significantly > increase the readability of the code. > > However, readability, is a (partly) subjective topic... > > > You can have your own rant about "user-defined binary operators being over-used within the R community" without suggesting that my rant was rude. I don't think it was and, in any case, I was not going after a individual in particular. Contrary to popular belief and to what I tell my daughter, rolling your eyes in public is not rude at all and is actually a lot of fun. You should try it ;-) -- Hervé Pagès Program in Computational Biology Division of Public Health Sciences Fred Hutchinson Cancer Research Center 1100 Fairview Ave. N, M1-B514 P.O. Box 19024 Seattle, WA 98109-1024 E-mail: hpa...@fredhutch.org Phone: (206) 667-5791 Fax:(206) 667-1319 __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
[Rd] calls with comment attribute
In general R doesn't print the "comment" attribute of an object > structure(1:3, comment=c("a comment", "another comment")) [1] 1 2 3 but if the object is a call it prints it in an unusual format > structure(quote(func(arg)), comment=c("a comment", "another comment")) a comment another comment func(arg) What is the rationale for the special treatment of calls? Bill Dunlap TIBCO Software wdunlap tibco.com [[alternative HTML version deleted]] __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
Re: [Rd] class() |--> c("matrix", "arrary") [was "head.matrix ..."]
> You can have your own rant about "user-defined binary operators being > over-used within the R community" without suggesting that my rant was > rude. I wasn't suggesting that you were rude. I was questioning a trend. __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
Re: [Rd] calls with comment attribute
Bill, Without being involved in that code at all, it seems that this could be used to (re)create commented source code from R objects. That format seems to correspond directly to a call in a .R file with two comments above it. A bit weird there's no comment character there but I guess thats expected to be in the values of the comment attribute? Anyway, just a guess. Best, ~G On Tue, Nov 12, 2019 at 2:02 PM William Dunlap via R-devel < r-devel@r-project.org> wrote: > In general R doesn't print the "comment" attribute of an object >> structure(1:3, comment=c("a comment", "another comment")) >[1] 1 2 3 > but if the object is a call it prints it in an unusual format >> structure(quote(func(arg)), comment=c("a comment", "another comment")) >a comment >another comment >func(arg) > > What is the rationale for the special treatment of calls? > > Bill Dunlap > TIBCO Software > wdunlap tibco.com > > [[alternative HTML version deleted]] > > __ > R-devel@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-devel > [[alternative HTML version deleted]] __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
Re: [Rd] calls with comment attribute
On 12/11/2019 5:01 p.m., William Dunlap via R-devel wrote: In general R doesn't print the "comment" attribute of an object > structure(1:3, comment=c("a comment", "another comment")) [1] 1 2 3 but if the object is a call it prints it in an unusual format > structure(quote(func(arg)), comment=c("a comment", "another comment")) a comment another comment func(arg) What is the rationale for the special treatment of calls? It was there in revision 2 of src/main/deparse.c in 1997. (For those unfamiliar with R history: the current revision of R is 77405. That particular file has been revised 248 times since rev 2.) I suspect either nobody has noticed it before, or nobody had the nerve to touch it. Duncan Murdoch __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
Re: [Rd] calls with comment attribute
I suspect that the parser used it to store comments, including the initial "#", before R started using the srcref attribute. (S also stored comments in the parse tree.) Bill Dunlap TIBCO Software wdunlap tibco.com On Tue, Nov 12, 2019 at 4:16 PM Duncan Murdoch wrote: > On 12/11/2019 5:01 p.m., William Dunlap via R-devel wrote: > > In general R doesn't print the "comment" attribute of an object > > > structure(1:3, comment=c("a comment", "another comment")) > > [1] 1 2 3 > > but if the object is a call it prints it in an unusual format > > > structure(quote(func(arg)), comment=c("a comment", "another > comment")) > > a comment > > another comment > > func(arg) > > > > What is the rationale for the special treatment of calls? > > It was there in revision 2 of src/main/deparse.c in 1997. (For those > unfamiliar with R history: the current revision of R is 77405. That > particular file has been revised 248 times since rev 2.) > > I suspect either nobody has noticed it before, or nobody had the nerve > to touch it. > > Duncan Murdoch > [[alternative HTML version deleted]] __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel