Re: [R] Error when using qvalue function

2019-10-28 Thread William Dunlap via R-help
With qvalue-2.16.0 and R-3.6.1 many calls to qvalue::qvalue die in its call to qvalue::pi0est. E.g., > trace(smooth.spline, quote(cat("y=", deparse(y), "\n"))) Tracing function "smooth.spline" in package "stats" [1] "smooth.spline" > qvalue::pi0est(c(.01, .01, .06)) Tracing smooth.spline(lambda,

Re: [R] negative vector length when merging data frames

2019-10-28 Thread Ana Marija
HI Rui, thank you so much for this. I tried with the sqldf but it didn't help. Next I tried your 2nd method and I was following your steps until: > res2 <- asign[i2, setdiff(names(asign), names(l4))] > m=merge(res, res2, by.x = c("chr", "pos"), by.y = c("chr", "pos")) Error in

Re: [R] Error when using qvalue function

2019-10-28 Thread Ana Marija
Again the same thing: > require(qvalue) > qval_obj=qvalue(pvals) Error in smooth.spline(lambda, pi0, df = smooth.df) : missing or infinite values in inputs are not allowed On Mon, Oct 28, 2019 at 6:31 PM Jeff Newmiller wrote: > > ... which only loads the package after you run it once. You use

Re: [R] Error when using qvalue function

2019-10-28 Thread Jeff Newmiller
... which only loads the package after you run it once. You use `require`, which fails if the package is not loaded, at which point it installs it but never runs `require` or `library` before proceeding. YMMV but I am not a fan of using `require`... getting packages installed often requires

Re: [R] Error when using qvalue function

2019-10-28 Thread Ana Marija
I did if (!requireNamespace("BiocManager", quietly = TRUE)) install.packages("BiocManager") BiocManager::install("qvalue") and after entering that p value I am still getting: > qval_obj=qvalue(pvals) Error in smooth.spline(lambda, pi0, df = smooth.df) : missing or infinite values in

Re: [R] Error when using qvalue function

2019-10-28 Thread Ana Marija
can you please send me command you used to install it? On Mon, Oct 28, 2019 at 5:12 PM Jim Lemon wrote: > > Hi Ana, > Seems to work without error for me: > > # installed qvalue_1.26.0 from CRAN archive > library(qvalue) > pvals<-c(6.919239e-02,1.073784e-01,1.218613e-01,1.586202e-01, >

Re: [R] Vector memory exhausted (limit reached?)

2019-10-28 Thread David Winsemius
On 10/28/19 2:17 PM, varin sacha via R-help wrote: Dear R-experts, My reproducible example here below is not working because of an error message : Erreur : vecteurs de mémoire épuisés (limite atteinte ?) My code perfectly works when n=3000 or n=5000 but as soon as n=1 my code does not

Re: [R] Error when using qvalue function

2019-10-28 Thread Jim Lemon
Hi Ana, Seems to work without error for me: # installed qvalue_1.26.0 from CRAN archive library(qvalue) pvals<-c(6.919239e-02,1.073784e-01,1.218613e-01,1.586202e-01, 1.370340e-01,3.452574e-02,2.545619e-01,1.676715e-02,8.571197e-01, 8.649025e-01,1.777414e-02,6.801867e-01,6.873085e-01,

[R] Error when using qvalue function

2019-10-28 Thread Ana Marija
Hello, I am trying to calculate True Positive Rate, TPR with this procedure: pvals=q$METAge qval_obj=qvalue(pvals) #is false discovery rate pi1=1-qval_obj$pi0 #TPR pi1 #TPR But I am getting this error: Error in smooth.spline(lambda, pi0, df = smooth.df) : missing or

Re: [R] how to use a matrix as an index to another matrix?

2019-10-28 Thread Bert Gunter
No loops necessary. Use array indexing (see ?"[", of course -- the section on matrices and arrays) set.seed(123) A <- matrix(sample(1:10), nrow = 5) B <- matrix(c(sample(1:5), sample(1:5)), nrow =5, byrow = FALSE) ## The following could be a 1-liner, but I broke it out for clarity. ix <-

[R] Vector memory exhausted (limit reached?)

2019-10-28 Thread varin sacha via R-help
Dear R-experts, My reproducible example here below is not working because of an error message : Erreur : vecteurs de mémoire épuisés (limite atteinte ?) My code perfectly works when n=3000 or n=5000 but as soon as n=1 my code does not work anymore. By the way, my code takes a very long time

Re: [R] how to use a matrix as an index to another matrix?

2019-10-28 Thread Linus Chen
Hi Jinsong, In such a case I think explicit loop IS the most elegant solution. for(i in 1:2) A[,i] <- A[,i][B[,i]] Linus On Fri, 11 Oct 2019 at 11:44, Jinsong Zhao wrote: > > Hi there, > > I have two matrices, A and B. The columns of B is the index of the > corresponding columns of A. I hope

Re: [R] how to calculate multiple meta p values

2019-10-28 Thread Ana Marija
Hi Michael, I tried what you proposed with my data frame q: > head(q) IDP G E wb wg we 1: rs1029830 0.0979931 0.0054060 0.39160 580.6436 40.6325 35.39774 2: rs1029832 0.1501820 0.0028140 0.39320 580.6436 40.6325 35.39774

Re: [R-es] Duda de como contar casos por Programa.

2019-10-28 Thread Francisco Viciana
Otra alternativa de resolución solo con la paquetería estándar:    rm(list = ls() )    ## Tenemos un marco de 100 posibles participante    ## que numeramos con un ID del 1 al 100 (su DNI en el estudio)    ## Se asigna sexo aleatoriamente con una probablidad de 0.5 para cada uno    marco <-