[R-es] Importar gráficos Word

2023-06-27 Thread Javier Gómez Gonzalez
Hola a todos.

Quisiera saber cual es la mejor forma de insertar gráficos hechos con
ggplot2 en Word. Ya sé que lo mejor es usar R-Markdown, pero todavía no he
empezado con él. Lo que hago es guardar los gráficos con ggsave en formato
png con una resolución de 600 y luego los inserto en un documento de Word.
Suelo utilizar una relación ancho alto 16:9 ¿Alguna sugerencia respecto a
la resolución y a la relación ancho alto a usar en los gráficos?

 Javier Gómez González

[[alternative HTML version deleted]]

___
R-help-es mailing list
R-help-es@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-help-es


Re: [ESS] Working with Roxygen2

2023-06-27 Thread Vikas Rawal via ESS-help
>
>
> and save it, ESS mode offers in menu ESS an entry Roxygen with first option
> Generate/Update Template and keyboard shortcut C-c C-o C-o (in my version).
> That has been here since _forever_.  Invoking it adds this header above
>
> Oops. I did not look at the most obvious place!!

and that is 'Good Enough for Me (TM)'.  I can't remember if I had to set an
> Emacs variable to have my username come up or if ESS queries my Linux host
> but it is all quite nicely done.
>
> Indeed. Thanks.

Cheers,

V.

[[alternative HTML version deleted]]

__
ESS-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/ess-help


Re: [ESS] Working with Roxygen2

2023-06-27 Thread Dirk Eddelbuettel via ESS-help


On 28 June 2023 at 06:49, Vikas Rawal via ESS-help wrote:
| I am trying to build my first R package, and am using Roxygen2 to document
| the functions. I was wondering if there is anything that would provide a
| boilerplate template? Maybe a yasnippet or something better?

There is and AFAIK always has been.

I.e. when I open a new file /tmp/pyth.R and add

pyth <- function(x, y) {
sqrt(x^2 + y^2)
}

and save it, ESS mode offers in menu ESS an entry Roxygen with first option
Generate/Update Template and keyboard shortcut C-c C-o C-o (in my version).
That has been here since _forever_.  Invoking it adds this header above

##' .. content for \description{} (no empty lines) ..
##'
##' .. content for \details{} ..
##' @title 
##' @param x 
##' @param y 
##' @return 
##' @author Dirk Eddelbuettel
pyth <- function(x, y) {
sqrt(x^2 + y^2)
}

and that is 'Good Enough for Me (TM)'.  I can't remember if I had to set an
Emacs variable to have my username come up or if ESS queries my Linux host
but it is all quite nicely done.

Hth, Dirk

-- 
dirk.eddelbuettel.com | @eddelbuettel | e...@debian.org

__
ESS-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/ess-help


[ESS] Working with Roxygen2

2023-06-27 Thread Vikas Rawal via ESS-help
Hi everyone.

I am trying to build my first R package, and am using Roxygen2 to document
the functions. I was wondering if there is anything that would provide a
boilerplate template? Maybe a yasnippet or something better?

Thanks,

V.

[[alternative HTML version deleted]]

__
ESS-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/ess-help


Re: [R] Help with regex replacements

2023-06-27 Thread Chris Evans via R-help

Magic!

tmp %>%
  as_tibble() %>%
  rename(Text = value) %>%
  mutate(Text = str_replace_all(Text, fixed("."), "")) %>%
  # filter(row_number() < 4) %>%
  mutate(Text2 = gsub("((|/)[[:alnum:]]+)|(\\([[:alnum:]-]+\\))", 
"", Text))


Which (as you have already shown!) gave me this:

# A tibble: 7 × 2
  Text Text2
   
