Re: [R] Help with regular expressions.

2021-02-08 Thread Rolf Turner
On Tue, 9 Feb 2021 17:34:00 +1300 Rolf Turner wrote: > > David Wolfskill's post solved my problem perfectly. Thanks. > > Thanks also to Bert Gunter and Avi Gross. Whoops. David Wolfskill's message came to me off-list. Sorry for the confusion. cheers, Rolf -- Honorary Research Fellow De

Re: [R] Help with regular expressions.

2021-02-08 Thread Rolf Turner
David Wolfskill's post solved my problem perfectly. Thanks. Thanks also to Bert Gunter and Avi Gross. cheers, Rolf -- Honorary Research Fellow Department of Statistics University of Auckland Phone: +64-9-373-7599 ext. 88276 __ R-help@r-project.or

Re: [R] Help with regular expressions.

2021-02-08 Thread Bert Gunter
Simpler, but would fail if there are more "."s beyond the second (it changes the last one to a "-"): > sub("(.*)\\.([^.]*)", "\\1-\\2", "aa.bcv.cdg") [1] "aa.bcv-cdg" Bert Gunter "The trouble with having an open mind is that people keep coming along and sticking things into it." -- Opus (aka Be

Re: [R] Help with regular expressions.

2021-02-08 Thread Avi Gross via R-help
There are many ways, Rolf. You need to look into the syntax of regular expressions. It depends on how sure you are that the formats are exactly as needed. Escaping the period with one or more backslashes is one way. Using string functions is another. Suggestion. See if you can make a regular expre

Re: [R] Help with regular expressions.

2021-02-08 Thread Bert Gunter
> gsub("(.*\\.[^.]*)\\.(.*)","\\1-\\2", "aa.bcv.cdg") [1] "aa.bcv-cdg" Cheers, Bert Bert Gunter "The trouble with having an open mind is that people keep coming along and sticking things into it." -- Opus (aka Berkeley Breathed in his "Bloom County" comic strip ) On Mon, Feb 8, 2021 at 6:29 PM

[R] Help with regular expressions.

2021-02-08 Thread Rolf Turner
I want to deal with strings of the form "a.b.c" and to change (using sub() or whatever is appropriate) the second "." to a "-", i.e. to change "a.b.c" to "a.b-c". I want to leave the first "." as-is. I guess I could do a gsub(), changing all "."s to "-"s, and then do a sub() changing the first

Re: [R] readline in function call with space in prompt.

2021-02-08 Thread Rolf Turner
On Mon, 08 Feb 2021 14:28:33 +0100 Jeremie Juste wrote: > Hello, > > I have noticed a behavior that I don't understand. When I call the > following function from the prompt. > test <- function(){ > a <- readline("selection: ") > a > } > > > test() > > selection: | > I can only type on

Re: [R] readline in function call with space in prompt.

2021-02-08 Thread Jim Lemon
Hi Jeremie, Try this: test <- function() { a<-readline("selection: ") return(a) } If it starts working, it could be a difference in the way Windows R handles text input. Both work okay for me on fedora linux. Jim On Tue, Feb 9, 2021 at 12:29 AM Jeremie Juste wrote: > > Hello, > > I have noti

[R] Need help calculating the sum of the index function

2021-02-08 Thread Ablaye Ngalaba
Hello; q=3 #dimension of variable Y R=c(5,4,3);# Number of partition of each component of variable Y if(length(R) != q) stop("The size of R must be equal to q") n=25 # Sample size N=c(25,50,100,200,300,400,500,1000) #different sample sizes # Creation of an n11 list containing the sizes of the d

[R] Need help using lattice

2021-02-08 Thread Gerrit Draisma
David, Is this what you are looking for? library(lattice) df <- expand.grid(site=c("een","twee","drie","vier","vijf"), month=1:12) df$conc <- rnorm(dim(df)[1]) dotplot(month~conc|site,data=df) HTH Gerrit __ R-help@r-project.org mailing

Re: [R] Need help using lattice

2021-02-08 Thread John Kane
http://adv-r.had.co.nz/Reproducibility.html http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example On Mon, 8 Feb 2021 at 03:11, PIKAL Petr wrote: > Hi > > Please do not use HTML formating. > Please provide some toy data if you want to get reasonable help. > > You

Re: [R] need help to create a 3-dimensional list

2021-02-08 Thread PIKAL Petr
Hallo again Your attachment is discarded by listserv so we did not get it. Do not use attachments. Cheers Petr From: Ablaye Ngalaba Sent: Monday, February 8, 2021 3:04 PM To: PIKAL Petr Subject: Re: [R] need help to create a 3-dimensional list Sorry, I thought I would make m

[R] readline in function call with space in prompt.

2021-02-08 Thread Jeremie Juste
Hello, I have noticed a behavior that I don't understand. When I call the following function from the prompt. test <- function(){ a <- readline("selection: ") a } > test() > selection: | I can only type one character and the readline function exits before I can press enter. however test

Re: [R] need help to create a 3-dimensional list

2021-02-08 Thread PIKAL Petr
Hi No attachments allowed (usually). What do you mean by 3 dimensional list? List itself can contain objects which could also be lists. Cheers Petr > -Original Message- > From: R-help On Behalf Of Ablaye Ngalaba > Sent: Monday, February 8, 2021 1:33 PM > To: r-help@r-project.org > Subj

[R] need help to create a 3-dimensional list

2021-02-08 Thread Ablaye Ngalaba
Hello, please, I need help to calculate n_l properly for my attachment. Sincerely __ 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 h

Re: [R] Need help using lattice

2021-02-08 Thread PIKAL Petr
Hi Please do not use HTML formating. Please provide some toy data if you want to get reasonable help. You could also look at ggplot package, e.g. https://ggplot2.tidyverse.org/reference/facet_grid.html Cheers Petr > -Original Message- > From: R-help On Behalf Of Parkhurst, David > F.

Re: [R] Difficulty using the tryCatch() function

2021-02-08 Thread Greg Minshall
try removing the outermost '{'...'}'. e.g., { warning = ... } should be 'warning = ...'. Adn <- function(x,y) { out <- tryCatch( { x+y }, warning = function(cond) { message("There was a warning.") message("Here is the original warning message:")