Re: [R] Regexp pattern but fixed replacement?

2024-04-11 Thread Duncan Murdoch
On 11/04/2024 12:57 p.m., Dave Dixon wrote: Backslashes in regex expressions in R are maddening, but they make sense. R string handling interprets your replacement string "\\" as just one backslash. Your string is received by gsub as "\" - that is, just the control backslash, NOT the character

Re: [R] Regexp pattern but fixed replacement?

2024-04-11 Thread Dave Dixon
Backslashes in regex expressions in R are maddening, but they make sense. R string handling interprets your replacement string "\\" as just one backslash. Your string is received by gsub as "\" - that is, just the control backslash, NOT the character backslash. gsub is expecting to see \0,

Re: [R] Regexp pattern but fixed replacement?

2024-04-11 Thread Iris Simmons
Hi Duncan, I only know about sub() and gsub(). There is no way to have pattern be a regular expression and replacement be a fixed string. Backslash is the only special character in replacement. If you need a reference, see this file:

[R] Regexp pattern but fixed replacement?

2024-04-11 Thread Duncan Murdoch
I noticed this issue in stringr::str_replace, but it also affects sub() in base R. If the pattern in a call to one of these needs to be a regular expression, then backslashes in the replacement text are treated specially. For example, gsub("a|b", "\\", "abcdef") gives "def", not

Re: [R] Regexp pattern but fixed replacement?

2024-04-11 Thread Duncan Murdoch
On 11/04/2024 12:58 p.m., Iris Simmons wrote: Hi Duncan, I only know about sub() and gsub(). There is no way to have pattern be a regular expression and replacement be a fixed string. Backslash is the only special character in replacement. If you need a reference, see this file:

[R] seeking help with splicing in R

2024-04-11 Thread Manya Budhiraja
Hello! I was trying to splice two wholesale price index deflators series which have different base years. One of them is called wpi_def_nic2004(from 2005 to 2012), and another is called wpi_def_nic2008(from 2012 to 2019). I am trying to create a single series such that the base year prices are

[R] [R-pkgs] New package - fastTS

2024-04-11 Thread Peterson, Ryan
Hi R enthusiasts, I am happy to announce a new package available on CRAN: fastTS (https://cran.r-project.org/web/packages/fastTS/). fastTS is especially useful for large time series with exogenous features and/or complex seasonality (i.e. with multiple modes), allowing for possibly

Re: [R] seeking help with splicing in R

2024-04-11 Thread Ebert,Timothy Aaron
Whatever you had as HTML was deleted. If that was data we did not get it. 1) manipulate wpi_def_nic2004 and wpi_def_nic2008 first so that the data are compatible, then join them. 2) The full_join statement should explicitly state the columns to join by. Using by=NULL joins by all the columns

Re: [ESS] Displaying R plots within an Emacs buffer

2024-04-11 Thread Stephen J. Eglen via ESS-help
I've tidied up the code for showing R plots as SVG in an Emacs buffer; it is now on melpa: https://melpa.org/#/essgd so package.el can grab it easily enough. Best wishes, Stephen On Wed, Mar 27 2024, Stephen J. Eglen wrote: I've got it now working locally so that the aspect ratio is

[ESS] Parameterized quarto qmd in ESS?

2024-04-11 Thread Micha Silver via ESS-help
I'm working on a quarto template with ESS that runs 'R' code chunks . When using RStudio, if there are parameters set in the yaml header, the default values are available in code chunks (for testing the template). However in ESS the `params$...` variables are not available. How would I create