Re: [R] Adjusting axis limits in ggplot2.

2020-06-19 Thread Jeff Newmiller
?scale_x_discrete, in particular the expand argument. On June 19, 2020 7:07:32 PM PDT, Rolf Turner wrote: > >I'm having trouble adjusting axis limits in ggplot2 when the variable >corresponding to that axis is a factor. I have attached a minimal >reproducible example in the file demo.txt. >

[R] Adjusting axis limits in ggplot2.

2020-06-19 Thread Rolf Turner
I'm having trouble adjusting axis limits in ggplot2 when the variable corresponding to that axis is a factor. I have attached a minimal reproducible example in the file demo.txt. The result (see it by sourcing demo.txt and printing ldCiPlot) is fine except that I would like the y-axis limits

Re: [R] How to loop over two files ...

2020-06-19 Thread Bert Gunter
All of your torrent of requests for help to have others do your work for you are about genomics issues. Why aren't you posting on the Bioconductor Help forum instead, where both the expertise and tools for such matters exist? I would characterize your posts here as being largely inappropriate for

Re: [R] How to loop over two files ...

2020-06-19 Thread Ana Marija
unfortunately it complains again: > f1 <- read_tsv("1g", col_names=F) Parsed with column specification: cols( X1 = col_character() ) > f2 <- read_tsv("1n", col_names=F) Parsed with column specification: cols( X1 = col_character() ) > for ( a in rownames(f1) ) { + +for ( b in rownames(f2)

Re: [R] How to loop over two files ...

2020-06-19 Thread Ana Marija
Hi Rasmus, I got those SNPs from two GWAS-es which I run with different phenotypes and I would like to compare weather the top SNPs in both of them are in LD. So 1n.txt and 1g.txt are just top SNPs from those two GWAS-es. Unfortunately https://ldlink.nci.nih.gov/?tab=ldpair works for only two

Re: [R] Strange behavior when sampling rows of a data frame

2020-06-19 Thread Sébastien Lahaie
Thank you all for the responses, these are the insights I was hoping for. There are many ways to get this right, and I happened to run into one that has a glitch. I see from Luke's explanation how the strange output came about. Glad to hear that this bug/behavior is already known. On Fri, Jun 19,

Re: [R] How to loop over two files ...

2020-06-19 Thread Rasmus Liland
On 2020-06-19 14:34 -0500, Ana Marija wrote: > > I have two files (each has 300 lines)like this: The example looks quite similar to the R example in https://rest.ensembl.org/documentation/info/ld_pairwise_get#ra ... The question becomes: how did you query the 600 variant names in 1g.txt and

Re: [R] Load svg, eps or png into graphics device?

2020-06-19 Thread Abby Spurdle
If I understand your question correctly, you're already able to read an EPS file. So, essentially, you have an answer to your question. Paul Murrell published an article on using raster graphics, in 2011. https://journal.r-project.org/archive/2011-1/RJournal_2011-1_Murrell.pdf I would assume

Re: [R] Strange behavior when sampling rows of a data frame

2020-06-19 Thread Daniel Nordlund
On 6/19/2020 5:49 AM, Sébastien Lahaie wrote: I ran into some strange behavior in R when trying to assign a treatment to rows in a data frame. I'm wondering whether any R experts can explain what's going on. First, let's assign a treatment to 3 out of 10 rows as follows. df <- data.frame(unit

Re: [R] How to loop over two files ...

2020-06-19 Thread cpolwart
Sorry - its been a long week! there is a foreach package but I try to avoid extras make your for statements: for ( a in rownames(f1) ) { # a will now be a row number rather than the value, so replace ' a ' in the paste0 with: f1[ a, 1] so ext <- paste0( "/ld/human/pairwise/",

Re: [R] How to loop over two files ...

2020-06-19 Thread Rasmus Liland
Dear other list readers, On 2020-06-19 23:31 +0200, Rasmus Liland wrote: > I have attached my rds here. only Ana recieved this because of a Mailman attachment policy, which also is why my signature was bad ... Best, Rasmus signature.asc Description: PGP signature

Re: [R] How to loop over two files ...

2020-06-19 Thread Ana Marija
I tried it: > library(httr) > library(jsonlite) > library(xml2) > library(readr) > server <- "http://rest.ensembl.org; > f1 <- read_tsv("1g", col_names=F) Parsed with column specification: cols( X1 = col_character() ) > f2 <- read_tsv("1n", col_names=F) Parsed with column specification: cols(

Re: [R] How to loop over two files ...

2020-06-19 Thread cpolwart
Oh - read.text isn't in base! Not sure where is came from (my head mostly!) You may have something that adds it but better to use something that works. So try using: library(readr) f1 <- read_tsv("1g.txt", col.names=F) This will give you a tibble with f1$X1 with the file in it then loop

Re: [R] How to loop over two files ...

2020-06-19 Thread Rasmus Liland
On 2020-06-19 16:07 -0500, Ana Marija wrote: > HI Rasmus, > > I tried it: > > library(base) > > > r <- readRDS(paste0(population.name, ".rds")) > Error in gzfile(file, "rb") : cannot open the connection > In addition: Warning message: > In gzfile(file, "rb") : > cannot open compressed file

Re: [R] How to loop over two files ...

2020-06-19 Thread Ana Marija
HI Rasmus, I tried it: library(base) files <- c("1g.txt", "1n.txt") files <- lapply(files, readLines) server <- "http://rest.ensembl.org; population.name <- "1000GENOMES:phase_3:KHV" ext <- apply(expand.grid(files), 1, function(x) {

Re: [R] How to loop over two files ...

2020-06-19 Thread Ana Marija
Hi, thanks for getting back to me, it is just for my job :) so I tried it: library(httr) library(jsonlite) library(xml2) library(SparkR, lib.loc = c(file.path(Sys.getenv("SPARK_HOME"), "R", "lib"))) sparkR.session(master = "local[*]", sparkConfig = list(spark.driver.memory = "2g")) server <-

Re: [R] How to loop over two files ...

2020-06-19 Thread Rasmus Liland
On 2020-06-19 14:34 -0500, Ana Marija wrote: > > server <- "http://rest.ensembl.org; > ext <- > "/ld/human/pairwise/rs6792369/rs1042779?population_name=1000GENOMES:phase_3:KHV" > > r <- GET(paste(server, ext, sep = ""), content_type("application/json")) > > stop_for_status(r) >

Re: [R] How to loop over two files ...

2020-06-19 Thread cpolwart
so (untested) if you did something like f1 <- read.text("1g.txt") f2 <- read.text("1n.txt") for ( a in as.list(f1) ) { for ( b in as.list(f2) ) { ext <- paste0( "/ld/human/pairwise/", a, "/", b,

[R] How to loop over two files ...

2020-06-19 Thread Ana Marija
Hello, I have two files (each has 300 lines)like this: head 1g.txt rs6792369 rs1414517 rs16857712 rs16857703 rs12239392 ... head 1n.txt rs1042779 rs2360630 rs10753597 rs7549096 rs2343491 ... For each pair of rs# from those two files I can run this command in R library(httr) library(jsonlite)

Re: [R] [External] Re: Strange behavior when sampling rows of a data frame

2020-06-19 Thread luke-tierney
The behavior has been there much longer than that in R and it's been a known issue with complex assignment for a long time (not the only one). You're in a better position than I to know how Splus handles this. The complex assignment expression df[, ]$treated <- TRUE is basically evaluated

Re: [R] R Software Risk Analysis

2020-06-19 Thread Marc Schwartz via R-help
Hi All, We need to get clarification from Kristin as to what kinds of issues are raised in the context of a risk analysis from her IT people. Since Kristin's wording indicated: "...all programs that our employees/providers use must be vetted through the IT Department by way of a Risk

Re: [R] Strange behavior when sampling rows of a data frame

2020-06-19 Thread William Dunlap via R-help
It is a bug that has been present in R since at least R-2.14.0 (the oldest that I have installed on my laptop). Bill Dunlap TIBCO Software wdunlap tibco.com On Fri, Jun 19, 2020 at 10:37 AM Rui Barradas wrote: > Hello, > > > Thanks, I hadn't thought of that. > > But, why? Is it evaluated once

Re: [R] Strange behavior when sampling rows of a data frame

2020-06-19 Thread Rui Barradas
Hello, Thanks, I hadn't thought of that. But, why? Is it evaluated once before assignment and a second time when the assignment occurs? To trace both sample and `[<-` gives 2 calls to sample. trace(sample) trace(`[<-`) df[sample(nrow(df), 3),]$treated <- TRUE trace: sample(nrow(df), 3)

Re: [R] Error plotting the results form a Holt Winters model with no seasonality

2020-06-19 Thread Eric Berger
Hi Jeff, I tried to reproduce your problem with the package's example and I did not get an error. Here's the output from my sessionInfo(). R version 3.6.3 (2020-02-29) Platform: x86_64-pc-linux-gnu (64-bit) Running under: Ubuntu 18.04.3 LTS Matrix products: default BLAS:

Re: [R] Error plotting the results form a Holt Winters model with no seasonality

2020-06-19 Thread Bert Gunter
OS? R version? package versions? 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 Fri, Jun 19, 2020 at 10:02 AM Jeff Reichman wrote: > r-help > > > > I'm

[R] Error plotting the results form a Holt Winters model with no seasonality

2020-06-19 Thread Jeff Reichman
r-help I'm trying to use the TSstudio library to plot a forecast created from a Holt Winters model and I get the following error: Error in `[<-`(`*tmp*`, n + 1, , value = data.frame(x = tmp[["x"]][n], : subscript out of bounds So looking through the package documentation I tried

Re: [R] R Software Risk Analysis

2020-06-19 Thread John Harrold
I think the question of validation is very different from the risk analysis referenced in the subject line. On the subject of the FDA accepting open source software. Personally I've done two sBLA submissions where simulation results were essential aspects of the filings. Both were approved and

Re: [R] Strange behavior when sampling rows of a data frame

2020-06-19 Thread William Dunlap via R-help
The first subscript argument is getting evaluated twice. > trace(sample) > set.seed(2020); df[i<-sample(10,3), ]$Treated <- TRUE trace: sample(10, 3) trace: sample(10, 3) > i [1] 1 10 4 > set.seed(2020); sample(10,3) trace: sample(10, 3) [1] 7 6 8 > sample(10,3) trace: sample(10, 3) [1] 1 10 4

Re: [R] Strange behavior when sampling rows of a data frame

2020-06-19 Thread Rui Barradas
Hello, I don't have an answer on the reason why this happens but it seems like a bug. Where? In which of  `[<-.data.frame` or `[<-.default`? A solution is to subset and assign the vector: set.seed(2020) df2 <- data.frame(unit = 1:10) df2$treated <- FALSE df2$treated[sample(nrow(df2), 3)]

Re: [R] smoothScatter() and the KernSmooth package

2020-06-19 Thread Martin Maechler
> Duncan Murdoch > on Fri, 19 Jun 2020 10:14:19 -0400 writes: > On 19/06/2020 9:59 a.m., Jeffrey Dick wrote: >> Hi Witold, >> >> See also this thread on R-pkg-devel. Quoting Duncan Murdoch, "That >> looks like a bug in grDevices." > Yes, and the bug is still

Re: [R] R Software Risk Analysis

2020-06-19 Thread Helmut Schütz
Dear all, any (!) software used in regulated environments has to be validated. Regrettably is is a misconception by many working in the pharmaceutical industry that only studies evaluated by SAS are accepted by the FDA. See this one-pager https://www.fda.gov/media/109552/download and a

[R] Strange behavior when sampling rows of a data frame

2020-06-19 Thread Sébastien Lahaie
I ran into some strange behavior in R when trying to assign a treatment to rows in a data frame. I'm wondering whether any R experts can explain what's going on. First, let's assign a treatment to 3 out of 10 rows as follows. > df <- data.frame(unit = 1:10) > df$treated <- FALSE > > s <-

[R] Load svg, eps or png into graphics device?

2020-06-19 Thread Rainer M Krug
Hi I have a package, which plots from the plantuml syntax (https://plantuml.com) graphs via a knitr engine, into a file, or into a graphics device (https://github.com/rkrug/plantuml). I am using at the moment grImport for the eps import, but would like to cut down on dependencies. Is there

Re: [R] smoothScatter() and the KernSmooth package

2020-06-19 Thread Duncan Murdoch
On 19/06/2020 9:59 a.m., Jeffrey Dick wrote: Hi Witold, See also this thread on R-pkg-devel. Quoting Duncan Murdoch, "That looks like a bug in grDevices." Yes, and the bug is still there: grDevices:::.smoothScatterCalcDensity calls KernSmooth::bkde2D without checking whether KernSmooth is

Re: [R] smoothScatter() and the KernSmooth package

2020-06-19 Thread Jeffrey Dick
Hi Witold, See also this thread on R-pkg-devel. Quoting Duncan Murdoch, "That looks like a bug in grDevices." https://stat.ethz.ch/pipermail/r-package-devel/2019q3/004287.html Cheers, Jeff On Wed, Jun 17, 2020 at 4:59 PM Witold E Wolski wrote: > > Hello, > > I am getting the following error

Re: [R] Error: cannot remove prior installation of package ‘BiocManager’

2020-06-19 Thread Ankush Sharma
Thanks, Duncan and Uwe, I was using Rstudio. This solved the problem Best Regards *Ankush Sharma* On Fri, Jun 19, 2020 at 2:25 PM Duncan Murdoch wrote: > On 19/06/2020 8:06 a.m., Ankush Sharma wrote: > > The packages were installed after the update! > > That's not relevant. The issue is

Re: [R] Error: cannot remove prior installation of package ‘BiocManager’

2020-06-19 Thread Duncan Murdoch
On 19/06/2020 8:06 a.m., Ankush Sharma wrote: The packages were installed after the update! That's not relevant. The issue is that the packages were loaded at the time you tried to update them. You may have to start R with the --vanilla option to avoid automatically loading packages if

Re: [R] Error: cannot remove prior installation of package ‘BiocManager’

2020-06-19 Thread Ankush Sharma
The packages were installed after the update! Best Regards *Ankush Sharma* On Fri, Jun 19, 2020 at 1:56 PM Uwe Ligges wrote: > The packages must not be loaded when you try to update. > > Best, > Uwe Ligges > > > > On 19.06.2020 12:07, Ankush Sharma wrote: > > Dear all, > > > > I am working R

Re: [R] Error: cannot remove prior installation of package ‘BiocManager’

2020-06-19 Thread Uwe Ligges
The packages must not be loaded when you try to update. Best, Uwe Ligges On 19.06.2020 12:07, Ankush Sharma wrote: Dear all, I am working R version 4.0.1 macos catalina , I´m not able to load libraries e.g ggplot2 Error: Error: package or namespace load failed for ‘ggplot2’ in

[R] Error: cannot remove prior installation of package ‘BiocManager’

2020-06-19 Thread Ankush Sharma
Dear all, I am working R version 4.0.1 macos catalina , I´m not able to load libraries e.g ggplot2 Error: Error: package or namespace load failed for ‘ggplot2’ in loadNamespace(i, c(lib.loc, .libPaths()), versionCheck = vI[[i]]): there is no package called ‘gtable’ Then i tried installing