Re: [R] Please correct my iterative merge sort code. The lack of recursion in the code is the main condition.

2019-12-16 Thread Jeff Newmiller
The Posting Guide is pretty clear about "no homework" (it is also clear that this is a plain text mailing list). I think the recent replies to the OP have been clear on how this should be approached. I don't know what the OP "intends", but isolated (not replies to the original message) emails

Re: [R] Pattern Analysis Libraries

2019-12-16 Thread Bert Gunter
Your specification seems too vague to me. What sort of "patterns" are of interest? See also ?table on your "concatenated" columns, e.g. something like: table(do.call(paste0, yourdata.frame)) or even do.call(table,yourdata.frame) for a contingency table. There are books written on the

Re: [R] variable in annotation, ggplot2

2019-12-16 Thread Troels Ring
Thanks a lot for the interesting possibilities - R is wonderful! BW Troels -Oprindelig meddelelse- Fra: Rui Barradas Sendt: 16. december 2019 19:31 Til: Troels Ring ; r-help mailing list Emne: Re: [R] variable in annotation, ggplot2 Another way: expr <- substitute(V == x, list(x =

Re: [R] Help with Identify the number (Count) of values that are less than 5 char and replace with 99999

2019-12-16 Thread Ivan Krylov
On Mon, 16 Dec 2019 13:24:36 + Bill Poling wrote: > Using the nchar function (I converted the Factor to a character > column first) I get the first 1K values. <...> > 1. Identify the number (Count) of values that are less than 5 char > (i.e. 2 char = 150, 3 char = 925, 4 char = 1002) Use

[R] Help with Identify the number (Count) of values that are less than 5 char and replace with 99999

2019-12-16 Thread Bill Poling
#RStudio Version 1.2.5019 sessionInfo() # R version 3.6.1 (2019-07-05) # Platform: x86_64-w64-mingw32/x64 (64-bit) # Running under: Windows 10 x64 (build 17134) Good morning. I have a factor that contains 1,418,303 Clinical Procedure Code (CPT). A CPT Code is 5 char. However, among my data

Re: [R] Please correct my iterative merge sort code. The lack of recursion in the code is the main condition.

2019-12-16 Thread Henrik Bengtsson
Folks on this list, this is my personal opinion, but please refrain from answering this person's requests. It's pretty clear by now that they are misusing your good intentions of trying to help people interested in R to get their homework-like "questions" answered. There are no indications that

[R] variable in annotation, ggplot2

2019-12-16 Thread Troels Ring
Hi friends - I have a simple problem of inserting values in label of a ggplot2. I have a vector V with two values and want to show them in the plot. Here is what I tried - at most get the first entry "28". R version 3.6.1 (2019-07-05) Windows 10 BW Troels library(ggplot2) x <- 1:5 y

[R] Please correct my iterative merge sort code. The lack of recursion in the code is the main condition.

2019-12-16 Thread Александр Дубровский
mrg <- function(A,B){ R <- c() while(length(A)>0 length(B)>0){ if(A[1](x%/%2)){ W <- c(W,mrg(R[(j+1):(j+(x%/%2))],R[(j+(x%/%2)+1):length(R)])) } if((length(R)%%x)<=(x%/%2) && (length(R)%%x)!=0){ W <- c(W,R[(j+1):length(R)]) } x <- x*2 R <- W W <- c()

Re: [R] Help with Identify the number (Count) of values that are less than 5 char and replace with 99999

2019-12-16 Thread Rui Barradas
Hello, To count the number of variables with less than 5 characters, use nchar and table or aggregate. Since nchar needs a character vector and you have a factor, first convert with as.character. edt1a$ProcedureCode <- as.character(edt1a$ProcedureCode) 1. Now any of the next 3

[R] How does one pass arguments to a function, such as coxph, that itself is inside a function?

2019-12-16 Thread Sorkin, John
Question summary: How does one pass arguments to a function, such as coxph, that itself is inside a function. I am trying to write a function that will allow me to call coxph using different outcome and time variables. The coxph works when the coxph is NOT contained in a larger function (which

Re: [R] variable in annotation, ggplot2

2019-12-16 Thread Rui Barradas
Hello, If you form the label with paste before the plot, it can display both values. Something like lab <- paste("V = ", paste(V, collapse = ",")) ggplot(df,aes(x=x,y=y)) + geom_line() + annotate("text", x = 3, y = 20, label = lab) Hope this helps, Rui Barradas Às 14:55 de 16/12/19,

Re: [R] variable in annotation, ggplot2

2019-12-16 Thread Rui Barradas
Another way: expr <- substitute(V == x, list(x = as.list(V))) ggplot(df, aes(x, y)) + geom_line() + annotate("text", x = 3, y = 20, label = deparse(expr), parse = TRUE) Or this one (nothing to do with your use case, it's an example of plotmath): v <- paste("atop(", paste0("'V

Re: [R] How does one pass arguments to a function, such as coxph, that itself is inside a function?

2019-12-16 Thread Rui Barradas
Hello, You can assemble the formula with deparse/substitute and paste. This is the example 2 from ?coxph. I have changed list(...) to data.frame(...) doit <- function(s1, s2, data){ s1 <- deparse(substitute(s1)) s2 <- deparse(substitute(s2)) fmla <- paste("Surv(", s1, ",", s2, ",

Re: [R] How does one pass arguments to a function, such as coxph, that itself is inside a function?

2019-12-16 Thread William Dunlap via R-help
You can use substitute() to fiddle with the formula. The following shows how to do it using lm() instead of coxph(), but the manipulations are the same. It also has an 'envir' argument in case the formula depends on anything in the callers enviroment. The 'substitute(data)' is make the

[R] Pattern Analysis Libraries

2019-12-16 Thread Jeff Reichman
R-Help I have a need to find aggregated patterns within a data.frame of some 80 million records and wanted to know if there are any packages which could be used to find patterns by row. For example Col 1 Col 2 Col3 A 1 aa A 2 bb A 1 aa In this example