1 "Я досяг того, чого хотів"  "Я досяг того, чого 
хотів"
2 "Мені вдалося зробити бажане"   "Мені вдалося зробити 
бажане"
3 "Я досяг (досягла) того, чого хотів (хотіла)"   "Я досяг того, чого 
хотів "
4 "Я досяг(-ла) речей, яких хотілося досягти" "Я досяг речей, яких 
хотілося досягти"
5 "Я досяг/ла того, чого хотів/ла"    "Я досяг того, чого 
хотів"
6 "Я досяг\\досягла того, чого прагнув\\прагнула" "Я досяг того, чого 
прагнув"
7 "Я досягнув(ла) того, чого хотів(ла)"   "Я досягнув того, чого 
хотів"


perfect and I will spend some time tomorrow unpacking that regex and 
trying to drive the learning points into my thick skull!


Deeply indebted, as so often here though generally only when I'm reading 
others questions and the answers!


Chris

On 27/06/2023 20:48, Bert Gunter wrote:
OK, so you want parentheses, not "brackets" + I think I misinterpreted 
your specification, which I think is actually incomplete. Based on 
what I think you meant, how does this work:


gsub("((|/)[[:alnum:]]+)|(\\([[:alnum:]-]+\\))", "",tmp$Text)
[1] "Я досяг того, чого хотів"              "Мені вдалося\nзробити 
бажане"
[3] "Я досяг  того, чого хотів "            "Я\nдосяг речей, яких 
хотілося досягти"

[5] "Я досяг того, чого\nхотів"             "Я досяг того, чого прагнув"
[7] "Я\nдосягнув того, чого хотів"

If you want it without the \n's, cat the above to get:
cat(gsub("((|/)[[:alnum:]]+)|(\\([[:alnum:]-]+\\))", "",tmp$Text))

Я досяг того, чого хотів Мені вдалося
зробити бажане Я досяг  того, чого хотів  Я
досяг речей, яких хотілося досягти Я досяг того, чого
хотів Я досяг того, чого прагнув Я
досягнув того, чого хотів

Cheers,
Bert

On Tue, Jun 27, 2023 at 11:09 AM Bert Gunter  
wrote:


Does this do it for you (or get you closer):

 gsub("\\[.*\\]|[] |/ ","",tmp$Text)
[1] "Я досяг того, чого хотів"
[2] "Мені вдалося\nзробити бажане"
[3] "Я досяг (досягла) того, чого хотів (хотіла)"
[4] "Я\nдосяг(-ла) речей, яких хотілося досягти"
[5] "Я досяг/ла того, чого\nхотів/ла"
[6] "Я досяг\\досягла того, чого прагнув\\прагнула"
[7] "Я\nдосягнув(ла) того, чого хотів(ла)"

On Tue, Jun 27, 2023 at 10:16 AM Chris Evans via R-help
 wrote:

I am sure this is easy for people who are good at regexps but I'm
failing with it.  The situation is that I have hundreds of
lines of
Ukrainian translations of some English. They contain things
like this:

1"Я досяг того, чого хотів"2"Мені вдалося зробити бажане"3"Я
досяг
(досягла) того, чого хотів (хотіла)"4"Я досяг(-ла) речей, яких
хотілося
досягти"5"Я досяг/ла того, чого хотів/ла"6"Я досяг\\досягла
того, чого
прагнув\\прагнула."7"Я досягнув(ла) того, чого хотів(ла)"

Using dput():

