Re: [R] Pipe operator

2023-01-03 Thread Andrew Hart via R-help
Keep in mind that in thie example you're processing x and placing the result back in x (so x must already exist). You can write this a bit more cleanly using the -> variant of the assignment operator as follows: x |> cos() |> max(pi/4) |> round(3) -> x Hth, Andrew. On 3/01/2023 16:00, Boris

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 ...,

[R] Problem with Windows clipboard and UTF-8

2022-09-30 Thread Andrew Hart via R-help
Hi everyone, Recently I upgraded to R 4.2.1 which now uses UTF-8 internally as its native encoding. Very nice. However, I've discovered that if I use writeClipboard to try and move a string containing accented characters to the Windows clipboard and then try and paste that into another applic

Re: [R] How to set default encoding for sourced files

2022-09-23 Thread Andrew Hart via R-help
of R? On Wed., Sep. 21, 2022, 14:20 Andrew Hart via R-help, mailto:r-help@r-project.org>> wrote: On 21/09/2022 11:46, Bert Gunter wrote: > ?options > > options(encoding = "utf-8") > in a startup file or function should presumably do it. See ?Sta

Re: [R] [Rd] Problem with accessibility in R 4.2.0 and 4.2.1.

2022-09-23 Thread Andrew Hart via R-help
On 22/09/2022 16:42, Toby Hocking wrote: Another option is to use https://emacspeak.sourceforge.net/ (version of emacs editor/ide which can speak letters/words/lines -- has a blind maintainer) with https://ess.r-project.org/ (int

Re: [R] How to set default encoding for sourced files

2022-09-21 Thread Andrew Hart via R-help
On 21/09/2022 11:46, Bert Gunter wrote: ?options options(encoding = "utf-8") in a startup file or function should presumably do it. See ?Startup Bert Thanks everyone. Setting encoding in options in Rprofile.site has taken care of it. Curiously, it doesn't seem to solve the whole problem fo

[R] How to set default encoding for sourced files

2022-09-21 Thread Andrew Hart via R-help
Hi there. I'm working with some utf-8 incoded csv files which gives me data frames with utf-8 encoded headers. This means when I write things like dat$proporción in an R script and then source it, I have to make sure the R script is incoded using utf-8 (and not latin1) and then I also have to ex