[R] Calling procedures

2021-01-24 Thread Steven Yen
Dear All Below are calls to functions to calculate bivariate and univariate logistic probabilities.It works for the following sample program (with results p1=p2 and p3=p4), but similar calls in a more elaborated program produced unpredicted results. My question is whether I am doing

Re: [R] How to find when a value is reached given a function?

2021-01-24 Thread Duncan Murdoch
On 24/01/2021 2:57 p.m., Luigi Marongiu wrote: Hello I am trying to simulate a PCR by running a logistic equation. So I set the function: ``` PCR <- function(initCopy, dupRate, Carry) { ROI_T = initCopy A = array() for (i in 1:45) { ROI_TplusOne <- ROI_T * dupRate * (1 -

[R] How to find when a value is reached given a function?

2021-01-24 Thread Luigi Marongiu
Hello I am trying to simulate a PCR by running a logistic equation. So I set the function: ``` PCR <- function(initCopy, dupRate, Carry) { ROI_T = initCopy A = array() for (i in 1:45) { ROI_TplusOne <- ROI_T * dupRate * (1 - ROI_T/Carry) A[i] <- ROI_TplusOne ROI_T <- ROI_TplusOne

Re: [R] Plot dataframe with color based on a column value

2021-01-24 Thread Luigi Marongiu
I did not know about matplot, but it did the work. using lines is my default procedure but it can be time-consuming. Thank you all. On Sun, Jan 24, 2021 at 6:45 PM Rui Barradas wrote: > > Hello, > > Base R: > > colrs <- rainbow(length(unique(ROI$Z))) > roi_wide <- reshape(ROI, v.names = "Y",

Re: [R] Plot dataframe with color based on a column value

2021-01-24 Thread Rui Barradas
Hello, Base R: colrs <- rainbow(length(unique(ROI$Z))) roi_wide <- reshape(ROI, v.names = "Y", timevar = "Z", idvar = "X", direction = "wide") matplot(roi_wide, type = "l", lwd = 3, lty = "solid", col = colrs) Hope this helps, Rui Barradas Às 14:48 de 24/01/21, Luigi Marongiu escreveu:

Re: [R] Plot dataframe with color based on a column value

2021-01-24 Thread Bert Gunter
No. I was wrong. ?plot.default says only one line color (the first) will be used. So it appears that you need to use lines(). 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"

Re: [R] Plot dataframe with color based on a column value

2021-01-24 Thread Bert Gunter
1. lines() *is* base R. 2. See the col argument of ?plot.default. 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 Sun, Jan 24, 2021 at 6:48 AM Luigi Marongiu

[R] Plot dataframe with color based on a column value

2021-01-24 Thread Luigi Marongiu
Hello is it possible to color the data of a dataframe according to the values of one column? I have a dataframe that OI have subdivided into X and Y, with a third Z with the sample number. I would like to plot Y~X but coloring using Z. But I would like to use base R and not lines. Is that