tmp <- structure(list(Text = c("Я досяг того, чого хотів",
"Мені вдалося
зробити бажане", "Я досяг (досягла) того, чого хотів
(хотіла)", "Я
досяг(-ла) речей, яких хотілося досягти", "Я досяг/ла того, чого
хотів/ла", "Я досяг\\досягла того, чого прагнув\\прагнула", "Я
досягнув(ла) того, чого хотів(ла)" )), row.names = c(NA, -7L),
class =
c("tbl_df", "tbl", "data.frame" )) Those show four different ways
translators have handled gendered words: 1) Ignore them and (I'm
guessing) only give the masculine 2) Give the feminine form of
the word
(or just the feminine suffix) in brackets 3) Give the feminine
form/suffix prefixed by a forward slash 4) Give the feminine
form/suffix
prefixed by backslash (here a double backslash) I would like
just to
drop all these feminine gendered options. (Don't worry,
they'll get back
in later.) So I would like to replace 1) anything between
brackets with
nothing! 2) anything between a forward slash and the next
space with
nothing 3) anything between a backslash and the next space
with nothing
but preserving the rest of the text. I have been trying to
achieve this
using str_replace_all() but I am failing utterly. Here's a
silly little
example of my failures. This was just trying to get the text I
wanted to
replace (as I was trying to simplify the issues for my tired
wetware): >
tmp %>%+ as_tibble() %>% + rename(Text = value) %>% +
mutate(Text =
str_replace_all(Text, fixed("."), "")) %>% +
filter(row_number() < 4)
%>% + mutate(Text2 = str_replace(Text, 

Re: [R] Help with regex replacements

2023-06-27 Thread Bert Gunter
OK, so you want parentheses, not "brackets" + I think I misinterpreted your
specification, which I think is actually incomplete. Based on what I think
you meant, how does this work:

gsub("((|/)[[:alnum:]]+)|(\\([[:alnum:]-]+\\))", "",tmp$Text)
[1] "Я досяг того, чого хотів"  "Мені вдалося\nзробити бажане"

[3] "Я досяг  того, чого хотів ""Я\nдосяг речей, яких хотілося
досягти"
[5] "Я досяг того, чого\nхотів" "Я досяг того, чого прагнув"

[7] "Я\nдосягнув того, чого хотів"

If you want it without the \n's, cat the above to get:
cat(gsub("((|/)[[:alnum:]]+)|(\\([[:alnum:]-]+\\))", "",tmp$Text))

Я досяг того, чого хотів Мені вдалося
зробити бажане Я досяг  того, чого хотів  Я
досяг речей, яких хотілося досягти Я досяг того, чого
хотів Я досяг того, чого прагнув Я
досягнув того, чого хотів

Cheers,
Bert

On Tue, Jun 27, 2023 at 11:09 AM Bert Gunter  wrote:

> Does this do it for you (or get you closer):
>
>  gsub("\\[.*\\]|[] |/ ","",tmp$Text)
> [1] "Я досяг того, чого хотів"
> [2] "Мені вдалося\nзробити бажане"
> [3] "Я досяг (досягла) того, чого хотів (хотіла)"
> [4] "Я\nдосяг(-ла) речей, яких хотілося досягти"
> [5] "Я досяг/ла того, чого\nхотів/ла"
> [6] "Я досяг\\досягла того, чого прагнув\\прагнула"
> [7] "Я\nдосягнув(ла) того, чого хотів(ла)"
>
> On Tue, Jun 27, 2023 at 10:16 AM Chris Evans via R-help <
> r-help@r-project.org> wrote:
>
>> I am sure this is easy for people who are good at regexps but I'm
>> failing with it.  The situation is that I have hundreds of lines of
>> Ukrainian translations of some English. They contain things like this:
>>
>> 1"Я досяг того, чого хотів"2"Мені вдалося зробити бажане"3"Я досяг
>> (досягла) того, чого хотів (хотіла)"4"Я досяг(-ла) речей, яких хотілося
>> досягти"5"Я досяг/ла того, чого хотів/ла"6"Я досяг\\досягла того, чого
>> прагнув\\прагнула."7"Я досягнув(ла) того, чого хотів(ла)"
>>
>> Using dput():
>>
>> tmp <- structure(list(Text = c("Я досяг того, чого хотів", "Мені вдалося
>> зробити бажане", "Я досяг (досягла) того, чого хотів (хотіла)", "Я
>> досяг(-ла) речей, яких хотілося досягти", "Я досяг/ла того, чого
>> хотів/ла", "Я досяг\\досягла того, чого прагнув\\прагнула", "Я
>> досягнув(ла) того, чого хотів(ла)" )), row.names = c(NA, -7L), class =
>> c("tbl_df", "tbl", "data.frame" )) Those show four different ways
>> translators have handled gendered words: 1) Ignore them and (I'm
>> guessing) only give the masculine 2) Give the feminine form of the word
>> (or just the feminine suffix) in brackets 3) Give the feminine
>> form/suffix prefixed by a forward slash 4) Give the feminine form/suffix
>> prefixed by backslash (here a double backslash) I would like just to
>> drop all these feminine gendered options. (Don't worry, they'll get back
>> in later.) So I would like to replace 1) anything between brackets with
>> nothing! 2) anything between a forward slash and the next space with
>> nothing 3) anything between a backslash and the next space with nothing
>> but preserving the rest of the text. I have been trying to achieve this
>> using str_replace_all() but I am failing utterly. Here's a silly little
>> example of my failures. This was just trying to get the text I wanted to
>> replace (as I was trying to simplify the issues for my tired wetware): >
>> tmp %>%+ as_tibble() %>% + rename(Text = value) %>% + mutate(Text =
>> str_replace_all(Text, fixed("."), "")) %>% + filter(row_number() < 4)
>> %>% + mutate(Text2 = str_replace(Text, "\\(.*\\)", "\\1")) Errorin
>> `mutate()`:ℹIn argument: `Text2 = str_replace(Text, "\\(.*\\)",
>> "\\1")`.Caused by error in `stri_replace_first_regex()`:!Trying to
>> access the index that is out of bounds. (U_INDEX_OUTOFBOUNDS_ERROR) Run
>> `rlang::last_trace()` to see where the error occurred. I have tried
>> gurgling around the internet but am striking out so throwing myself on
>> the list. Apologies if this is trivial but I'd hate to have to clean
>> these hundreds of lines by hand though it's starting to look as if I'd
>> achieve that faster by hand than I will by banging my ignorance of R
>> regexp syntax on the problem. TIA, Chris
>>
>> --
>> Chris Evans (he/him)
>> Visiting Professor, UDLA, Quito, Ecuador & Honorary Professor,
>> University of Roehampton, London, UK.
>> Work web site: https://www.psyctc.org/psyctc/
>> CORE site: http://www.coresystemtrust.org.uk/
>> Personal site: https://www.psyctc.org/pelerinage2016/
>>
>> __
>> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide
>> http://www.R-project.org/posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.
>>
>

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting 

