Re: [R] how to compare two distributions and calculate p value?

2019-10-22 Thread Ana Marija
ok, I would have paired = FALSE option. What other options you would recommend? On Tue, Oct 22, 2019 at 8:34 PM Bert Gunter wrote: > > "How would I do say t test considering these two have different number > of entries?" > > Read and follow ?t.test . > > Bert Gunter > > "The trouble with having

Re: [R] how to compare two distributions and calculate p value?

2019-10-22 Thread Bert Gunter
"How would I do say t test considering these two have different number of entries?" Read and follow ?t.test . 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

[R] how to compare two distributions and calculate p value?

2019-10-22 Thread Ana Marija
Hello, I would like to calculate a p value from two distributions, one looks like this: > head(b) gene_id number_of_eqtles_per_gene 1: ENSG0237683.5 5 2: ENSG0225972.1 267 3: ENSG0225630.197 4:

Re: [R] If Loop I Think

2019-10-22 Thread Jim Lemon
Notice that I used the argument stringsAsFactors=FALSE to do this when reading in. What I did was to change Rn columns to 1 if there were any characters in the corresponding Runnerxxx column and 0 otherwise. The "nchar" function returns the number of characters in a string. If I apply ">0" to it,

Re: [R] If Loop I Think

2019-10-22 Thread David Winsemius
On 10/22/19 1:54 PM, Phillip Heinrich wrote: Row Outs RunnerFirst RunnerSecond RunnerThird R1 R2 R3 1 0 2 1 3 1 4 1 arenn001 5 2 arenn001 6 0 7 0 perad001 8 0 polla001 perad001 9 0 goldp001 polla001 perad001 10 0

Re: [R] If Loop I Think

2019-10-22 Thread Jim Lemon
Hi Philip, Try this: phdf<-read.table( text="Row Outs RunnerFirst RunnerSecond RunnerThird R1 R2 R3 1 0 2 1 3 1 4 1 arenn001 5 2 arenn001 6 0 7 0 perad001 8 0 polla001 perad001 9 0 goldp001 polla001 perad001 10 0 lambj001 goldp001 11 1 lambj001 goldp001 12 2 lambj001 13 0 14 1 ",

Re: [R] Conditions in R (Help Post)

2019-10-22 Thread Jim Lemon
Hi Yeasmin, I suspect that you didn't intend to have conditions like: a<0 && b>0 && b 0 && abs(b) < abs(a) If this is the case, the following function seems to return the values of phase that you want: assign_phase<-function(x,y) { phase<-c(1,2,7,8,3,4,6,5) phase_index<-4 * (x > 0) + 2 * (y >

[R] If Loop I Think

2019-10-22 Thread Phillip Heinrich
Row Outs RunnerFirst RunnerSecond RunnerThird R1 R2 R3 1 0 2 1 3 1 4 1 arenn001 5 2 arenn001 6 0 7 0 perad001 8 0 polla001 perad001 9 0 goldp001 polla001 perad001 10 0

Re: [R] prop.test CI depends on null hypothesis?

2019-10-22 Thread Aaron Rendahl
I believe this is correct behavior for computing the p-value, though the wording is awkward in that it implies that R is not implementing the continuity correction in this situation, when in fact, this behavior is part of how the continuity correction is defined. The correction simply treats the

Re: [R] Change colour ggiNEXT plot package iNEXT

2019-10-22 Thread Luigi Marongiu
I thought it was a major package for ecological analysis. Anyway, thank you for the tips. I'll dip from there. On Tue, Oct 22, 2019 at 5:29 PM Jeff Newmiller wrote: > > Probably, assuming that function returns a ggplot object. You will need to > identify the levels of the factor used for

Re: [R] Conditions in R (Help Post)

2019-10-22 Thread Bert Gunter
Both your syntax and semantics are wrong. This indicates to me that you should spend more time with some basic R tutorials before proceeding. That said, here are some of the errors: 1) You are not using sapply correctly. Moreover, no R level iteration is needed anyway (sapply() iterates over

Re: [R] Conditions in R (Help Post)

2019-10-22 Thread jim holtman
Here is another way of doing it by computing the index based on the conditions > input <- read_delim(" YEAR DAY X Y Sig + 1981 9 -0.213 1.08 1.10 + 198110 0.065 1.05 1.05", delim = ' ', trim_ws = TRUE) > > input <- mutate(input, + phase = case_when(X < 0 & Y < 0 &

Re: [R] Conditions in R (Help Post)

2019-10-22 Thread jim holtman
Had the condition for phase=2 incorrect: library(tidyverse) input <- read_delim(" YEAR DAY X Y Sig 1981 9 -0.213 1.08 1.10 198110 0.065 1.05 1.05", delim = ' ', trim_ws = TRUE) input <- mutate(input, phase = case_when(X < 0 & Y < 0 & Y < X ~ 'phase=1',

Re: [R] Conditions in R (Help Post)

2019-10-22 Thread jim holtman
Here is one way of doing it; I think the output you show is wrong: library(tidyverse) input <- read_delim(" YEAR DAY X Y Sig 1981 9 -0.213 1.08 1.10 198110 0.065 1.05 1.05", delim = ' ', trim_ws = TRUE) input <- mutate(input, phase = case_when(X < 0 & Y < 0 & Y <

[R] Conditions in R (Help Post)

2019-10-22 Thread Yeasmin Alea
Hello Team I would like to add a new column (for example-Phase) from the below data set based on the conditions YEAR DAY X Y Sig 1 1981 9 -0.213 1.08 1.10 2 198110 0.065 1.05 1.05 *Conditions* D$Phase=sapply(D,function(a,b) { a <-D$X b<-D$Y if (a<0

Re: [R] MLE packages

2019-10-22 Thread Mohan Ganesalingam
Hi Bert, thanks for the quick reply. I spent a while searching before I posted, and also read through the documentation for the mle fn and the maxLik and bbmle packages. As you say, it seems likely I'm reinventing something standard, but nothing I can find quite seems to do what I need. Hence

Re: [R] Simulations study not working entirely...

2019-10-22 Thread varin sacha via R-help
Dear David, Dear Jiefei, Many thanks for your comments. I got it now. It works. Best, Sacha Le lundi 21 octobre 2019 à 22:00:39 UTC+2, David Winsemius a écrit : On 10/21/19 9:40 AM, varin sacha via R-help wrote: > Dear R-Experts, > > Here below my reproducible example working but

Re: [R] Change colour ggiNEXT plot package iNEXT

2019-10-22 Thread Jeff Newmiller
Probably, assuming that function returns a ggplot object. You will need to identify the levels of the factor used for distinguishing groups, and add a scale_colour_manual() to the ggplot object with colors specified in the same order as those levels. Support for obscure packages is technically

[R] Change colour ggiNEXT plot package iNEXT

2019-10-22 Thread Luigi Marongiu
Dear all, is it possible to provide custom color to the rarefaction curve of the package iNEXT (ggiNEXT)? If I have these data: ``` library(iNEXT) library(ggplot2) data(spider) out <- iNEXT(spider, q=0, datatype="abundance") ggiNEXT(out, type=1) ``` can i colour the lines with, let's say, yellow

[R] [R-pkgs] NMOF 2.0-1 (Numerical Methods and Optimization in Finance)

2019-10-22 Thread Enrico Schumann
Dear all, version 2.0-1 of package NMOF is on CRAN now. NMOF stands for 'Numerical Methods and Optimization in Finance', and it accompanies the book with the same name, written by Manfred Gilli, Dietmar Maringer and Enrico Schumann.[1] The new version of the package provides all R code and