Re: [ESS] Possible problem with Org 9.6?

2022-12-02 Thread Colin Baxter via ESS-help
> William Denton via ESS-help writes: > On 2 December 2022, Colin Baxter wrote: >> I have now used your set-up, exactly I think, using "emacs-28.2 >> -q" and the latest ESS and I still cannot reproduce your >> error. For me, the src source block gives the expected >>

Re: [R] interval between specific characters in a string...

2022-12-02 Thread avi.e.gross
Evan, there are oodles of ways to do many things in R, and mcu of what the tidyverse supplies can often be done as easily, or easier, outside it. Before presenting a solution, I need to make sure I am answering the same question or problem you intend. Here is the string you have as an example:

Re: [R] interval between specific characters in a string...

2022-12-02 Thread Andrew Hart via R-help
Here's a function that can get the interval sizes for you. getStringSegmentLengths <- function(s, delim, ...) { nchar(unlist(strsplit(s, delim, ...))) + 1L } It uses strsplit to return a list of all the segments of the string separated by delim. delim can be a regular expression and with

Re: [R] interval between specific characters in a string...

2022-12-02 Thread Martin Morgan
You could split the string into letters and figure out which ones are �b� which(strsplit(x, "")[[1]] == "b") and then find the difference between each position, �anchoring� at position 0 > diff(c(0, which(strsplit(x, "")[[1]] == "b"))) [1] 2 4 1 6 4 From: R-help on behalf of Evan Cooch

Re: [R] interval between specific characters in a string...

2022-12-02 Thread Andrew Simmons
try gregexpr('b+', target_string) which looks for one or more b characters, then get the attribute "match.length" On Fri, Dec 2, 2022, 18:56 Evan Cooch wrote: > Was wondering if there is an 'efficient/elegant' way to do the following > (without tidyverse). Take a string > > abaaabbabaaab

[R] interval between specific characters in a string...

2022-12-02 Thread Evan Cooch
Was wondering if there is an 'efficient/elegant' way to do the following (without tidyverse). Take a string abaaabbabaaab Its easy enough to count the number of times the character 'b' shows up in the string, but...what I'm looking for is outputing the 'intervals' between occurrences of

Re: [ESS] Possible problem with Org 9.6?

2022-12-02 Thread William Denton via ESS-help
On 2 December 2022, Colin Baxter wrote: I have now used your set-up, exactly I think, using "emacs-28.2 -q" and the latest ESS and I still cannot reproduce your error. For me, the src source block gives the expected result. I'm stuck! Strange! But it's been fixed in Org, so whatever caused

Re: [ESS] Possible problem with Org 9.6?

2022-12-02 Thread Colin Baxter via ESS-help
Dear William, > William Denton via ESS-help writes: > On 1 December 2022, Colin Baxter via ESS-help wrote: >> My last post was mangled. The "Nor me" referred to a satisfactory >> output of the R code - not to "haven't a clue"! >> >> Are you using the latest ESS from

Re: [ESS] Possible problem with Org 9.6?

2022-12-02 Thread Colin Baxter via ESS-help
Ok, it's not ob-R. If I load ob-R I still get #+begin_src R :results output :session *R* :exports both x <- 2:4 print(x) #+end_src #+Results[5cafbcfc3677a0d07c696e39397c23e61ba0c021]: : [1] 2 3 4 __ ESS-help@r-project.org mailing list

Re: [ESS] Possible problem with Org 9.6?

2022-12-02 Thread Colin Baxter via ESS-help
Hello William, > William Denton via ESS-help writes: > On 1 December 2022, Colin Baxter via ESS-help wrote: >> My last post was mangled. The "Nor me" referred to a satisfactory >> output of the R code - not to "haven't a clue"! >> >> Are you using the latest ESS from