Re: [R] Help with regex replacements

2023-06-27 Thread Bert Gunter
Does this do it for you (or get you closer):

 gsub("\\[.*\\]|[] |/ ","",tmp$Text)
[1] "Я досяг того, чого хотів"
[2] "Мені вдалося\nзробити бажане"
[3] "Я досяг (досягла) того, чого хотів (хотіла)"
[4] "Я\nдосяг(-ла) речей, яких хотілося досягти"
[5] "Я досяг/ла того, чого\nхотів/ла"
[6] "Я досяг\\досягла того, чого прагнув\\прагнула"
[7] "Я\nдосягнув(ла) того, чого хотів(ла)"

On Tue, Jun 27, 2023 at 10:16 AM Chris Evans via R-help <
r-help@r-project.org> wrote:

> I am sure this is easy for people who are good at regexps but I'm
> failing with it.  The situation is that I have hundreds of lines of
> Ukrainian translations of some English. They contain things like this:
>
> 1"Я досяг того, чого хотів"2"Мені вдалося зробити бажане"3"Я досяг
> (досягла) того, чого хотів (хотіла)"4"Я досяг(-ла) речей, яких хотілося
> досягти"5"Я досяг/ла того, чого хотів/ла"6"Я досяг\\досягла того, чого
> прагнув\\прагнула."7"Я досягнув(ла) того, чого хотів(ла)"
>
> Using dput():
>
> tmp <- structure(list(Text = c("Я досяг того, чого хотів", "Мені вдалося
> зробити бажане", "Я досяг (досягла) того, чого хотів (хотіла)", "Я
> досяг(-ла) речей, яких хотілося досягти", "Я досяг/ла того, чого
> хотів/ла", "Я досяг\\досягла того, чого прагнув\\прагнула", "Я
> досягнув(ла) того, чого хотів(ла)" )), row.names = c(NA, -7L), class =
> c("tbl_df", "tbl", "data.frame" )) Those show four different ways
> translators have handled gendered words: 1) Ignore them and (I'm
> guessing) only give the masculine 2) Give the feminine form of the word
> (or just the feminine suffix) in brackets 3) Give the feminine
> form/suffix prefixed by a forward slash 4) Give the feminine form/suffix
> prefixed by backslash (here a double backslash) I would like just to
> drop all these feminine gendered options. (Don't worry, they'll get back
> in later.) So I would like to replace 1) anything between brackets with
> nothing! 2) anything between a forward slash and the next space with
> nothing 3) anything between a backslash and the next space with nothing
> but preserving the rest of the text. I have been trying to achieve this
> using str_replace_all() but I am failing utterly. Here's a silly little
> example of my failures. This was just trying to get the text I wanted to
> replace (as I was trying to simplify the issues for my tired wetware): >
> tmp %>%+ as_tibble() %>% + rename(Text = value) %>% + mutate(Text =
> str_replace_all(Text, fixed("."), "")) %>% + filter(row_number() < 4)
> %>% + mutate(Text2 = str_replace(Text, "\\(.*\\)", "\\1")) Errorin
> `mutate()`:ℹIn argument: `Text2 = str_replace(Text, "\\(.*\\)",
> "\\1")`.Caused by error in `stri_replace_first_regex()`:!Trying to
> access the index that is out of bounds. (U_INDEX_OUTOFBOUNDS_ERROR) Run
> `rlang::last_trace()` to see where the error occurred. I have tried
> gurgling around the internet but am striking out so throwing myself on
> the list. Apologies if this is trivial but I'd hate to have to clean
> these hundreds of lines by hand though it's starting to look as if I'd
> achieve that faster by hand than I will by banging my ignorance of R
> regexp syntax on the problem. TIA, Chris
>
> --
> Chris Evans (he/him)
> Visiting Professor, UDLA, Quito, Ecuador & Honorary Professor,
> University of Roehampton, London, UK.
> Work web site: https://www.psyctc.org/psyctc/
> CORE site: http://www.coresystemtrust.org.uk/
> Personal site: https://www.psyctc.org/pelerinage2016/
>
> __
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Help with regex replacements

