Re: [R] Grouped boxplots using ggplot() from ggplot2.
On 29/07/18 02:54, Jeff Newmiller wrote: 1) I don't know... it looks to me like you did not run my code. Aaaarrrgghhh. I *thought* I had, but instead left "fill=Type" inside the aes() call and neglected to add fill=NULL outside this call. Du!!! It's tough being mentally challenged, let me assure you. I have included a complete reprex below... try it out in a fresh session. If you still get the problem, check your sessionInfo package versions against mine. Yep. Works like a charm. 2) This still smells like your fill parameter is inside the aes function with Type as value. This causes a legend to be created, and since that legend has a different name ("Type") than the colour scale, they are separated. Confirm that you are using fill outside the aes function (because you don't want fill to depend on the data) and have the constant NULL as value (so it won't generate any fill graphical representation). Yeah. Well. Duhhh. I'm a retread. 3) I missed that... the ylim()/scales_y_continuous(breaks=) limits constrain which data are included as input into the graph. The coord_cartesian function forces the limits as desired. Bewdy, ta. 4) While showing outliers is a standard semantic feature of boxplots whether produced by ggplot or lattice or base or non-R solution, Indeed. But the client is always right! :-) you can please the client by making the outliers transparent. And your code shows me how! Which I need. Bewdy, ta. There is a link to the generated image below. # Simulate some data: Type <- rep( c( "National", "Local" ), each = 250 ) M0 <- 1300+50*(0:4) set.seed( 42 ) M1 <- M0 + runif( 5, -100, -50 ) X0 <- rnorm( 250, rep( M0, each = 50 ), 150 ) X1 <- rnorm( 250, rep( M1, each = 50 ), 100 ) library(ggplot2) Year <- factor( rep( 4:8, each = 50, times = 2) , levels = 0:8 ) DemoDat <- data.frame( Year = Year , Score = c( X0, X1 ) , Type = Type ) ggplot( data = DemoDat , aes( x = Year , y = Score , color = Type ) , fill = NULL ) + geom_boxplot( position = position_dodge( 1 ) , outlier.alpha = 0 ) + theme_minimal() + scale_colour_manual( name = "National v. Local" , values = c( "red", "black" ) ) + scale_x_discrete( drop = FALSE ) + scale_y_continuous( breaks=seq( 700, 2100, 100 ) ) + coord_cartesian( ylim = c( 700, 2100 ) ) # ![](https://i.imgur.com/wUVYU5H.png) Looks perfect. Thanks *HUGELY* for your patience with my stupidity. cheers, Rolf -- Technical Editor ANZJS Department of Statistics University of Auckland Phone: +64-9-373-7599 ext. 88276 __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] subsetting ls() as per class...
dear peter, Its workingthanks a lot... yours sincerely, AKSHAY M KULKARNI From: Peter Langfelder Sent: Saturday, July 28, 2018 11:41 AM To: akshay...@hotmail.com Cc: r-help Subject: Re: [R] subsetting ls() as per class... Looking at ?rm, my solution would be something like rm(list = grep("\\.NS$", ls(), value = TRUE)) But test it since I have not tested it. Peter On Fri, Jul 27, 2018 at 10:58 PM akshay kulkarni wrote: > > dear memebers, >I am using R in AWS linux instance for my > research. I want to remove certain objects from the global environment to > reduce my EBS cost..for example, I want to remove all objects of class "xts", > "zoo". Is there any way to automate this, instead of removing the objects one > by one? > > Basically, I want to subset ls() according to class, and then remove that > subset by using rm function. > > I got to know about mget in SO, but that is not working in my case > > Also, all the above objects end with ".NS". I came to know that you can > remove objects starting with a certain pattern; is there any way to remove > objects ending in a certain pattern? > > very many thanks for your time and effort... > yours sincerely, > AKSHAY M KULKARNI > > [[alternative HTML version deleted]] > > __ > R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. [[alternative HTML version deleted]] __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] a suggestion about the display of structural variants in R
Thank you Jeff. Yes, certainly, I posted a message on BioC too, although I have not received any suggestions by now. On Sat, Jul 28, 2018 at 8:05 AM, Jeff Newmiller wrote: > My suggestion is to pay attention to Boris and ask people who do this kind > of plotting frequently... and they are typically found on the Bioconductor > mailing list, not this list. > > On Sat, 28 Jul 2018, Bogdan Tanasa wrote: > > Dear Boris, >> >> good morning, and thank you for your message. After thinking a bit more >> yesterday, I believe that I could adapt the functionality of some R >> packages that display the synteny regions across multiple species (here >> please see an example Figure 1 from http://www.g3journal.org/ >> content/7/6/1775.figures-only), >> >> although I have not found yet a R package that does this display (in my >> case, instead of distinct species, I will just show distinct chromosomes >> connected by translocations). If you have any suggestions, please let me >> know. >> >> thanks a lot, >> >> -- bogdan >> >> >> On Sat, Jul 28, 2018 at 6:42 AM, Boris Steipe >> wrote: >> >> Maybe the Bioconductor package "intansv" can help you. You asked for >>> linear chromosomes, but such data is commonly plotted in Circos plots as >>> e.g. with the Bioconductor OmicsCircos package (cf. >>> https://bioconductor.org/packages/devel/bioc/vignettes/ >>> OmicCircos/inst/doc/OmicCircos_vignette.pdf) >>> >>> However the Bioconductor Project has its own support mailing list, R-Help >>> is for programming help. >>> >>> >>> B. >>> >>> >>> >>> On 2018-07-28, at 02:24, Bogdan Tanasa wrote: Dear all, we wish you a fruitful and refreshing weekend ! Thought that I may also write to ask you for a suggestion, specifically if you could please >>> advise >>> on whether there is any package already built (in R) that could help with the following data visualization : we have a set of mutations from many cancer samples we would like to display the POINT MUTATIONS along the chromosome coordinates (on the linear scale, ie. HORIZONTALLY) we would like to display the TRANSLOCATIONS (and GENE FUSIONS), as VERTICAL LINES connecting the breakpoints that are located on the chromosomes that are represented HORIZONTALLY Thanks a lot, -- bogdan [[alternative HTML version deleted]] __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/ >>> posting-guide.html >>> and provide commented, minimal, self-contained, reproducible code. >>> >>> >>> >> [[alternative HTML version deleted]] >> >> __ >> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see >> https://stat.ethz.ch/mailman/listinfo/r-help >> PLEASE do read the posting guide http://www.R-project.org/posti >> ng-guide.html >> and provide commented, minimal, self-contained, reproducible code. >> >> > > --- > Jeff NewmillerThe . . Go Live... > DCN:Basics: ##.#. ##.#. Live > Go... > Live: OO#.. Dead: OO#.. Playing > Research Engineer (Solar/BatteriesO.O#. #.O#. with > /Software/Embedded Controllers) .OO#. .OO#. rocks...1k > > --- > [[alternative HTML version deleted]] __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] subsetting ls() as per class...
> objClasses <- unlist(eapply(.GlobalEnv, function(x)class(x)[1])) > head(objClasses) f E "function" "environment" df h "tbl_df""function" myData L "list""list" > names(objClasses)[objClasses=="tbl_df"] [1] "df" "out" Bill Dunlap TIBCO Software wdunlap tibco.com On Fri, Jul 27, 2018 at 10:58 PM, akshay kulkarni wrote: > dear memebers, >I am using R in AWS linux instance for my > research. I want to remove certain objects from the global environment to > reduce my EBS cost..for example, I want to remove all objects of class > "xts", "zoo". Is there any way to automate this, instead of removing the > objects one by one? > > Basically, I want to subset ls() according to class, and then remove that > subset by using rm function. > > I got to know about mget in SO, but that is not working in my case > > Also, all the above objects end with ".NS". I came to know that you can > remove objects starting with a certain pattern; is there any way to remove > objects ending in a certain pattern? > > very many thanks for your time and effort... > yours sincerely, > AKSHAY M KULKARNI > > [[alternative HTML version deleted]] > > __ > R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/ > posting-guide.html > and provide commented, minimal, self-contained, reproducible code. > [[alternative HTML version deleted]] __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] a suggestion about the display of structural variants in R
My suggestion is to pay attention to Boris and ask people who do this kind of plotting frequently... and they are typically found on the Bioconductor mailing list, not this list. On Sat, 28 Jul 2018, Bogdan Tanasa wrote: Dear Boris, good morning, and thank you for your message. After thinking a bit more yesterday, I believe that I could adapt the functionality of some R packages that display the synteny regions across multiple species (here please see an example Figure 1 from http://www.g3journal.org/ content/7/6/1775.figures-only), although I have not found yet a R package that does this display (in my case, instead of distinct species, I will just show distinct chromosomes connected by translocations). If you have any suggestions, please let me know. thanks a lot, -- bogdan On Sat, Jul 28, 2018 at 6:42 AM, Boris Steipe wrote: Maybe the Bioconductor package "intansv" can help you. You asked for linear chromosomes, but such data is commonly plotted in Circos plots as e.g. with the Bioconductor OmicsCircos package (cf. https://bioconductor.org/packages/devel/bioc/vignettes/ OmicCircos/inst/doc/OmicCircos_vignette.pdf) However the Bioconductor Project has its own support mailing list, R-Help is for programming help. B. On 2018-07-28, at 02:24, Bogdan Tanasa wrote: Dear all, we wish you a fruitful and refreshing weekend ! Thought that I may also write to ask you for a suggestion, specifically if you could please advise on whether there is any package already built (in R) that could help with the following data visualization : we have a set of mutations from many cancer samples we would like to display the POINT MUTATIONS along the chromosome coordinates (on the linear scale, ie. HORIZONTALLY) we would like to display the TRANSLOCATIONS (and GENE FUSIONS), as VERTICAL LINES connecting the breakpoints that are located on the chromosomes that are represented HORIZONTALLY Thanks a lot, -- bogdan [[alternative HTML version deleted]] __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/ posting-guide.html and provide commented, minimal, self-contained, reproducible code. [[alternative HTML version deleted]] __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. --- Jeff NewmillerThe . . Go Live... DCN:Basics: ##.#. ##.#. Live Go... Live: OO#.. Dead: OO#.. Playing Research Engineer (Solar/BatteriesO.O#. #.O#. with /Software/Embedded Controllers) .OO#. .OO#. rocks...1k __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] a suggestion about the display of structural variants in R
Dear Boris, good morning, and thank you for your message. After thinking a bit more yesterday, I believe that I could adapt the functionality of some R packages that display the synteny regions across multiple species (here please see an example Figure 1 from http://www.g3journal.org/ content/7/6/1775.figures-only), although I have not found yet a R package that does this display (in my case, instead of distinct species, I will just show distinct chromosomes connected by translocations). If you have any suggestions, please let me know. thanks a lot, -- bogdan On Sat, Jul 28, 2018 at 6:42 AM, Boris Steipe wrote: > Maybe the Bioconductor package "intansv" can help you. You asked for > linear chromosomes, but such data is commonly plotted in Circos plots as > e.g. with the Bioconductor OmicsCircos package (cf. > https://bioconductor.org/packages/devel/bioc/vignettes/ > OmicCircos/inst/doc/OmicCircos_vignette.pdf) > > However the Bioconductor Project has its own support mailing list, R-Help > is for programming help. > > > B. > > > > > On 2018-07-28, at 02:24, Bogdan Tanasa wrote: > > > > Dear all, > > > > we wish you a fruitful and refreshing weekend ! Thought that I may also > > write to ask you for a suggestion, specifically if you could please > advise > > on whether there is any package already built (in R) that could help with > > the following data visualization : > > > > > >we have a set of mutations from many cancer samples > > > >we would like to display the POINT MUTATIONS along the chromosome > > coordinates (on the linear scale, ie. HORIZONTALLY) > > > >we would like to display the TRANSLOCATIONS (and GENE FUSIONS), as > > VERTICAL LINES connecting the breakpoints that are located on the > > chromosomes that are represented HORIZONTALLY > > > > Thanks a lot, > > > > -- bogdan > > > > [[alternative HTML version deleted]] > > > > __ > > R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see > > https://stat.ethz.ch/mailman/listinfo/r-help > > PLEASE do read the posting guide http://www.R-project.org/ > posting-guide.html > > and provide commented, minimal, self-contained, reproducible code. > > [[alternative HTML version deleted]] __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Grouped boxplots using ggplot() from ggplot2.
1) I don't know... it looks to me like you did not run my code. I have included a complete reprex below... try it out in a fresh session. If you still get the problem, check your sessionInfo package versions against mine. 2) This still smells like your fill parameter is inside the aes function with Type as value. This causes a legend to be created, and since that legend has a different name ("Type") than the colour scale, they are separated. Confirm that you are using fill outside the aes function (because you don't want fill to depend on the data) and have the constant NULL as value (so it won't generate any fill graphical representation). 3) I missed that... the ylim()/scales_y_continuous(breaks=) limits constrain which data are included as input into the graph. The coord_cartesian function forces the limits as desired. 4) While showing outliers is a standard semantic feature of boxplots whether produced by ggplot or lattice or base or non-R solution, you can please the client by making the outliers transparent. There is a link to the generated image below. # Simulate some data: Type <- rep( c( "National", "Local" ), each = 250 ) M0 <- 1300+50*(0:4) set.seed( 42 ) M1 <- M0 + runif( 5, -100, -50 ) X0 <- rnorm( 250, rep( M0, each = 50 ), 150 ) X1 <- rnorm( 250, rep( M1, each = 50 ), 100 ) library(ggplot2) Year <- factor( rep( 4:8, each = 50, times = 2) , levels = 0:8 ) DemoDat <- data.frame( Year = Year , Score = c( X0, X1 ) , Type = Type ) ggplot( data = DemoDat , aes( x = Year , y = Score , color = Type ) , fill = NULL ) + geom_boxplot( position = position_dodge( 1 ) , outlier.alpha = 0 ) + theme_minimal() + scale_colour_manual( name = "National v. Local" , values = c( "red", "black" ) ) + scale_x_discrete( drop = FALSE ) + scale_y_continuous( breaks=seq( 700, 2100, 100 ) ) + coord_cartesian( ylim = c( 700, 2100 ) ) # ![](https://i.imgur.com/wUVYU5H.png) #' Created on 2018-07-28 by the [reprex package](http://reprex.tidyverse.org) (v0.2.0). sessionInfo() R version 3.4.4 (2018-03-15) Platform: x86_64-pc-linux-gnu (64-bit) Running under: Ubuntu 16.04.5 LTS Matrix products: default BLAS: /usr/lib/libblas/libblas.so.3.6.0 LAPACK: /usr/lib/lapack/liblapack.so.3.6.0 locale: [1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C LC_TIME=en_US.UTF-8LC_COLLATE=en_US.UTF-8 [5] LC_MONETARY=en_US.UTF-8LC_MESSAGES=en_US.UTF-8 LC_PAPER=en_US.UTF-8 LC_NAME=C [9] LC_ADDRESS=C LC_TELEPHONE=C LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C attached base packages: [1] stats graphics grDevices utils datasets methods base other attached packages: [1] ggplot2_3.0.0 loaded via a namespace (and not attached): [1] Rcpp_0.12.17 pillar_1.2.3 compiler_3.4.4 plyr_1.8.4 bindr_0.1.1 tools_3.4.4 [7] digest_0.6.15memoise_1.1.0evaluate_0.10.1 tibble_1.4.2 gtable_0.2.0 debugme_1.1.0 [13] pkgconfig_2.0.1 rlang_0.2.1 reprex_0.2.0 rstudioapi_0.7 yaml_2.1.19 bindrcpp_0.2.2 [19] stringr_1.3.1withr_2.1.2 dplyr_0.7.6 knitr_1.20 devtools_1.13.6 rprojroot_1.3-2 [25] grid_3.4.4 tidyselect_0.2.4 glue_1.2.0 R6_2.2.2 processx_3.1.0 rmarkdown_1.10 [31] clipr_0.4.1 purrr_0.2.5 callr_2.0.4 magrittr_1.5 whisker_0.3-2scales_0.5.0 [37] backports_1.1.2 htmltools_0.3.6 assertthat_0.2.0 colorspace_1.3-2 stringi_1.2.3lazyeval_0.2.1 [43] munsell_0.5.0crayon_1.3.4 On Sat, 28 Jul 2018, Rolf Turner wrote: On 28/07/18 17:03, Jeff Newmiller wrote: When you understand the strong dependence on how the data controls ggplot, using it gets much easier. I still have to google details sometimes though. Note that it can be very difficult to make a weird plot (e.g. multiple parallel axes) in ggplot because it is very internally consistent... a blessing and a curse. 1) Colour is assigned in the scale according to order of levels of the factor. Note that while they are both discrete, the so-called "discrete" scales auto-colour, but "manual" scales require you to specify the exact colour sequence. 2) Assigning constants to properties is done outside the mapping (aes). Note that "colour" is for lines and shapes outlines, while "fill" is colour meant to fill in shapes. When the names of these two scales are the same and the values are the same, the legends will merge. If not, they will be shown separately. 3) Discrete scales are controlled by the levels in the data. To prevent ggplot from removing missing levels, use the drop=FALSE argument. 4) Breaks are a property of the scale. My changes were: Year <- factor( rep( 4:8, each = 50, times = 2 ), levels = 0:8 ) DemoDat <- data.frame(Year = Year, Score = c( X0 , X1 ), Type =
Re: [R] Saving objects in RData file in different name
Christofer Bogaso writes: Hello In case you have conflicting data issue when you load data, you can also do it the other way around. Indeed you never know when a possible conflict might occur in the future. The following line load the data in a new environment e first then get it back to your current environment. loaded..data <- get(load("test.RData",e<- new.env()),e) you might then want to remove everything in that enviromnent afterwards, rm(list=ls(envir=e1), envir=e1) HTH Jeremie __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] a suggestion about the display of structural variants in R
Maybe the Bioconductor package "intansv" can help you. You asked for linear chromosomes, but such data is commonly plotted in Circos plots as e.g. with the Bioconductor OmicsCircos package (cf. https://bioconductor.org/packages/devel/bioc/vignettes/OmicCircos/inst/doc/OmicCircos_vignette.pdf) However the Bioconductor Project has its own support mailing list, R-Help is for programming help. B. > On 2018-07-28, at 02:24, Bogdan Tanasa wrote: > > Dear all, > > we wish you a fruitful and refreshing weekend ! Thought that I may also > write to ask you for a suggestion, specifically if you could please advise > on whether there is any package already built (in R) that could help with > the following data visualization : > > >we have a set of mutations from many cancer samples > >we would like to display the POINT MUTATIONS along the chromosome > coordinates (on the linear scale, ie. HORIZONTALLY) > >we would like to display the TRANSLOCATIONS (and GENE FUSIONS), as > VERTICAL LINES connecting the breakpoints that are located on the > chromosomes that are represented HORIZONTALLY > > Thanks a lot, > > -- bogdan > > [[alternative HTML version deleted]] > > __ > R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Saving objects in RData file in different name
Hi! Maybe not the most elegant solution, but a workaround is to have a function: > save2<-function(y, ...) { save(y,...)} > save2(x1,x2,file="test.RData") The point is to include the variables to be "renamed" as parameters (in my example: y). The function will use the parameter variable names when saving the file. HTH, Kimmo 2018-07-28, 17:04 +0530, Christofer Bogaso wrote: > Hi, > > Let say I have 2 objects as below > > x1 = 1:3 > x2 = 5:4 > > Now I want to save both x1 and x2 in some RData file, however x1 will > be > saved with a different name e.g. y > > I tried below > > save(y = x1, x2, file = "file.RData") > > However still they are saved in their original names i.e. x1 and x2, > not y > and y2. > > Is there any possibility that I can achieve above without explicitly > copying y = x1 before y is passed to save() > > Thanks for any feedback. > > [[alternative HTML version deleted]] > > __ > R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-gui > de.html > and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Saving objects in RData file in different name
Hi, Let say I have 2 objects as below x1 = 1:3 x2 = 5:4 Now I want to save both x1 and x2 in some RData file, however x1 will be saved with a different name e.g. y I tried below save(y = x1, x2, file = "file.RData") However still they are saved in their original names i.e. x1 and x2, not y and y2. Is there any possibility that I can achieve above without explicitly copying y = x1 before y is passed to save() Thanks for any feedback. [[alternative HTML version deleted]] __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] subsetting ls() as per class...
The ll() function of R.oo returns a data.frame with various attributes that you can subset on, e.g. > subset(R.oo::ll(), data.class %in% c("zoo", "xts")) member data.class dimension objectSize 2 fzzoo10 1344 4 sample.xtsxts c(180,4) 10128 5 xzoo 5528 6 x1zoo 5880 7 x2zoo 5496 9 yzoo 5 1040 11 zzooc(5,3) 1184 12 z0zoo 0448 13 z2zooc(4,3)904 14z20zooc(4,0)616 15 z3zoo 8528 16 z4zoo 5592 17 z5zoo 5792 Henrik On Sat, Jul 28, 2018, 08:22 Jeff Newmiller wrote: > You can extract the names into a character vector with ls and then use > grep(..., values=TRUE ) to select which ones you want to remove, and then > pass that list to rm. > > However, due to the way R handles memory you are unlikely to see much > savings by doing this. I would recommend focusing on creating a script or > series of scripts that can allow you to re-create your analysis, and then > restarting R whenever you are ready to reduce memory usage. This will have > the side benefit of leaving you with a verified-complete record of how your > analysis was done. > > On July 27, 2018 10:58:36 PM PDT, akshay kulkarni > wrote: > >dear memebers, > >I am using R in AWS linux instance for my research. I want to remove > >certain objects from the global environment to reduce my EBS cost..for > >example, I want to remove all objects of class "xts", "zoo". Is there > >any way to automate this, instead of removing the objects one by one? > > > >Basically, I want to subset ls() according to class, and then remove > >that subset by using rm function. > > > >I got to know about mget in SO, but that is not working in my case > > > >Also, all the above objects end with ".NS". I came to know that you > >can remove objects starting with a certain pattern; is there any way to > >remove objects ending in a certain pattern? > > > >very many thanks for your time and effort... > >yours sincerely, > >AKSHAY M KULKARNI > > > > [[alternative HTML version deleted]] > > > >__ > >R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see > >https://stat.ethz.ch/mailman/listinfo/r-help > >PLEASE do read the posting guide > >http://www.R-project.org/posting-guide.html > >and provide commented, minimal, self-contained, reproducible code. > > -- > Sent from my phone. Please excuse my brevity. > > __ > R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide > http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. > [[alternative HTML version deleted]] __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Grouped boxplots using ggplot() from ggplot2.
On 28/07/18 17:03, Jeff Newmiller wrote: When you understand the strong dependence on how the data controls ggplot, using it gets much easier. I still have to google details sometimes though. Note that it can be very difficult to make a weird plot (e.g. multiple parallel axes) in ggplot because it is very internally consistent... a blessing and a curse. 1) Colour is assigned in the scale according to order of levels of the factor. Note that while they are both discrete, the so-called "discrete" scales auto-colour, but "manual" scales require you to specify the exact colour sequence. 2) Assigning constants to properties is done outside the mapping (aes). Note that "colour" is for lines and shapes outlines, while "fill" is colour meant to fill in shapes. When the names of these two scales are the same and the values are the same, the legends will merge. If not, they will be shown separately. 3) Discrete scales are controlled by the levels in the data. To prevent ggplot from removing missing levels, use the drop=FALSE argument. 4) Breaks are a property of the scale. My changes were: Year <- factor( rep( 4:8, each = 50, times = 2 ), levels = 0:8 ) DemoDat <- data.frame(Year = Year, Score = c( X0 , X1 ), Type = Type ) ggplot( data = DemoDat , aes( x = Year, y = Score, color = Type ) , fill = NULL ) + geom_boxplot( position = position_dodge(1) ) + theme_minimal() + scale_colour_manual( name = "National v. Local" , values = c( "red", "black" ) ) + scale_x_discrete( drop = FALSE ) + scale_y_continuous( breaks = seq( 700, 2100, 100 ) ) Good luck with your graphics grammar! Dear Jeff, Thanks very much for this cogent advice and for taking the trouble to steer me in the right direction. However I am not quite out of the woods yet. (1) I'm still getting two legends. How do I stop this from happening? (2) The boxes are "filled" (with pinkish and blueish colours --- which are referenced in the second of the two legends that I get). How can I get "unfilled" boxes? (3) The y-axis scale runs only from 800 to 1800, rather than from 700 to 2100. How can I force it to run from 700 to 2100? (4) With the modified code we now get some "outliers" (points beyond the whisker tips) plotted --- which I didn't get before (and don't want, because "last year's" graphics did not include outliers). How can I suppress the plotting of outliers? I have attached a pdf containing the results of running the code that you provided, so that you can readily see what is happening. May I prevail upon your good graces to enlighten me about questions (1) --- (4) above? Ever so humbly grateful. cheers, Rolf -- Technical Editor ANZJS Department of Statistics University of Auckland Phone: +64-9-373-7599 ext. 88276 demoPlot.pdf Description: Adobe PDF document __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] a suggestion about the display of structural variants in R
Dear all, we wish you a fruitful and refreshing weekend ! Thought that I may also write to ask you for a suggestion, specifically if you could please advise on whether there is any package already built (in R) that could help with the following data visualization : we have a set of mutations from many cancer samples we would like to display the POINT MUTATIONS along the chromosome coordinates (on the linear scale, ie. HORIZONTALLY) we would like to display the TRANSLOCATIONS (and GENE FUSIONS), as VERTICAL LINES connecting the breakpoints that are located on the chromosomes that are represented HORIZONTALLY Thanks a lot, -- bogdan [[alternative HTML version deleted]] __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] subsetting ls() as per class...
You can extract the names into a character vector with ls and then use grep(..., values=TRUE ) to select which ones you want to remove, and then pass that list to rm. However, due to the way R handles memory you are unlikely to see much savings by doing this. I would recommend focusing on creating a script or series of scripts that can allow you to re-create your analysis, and then restarting R whenever you are ready to reduce memory usage. This will have the side benefit of leaving you with a verified-complete record of how your analysis was done. On July 27, 2018 10:58:36 PM PDT, akshay kulkarni wrote: >dear memebers, >I am using R in AWS linux instance for my research. I want to remove >certain objects from the global environment to reduce my EBS cost..for >example, I want to remove all objects of class "xts", "zoo". Is there >any way to automate this, instead of removing the objects one by one? > >Basically, I want to subset ls() according to class, and then remove >that subset by using rm function. > >I got to know about mget in SO, but that is not working in my case > >Also, all the above objects end with ".NS". I came to know that you >can remove objects starting with a certain pattern; is there any way to >remove objects ending in a certain pattern? > >very many thanks for your time and effort... >yours sincerely, >AKSHAY M KULKARNI > > [[alternative HTML version deleted]] > >__ >R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see >https://stat.ethz.ch/mailman/listinfo/r-help >PLEASE do read the posting guide >http://www.R-project.org/posting-guide.html >and provide commented, minimal, self-contained, reproducible code. -- Sent from my phone. Please excuse my brevity. __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] subsetting ls() as per class...
Looking at ?rm, my solution would be something like rm(list = grep("\\.NS$", ls(), value = TRUE)) But test it since I have not tested it. Peter On Fri, Jul 27, 2018 at 10:58 PM akshay kulkarni wrote: > > dear memebers, >I am using R in AWS linux instance for my > research. I want to remove certain objects from the global environment to > reduce my EBS cost..for example, I want to remove all objects of class "xts", > "zoo". Is there any way to automate this, instead of removing the objects one > by one? > > Basically, I want to subset ls() according to class, and then remove that > subset by using rm function. > > I got to know about mget in SO, but that is not working in my case > > Also, all the above objects end with ".NS". I came to know that you can > remove objects starting with a certain pattern; is there any way to remove > objects ending in a certain pattern? > > very many thanks for your time and effort... > yours sincerely, > AKSHAY M KULKARNI > > [[alternative HTML version deleted]] > > __ > R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.