Hi,
I would really like to have a way to split long string literals across
multiple lines in R.
Currently, if a string literal spans multiple lines, there is no way to
inhibit the introduction of newline characters:
> "aaa
+ bbb"
[1] "aaa\nbbb"
If a line ends with a backslash, it is just
On 14/06/2017 5:58 AM, Andreas Kersting wrote:
Hi,
I would really like to have a way to split long string literals across
multiple lines in R.
I don't understand why you require the string to be a literal. Why not
construct the long string in an expression like
paste0("aaa",
"bbb"
On Wed, Jun 14, 2017 at 12:12 PM, Duncan Murdoch
wrote:
> On 14/06/2017 5:58 AM, Andreas Kersting wrote:
>>
>> Hi,
>>
>> I would really like to have a way to split long string literals across
>> multiple lines in R.
You can also look at the glue package, it supports continuation and a lot more:
On Wed, 14 Jun 2017 06:12:09 -0500, Duncan Murdoch
wrote:
> On 14/06/2017 5:58 AM, Andreas Kersting wrote:
> > Hi,
> >
> > I would really like to have a way to split long string literals across
> > multiple lines in R.
>
> I don't understand why you require the string to be a literal. Why not
Having some line-breaking character for string literals would have benefits
as string literals can then be constructed parse-time rather than run-time.
I have run into this myself a few times as well. One way to at least
emulate something like that is the following.
`%+%` <- function(x,y) paste0(x
Mark, that's actually a fair statement, although your extra operator
doesn't cause construction at parse time. You still call paste0(), but just
add an extra layer on top of it.
I also doubt that even in gigantic loops the benefit is going to be
significant. Take following example:
atestfun <- fu
I know it doesn't cause construction at parse time, and it was also not
what I said. What I meant was that it makes the syntax at least look a
little as if you have a line-breaking character within string literals.
Op wo 14 jun. 2017 om 14:18 schreef Joris Meys :
> Mark, that's actually a fair st
Hi Mark,
I got you. I just pointed out the obvious to illustrate why your emulation
didn't eliminate the need for the real thing. I didn't mean to imply you
weren't aware of this, even though it may seem so. Sometimes I'm not 100%
aware of the subtleties of the English language. This seems one of
Consider the following simple data set and a call to ave:
> tdata <- data.frame(f1=c(1,1,1,1,2,2,2,2), f2=c(1,2,1,2,1,1,1,1), y=1:8)
> with(tdata, table(f1, f2))
f2
f1 1 2
1 2 2
2 4 0
> with(tdata, ave(y, f1, f2, FUN=max))
[1] 3 4 3 4 8 8 8 8
Warning message:
In FUN(X[[i]], ...) : no no
On 14/06/2017 6:45 AM, Andreas Kersting wrote:
On Wed, 14 Jun 2017 06:12:09 -0500, Duncan Murdoch
wrote:
On 14/06/2017 5:58 AM, Andreas Kersting wrote:
Hi,
I would really like to have a way to split long string literals across
multiple lines in R.
I don't understand why you require the st
As I recall this has been discussed at least a few times (unfortunately I'm
traveling so can't check the references), but the justification was never
satisfactory.
Personally, I wouldn't mind string continuation supported since it makes for
more readable code (I had one of my packages raise a N
> On 13 Jun 2017, at 22:05, luke-tier...@uiowa.edu wrote:
>
> Thanks. This should be resolved in R-devel(r72788) and R-patched
> (r72789)
>
Also thanks.
It is resolved in R-patched.
Berend
> Best,
>
> luke
>
> On Mon, 12 Jun 2017, Berend Hasselman wrote:
>
>>
>>
>> In this email to the R
On Wed, Jun 14, 2017 at 8:48 AM, Simon Urbanek
wrote:
> As I recall this has been discussed at least a few times (unfortunately I'm
> traveling so can't check the references), but the justification was never
> satisfactory.
>
> Personally, I wouldn't mind string continuation supported since it m
Le 14/06/2017 à 12:58, Andreas Kersting a écrit :
Hi,
I would really like to have a way to split long string literals across multiple
lines in R.
...
An alternative approach could be to have something like
("aaa "
"bbb")
This is C-style and if the core-team decides to implement it,
it could
Original Message
From: Duncan Murdoch [mailto:murdoch.dun...@gmail.com]
Sent: Wednesday, Jun 14, 2017 1:36 PM GMT
To: Andreas Kersting
Cc: r-devel
Subject: [Rd] [WISH / PATCH] possibility to split string literals across
multiple lines
On 14/06/2017 6:45 AM, Andreas Kersting
If you are changing the parser (which is a major change) you
might consider treating strings in the C/C++ way:
char *s = "A"
"B";
means the same as
char *s = "AB";
I am not a big fan of that syntax but it is widely used.
A backslash at the end of the line leads to errors
I don't think it is reasonable to change the parser this way. This is
currently valid R code:
a <- "foo"
"bar"
and with the new syntax, it is also valid, but with a different
meaning. Or you can even consider
a <- "foo"
bar %>% func() %>% print()
etc.
I like the idea of string literals, but th
Original Message
From: Hadley Wickham [mailto:h.wick...@gmail.com]
Sent: Wednesday, Jun 14, 2017 2:51 PM GMT
To: Simon Urbanek
Cc: Andreas Kersting; r-devel@r-project.org
Subject: [Rd] [WISH / PATCH] possibility to split string literals across
multiple lines
On Wed, Jun 14, 2
You can avoid the warnings and the unneeded calls to FUN by adding
drop=TRUE to the call to ave(), since all of its ... arguments are passed
to interaction (I think).
In TERR we dealt with this problem by adding drop=TRUE to ave's
argument list and we pass ... and drop=drop to interaction. I'm no
In R devel r72789, the added part in 'factor' documentation (factor.Rd) is the
following.
Undocumentedly for a long time, \code{factor(x)} loses all
\code{\link{attributes}(x)} but \code{"names"}, and resets \code{"levels"} and
\code{"class"}.
In the code of function 'factor', names(x) is copie
Dear R devel
I've been wondering about this for a while. I am sorry to ask for your
time, but can one of you help me understand this?
This concerns duplicated labels, not levels, in the factor function.
I think it is hard to understand that factor() fails, but levels()
after does not
> x <- 1:
21 matches
Mail list logo