2023-06-27 Thread Chris Evans via R-help

Thanks Avi (I am a keen follower or your, and other stalwart helpers here).

On 27/06/2023 18:27, avi.e.gr...@gmail.com wrote:

Chris,

Consider breaking up your task into multiple passes.


Sorry, I could have explained more of what I had tried.  I never know 
how long to make things here.


I had been doing that. My plan was to pick them off, one by one but I 
think I am banging my head on a fundamental incomprehension on my part.



And do them in whatever order preserves what you need.

Agree.

First, are you talking about brackets as in square brackets, or as in your 
example, parentheses?

Sorry, always get that wrong, parentheses. Mea culpa.

If you are sure you have no nested brackets, your requirement seems to be that 
anything matching [ stuff ] be replaced with nothing. Or if using parentheses, 
something similar.
> 99% sure there are no nested parentheses.  However, there are lines 
with none, one or sometimes (as in the little reprex) more than one set 
of parentheses.

Your issue here is both sets of symbols are special so you must escape them so 
they are seen as part of the pattern and not the instructions.
So, sorry to be stupid but I thought I was doing that using "\(.*\)"  
Could you reply showing me the correct escaping and the correct 
replacing?  I was using str_replace_all() but happy to use gsub() if 
that's easier/safer/better.

The idea would be to pass through the text once and match all instances on a 
line and then replace with nothing or whatever is needed.

Nothing.

  But there is no guarantee some of your constructs will be on the same line 
completely so be wary.


Totally agree.

I also see that my Emailer (Thunderbird) despite my exhorting it not to, 
mangled the Email.  Have tried to fix that.  The mess below should have 
said:


I am sure this is easy for people who are good at regexps but I'm
failing with it.  The situation is that I have hundreds of lines of
Ukrainian translations of some English. They contain things like this:

1"Я досяг того, чого хотів"
2"Мені вдалося зробити бажане"
3"Я досяг (досягла) того, чого хотів (хотіла)"
4"Я досяг(-ла) речей, яких хотілося досягти"
5"Я досяг/ла того, чого хотів/ла"
6"Я досяг\\досягла того, чогопрагнув\\прагнула."7"Я досягнув(ла) того, 
чого хотів(ла)"


Using dput():

tmp <- structure(list(Text = c("Я досяг того, чого хотів",
"Мені вдалося зробити бажане",
"Я досяг (досягла) того, чого хотів (хотіла)",
"Я досяг(-ла) речей, яких хотілося досягти",
"Я досяг/ла того, чого хотів/ла",
"Я досяг\\досягла того, чого прагнув\\прагнула",
"Я досягнув(ла) того, чого хотів(ла)" )),
row.names = c(NA, -7L), class = c("tbl_df", "tbl", "data.frame" ))

Those show four different ways translators have handled gendered words:

1) Ignore them and (I'm guessing) only give the masculine
2) Give the feminine form of the word (or just the feminine suffix) in 
brackets

3) Give the feminine form/suffix prefixed by a forward slash
4) Give the feminine form/suffix prefixed by backslash (here a double 
backslash)


I would like just to drop all these feminine gendered options. (Don't 
worry,

they'll get back in later.)

So I would like to replace
1) anything between brackets with nothing!
2) anything between a forward slash and the next space with nothing
3) anything between a backslash and the next space with nothing
but preserving the rest of the text. I have been trying to achieve this
using str_replace_all() but I am failing utterly.

Here's a silly little example of my failures.
This was just trying to get the text I wanted to
replace (as I was trying to simplify the issues for my tired wetware):

> tmp %>%
+ as_tibble() %>%
+ rename(Text = value) %>%
+ mutate(Text = str_replace_all(Text, fixed("."), "")) %>%
+ filter(row_number() < 4) %>%
+ mutate(Text2 = str_replace(Text, "\\(.*\\)", "\\1"))

Error in `mutate()`:ℹIn argument: `Text2 = str_replace(Text, "\\(.*\\)",
"\\1")`.

Caused by error in `stri_replace_first_regex()`:!
Trying to access the index that is out of bounds. 
(U_INDEX_OUTOFBOUNDS_ERROR)

Run `rlang::last_trace()` to see where the error occurred.

I have tried gurgling around the internet but am striking out so 
throwing myself on

the list. Apologies if this is trivial but I'd hate to have to clean
these hundreds of lines by hand though it's starting to look as if I'd
achieve that faster by hand than I will by banging my ignorance of R
regexp syntax on the problem. TIA, Chris




  


-Original Message-
From: R-help  On Behalf Of Chris Evans via R-help
Sent: Tuesday, June 27, 2023 1:16 PM
To: r-help@r-project.org
Subject: [R] Help with regex replacements

I am sure this is easy for people who are good at regexps but I'm
failing with it.  The situation is that I have hundreds of lines of
Ukrainian translations of some English. They contain things like this:

1"Я досяг того, чого хотів"2"Мені вдалося зробити бажане"3"Я досяг
(досягла) того, чого хотів (хотіла)"4"Я досяг(-ла) речей, яких хотілося
досягти"5"Я досяг/ла 

Re: [R] Help with regex replacements

2023-06-27 Thread avi.e.gross
Chris,

Consider breaking up your task into multiple passes.

And do them in whatever order preserves what you need.

First, are you talking about brackets as in square brackets, or as in your 
example, parentheses?

If you are sure you have no nested brackets, your requirement seems to be that 
anything matching [ stuff ] be replaced with nothing. Or if using parentheses, 
something similar.

Your issue here is both sets of symbols are special so you must escape them so 
they are seen as part of the pattern and not the instructions.

The idea would be to pass through the text once and match all instances on a 
line and then replace with nothing or whatever is needed. But there is no 
guarantee some of your constructs will be on the same line completely so be 
wary.

 

-Original Message-
From: R-help  On Behalf Of Chris Evans via R-help
Sent: Tuesday, June 27, 2023 1:16 PM
To: r-help@r-project.org
Subject: [R] Help with regex replacements

I am sure this is easy for people who are good at regexps but I'm 
failing with it.  The situation is that I have hundreds of lines of 
Ukrainian translations of some English. They contain things like this:

1"Я досяг того, чого хотів"2"Мені вдалося зробити бажане"3"Я досяг 
(досягла) того, чого хотів (хотіла)"4"Я досяг(-ла) речей, яких хотілося 
досягти"5"Я досяг/ла того, чого хотів/ла"6"Я досяг\\досягла того, чого 
прагнув\\прагнула."7"Я досягнув(ла) того, чого хотів(ла)"

Using dput():

tmp <- structure(list(Text = c("Я досяг того, чого хотів", "Мені вдалося 
зробити бажане", "Я досяг (досягла) того, чого хотів (хотіла)", "Я 
досяг(-ла) речей, яких хотілося досягти", "Я досяг/ла того, чого 
хотів/ла", "Я досяг\\досягла того, чого прагнув\\прагнула", "Я 
досягнув(ла) того, чого хотів(ла)" )), row.names = c(NA, -7L), class = 
c("tbl_df", "tbl", "data.frame" )) Those show four different ways 
translators have handled gendered words: 1) Ignore them and (I'm 
guessing) only give the masculine 2) Give the feminine form of the word 
(or just the feminine suffix) in brackets 3) Give the feminine 
form/suffix prefixed by a forward slash 4) Give the feminine form/suffix 
prefixed by backslash (here a double backslash) I would like just to 
drop all these feminine gendered options. (Don't worry, they'll get back 
in later.) So I would like to replace 1) anything between brackets with 
nothing! 2) anything between a forward slash and the next space with 
nothing 3) anything between a backslash and the next space with nothing 
but preserving the rest of the text. I have been trying to achieve this 
using str_replace_all() but I am failing utterly. Here's a silly little 
example of my failures. This was just trying to get the text I wanted to 
replace (as I was trying to simplify the issues for my tired wetware): > 
tmp %>%+ as_tibble() %>% + rename(Text = value) %>% + mutate(Text = 
str_replace_all(Text, fixed("."), "")) %>% + filter(row_number() < 4) 
%>% + mutate(Text2 = str_replace(Text, "\\(.*\\)", "\\1")) Errorin 
`mutate()`:ℹIn argument: `Text2 = str_replace(Text, "\\(.*\\)", 
"\\1")`.Caused by error in `stri_replace_first_regex()`:!Trying to 
access the index that is out of bounds. (U_INDEX_OUTOFBOUNDS_ERROR) Run 
`rlang::last_trace()` to see where the error occurred. I have tried 
gurgling around the internet but am striking out so throwing myself on 
the list. Apologies if this is trivial but I'd hate to have to clean 
these hundreds of lines by hand though it's starting to look as if I'd 
achieve that faster by hand than I will by banging my ignorance of R 
regexp syntax on the problem. TIA, Chris

-- 
Chris Evans (he/him)
Visiting Professor, UDLA, Quito, Ecuador & Honorary Professor, 
University of Roehampton, London, UK.
Work web site: https://www.psyctc.org/psyctc/
CORE site: http://www.coresystemtrust.org.uk/
Personal site: https://www.psyctc.org/pelerinage2016/

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Help with regex replacements

2023-06-27 Thread Chris Evans via R-help
I am sure this is easy for people who are good at regexps but I'm 
failing with it.  The situation is that I have hundreds of lines of 
Ukrainian translations of some English. They contain things like this:


1"Я досяг того, чого хотів"2"Мені вдалося зробити бажане"3"Я досяг 
(досягла) того, чого хотів (хотіла)"4"Я досяг(-ла) речей, яких хотілося 
досягти"5"Я досяг/ла того, чого хотів/ла"6"Я досяг\\досягла того, чого 
прагнув\\прагнула."7"Я досягнув(ла) того, чого хотів(ла)"


Using dput():

tmp <- structure(list(Text = c("Я досяг того, чого хотів", "Мені вдалося 
зробити бажане", "Я досяг (досягла) того, чого хотів (хотіла)", "Я 
досяг(-ла) речей, яких хотілося досягти", "Я досяг/ла того, чого 
хотів/ла", "Я досяг\\досягла того, чого прагнув\\прагнула", "Я 
досягнув(ла) того, чого хотів(ла)" )), row.names = c(NA, -7L), class = 
c("tbl_df", "tbl", "data.frame" )) Those show four different ways 
translators have handled gendered words: 1) Ignore them and (I'm 
guessing) only give the masculine 2) Give the feminine form of the word 
(or just the feminine suffix) in brackets 3) Give the feminine 
form/suffix prefixed by a forward slash 4) Give the feminine form/suffix 
prefixed by backslash (here a double backslash) I would like just to 
drop all these feminine gendered options. (Don't worry, they'll get back 
in later.) So I would like to replace 1) anything between brackets with 
nothing! 2) anything between a forward slash and the next space with 
nothing 3) anything between a backslash and the next space with nothing 
but preserving the rest of the text. I have been trying to achieve this 
using str_replace_all() but I am failing utterly. Here's a silly little 
example of my failures. This was just trying to get the text I wanted to 
replace (as I was trying to simplify the issues for my tired wetware): > 
tmp %>%+ as_tibble() %>% + rename(Text = value) %>% + mutate(Text = 
str_replace_all(Text, fixed("."), "")) %>% + filter(row_number() < 4) 
%>% + mutate(Text2 = str_replace(Text, "\\(.*\\)", "\\1")) Errorin 
`mutate()`:ℹIn argument: `Text2 = str_replace(Text, "\\(.*\\)", 
"\\1")`.Caused by error in `stri_replace_first_regex()`:!Trying to 
access the index that is out of bounds. (U_INDEX_OUTOFBOUNDS_ERROR) Run 
`rlang::last_trace()` to see where the error occurred. I have tried 
gurgling around the internet but am striking out so throwing myself on 
the list. Apologies if this is trivial but I'd hate to have to clean 
these hundreds of lines by hand though it's starting to look as if I'd 
achieve that faster by hand than I will by banging my ignorance of R 
regexp syntax on the problem. TIA, Chris


--
Chris Evans (he/him)
Visiting Professor, UDLA, Quito, Ecuador & Honorary Professor, 
University of Roehampton, London, UK.

Work web site: https://www.psyctc.org/psyctc/
CORE site: http://www.coresystemtrust.org.uk/
Personal site: https://www.psyctc.org/pelerinage2016/

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] 32bit application

2023-06-27 Thread Ivan Krylov
В Tue, 27 Jun 2023 11:03:23 +0530
Venky Vulpine  пишет:

> Is there a way to build a 32bit R setup or is there any solution for
> the people who definitely need 32bit R on windows.

While 32-bit builds of R are not supported on Windows, they might still
work (and they do work on other platforms).

Try following the guide at
 to
compile R. (I think you'll need a 64-bit Windows installation in order
to follow the guide. If you don't have one, setting up
cross-compilation from a 32-bit computer for 64-bit Windows ought to be
possible but may be tricky.)

When you run `make all recommended`, add WIN=32 to the command line:

  make all recommended WIN=32

Does it give you a 32-bit R.exe?

-- 
Best regards,
Ivan

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] 32bit application

2023-06-27 Thread Venky Vulpine
Hi Team,

It seems from 4.2.3, R setup is not having a 32bit package as like the
previous version.
Is there a way to build a 32bit R setup or is there any solution for the
people who definitely need 32bit R on windows.
Please let me know.

Thanks,
Venkatesh U

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.