Re: [R] adding results to plot

2021-09-16 Thread PIKAL Petr
Thanks Jim This seems to be strightforward and quite simple. I considered addtable2plot but was not sure how to make propper data frame from the result. Regards Petr > -Original Message- > From: Jim Lemon > Sent: Friday, September 17, 2021 2:31 AM > To: PIKAL Petr ; r-help mailing list

Re: [R] Evaluating lazily 'f<-' ?

2021-09-16 Thread Andrew Simmons
In your case, yes, there is a negative impact to formatting the code like: x <- `padding<-`(right(x), ...) and it comes from using 'substitute' without specifying an environment / / list. It's my biggest problem with the tidyverse packages, the use of non-standard evaluation. 'substitute' was ori

Re: [R] Problem with plotmat package

2021-09-16 Thread H
On 09/16/2021 09:26 PM, H wrote: > On 09/16/2021 09:00 PM, Jim Lemon wrote: >> Okay, that was just my reading of the help page. I hope that I haven't >> added to the confusion. >> >> Jim >> >> On Fri, Sep 17, 2021 at 10:50 AM H wrote: >>> On 09/15/2021 09:40 PM, Jim Lemon wrote: Oops, your pl

Re: [R] Problem with plotmat package

2021-09-16 Thread H
On 09/16/2021 09:00 PM, Jim Lemon wrote: > Okay, that was just my reading of the help page. I hope that I haven't > added to the confusion. > > Jim > > On Fri, Sep 17, 2021 at 10:50 AM H wrote: >> On 09/15/2021 09:40 PM, Jim Lemon wrote: >>> Oops, your plot >>> >>> On Thu, Sep 16, 2021 at 11:39 AM

Re: [R] Problem with plotmat package

2021-09-16 Thread Jim Lemon
Okay, that was just my reading of the help page. I hope that I haven't added to the confusion. Jim On Fri, Sep 17, 2021 at 10:50 AM H wrote: > > On 09/15/2021 09:40 PM, Jim Lemon wrote: > > Oops, your plot > > > > On Thu, Sep 16, 2021 at 11:39 AM Jim Lemon wrote: > >> Hi H, > >> Looking at your

Re: [R] Problem with plotmat package

2021-09-16 Thread H
On 09/15/2021 09:40 PM, Jim Lemon wrote: > Oops, your plot > > On Thu, Sep 16, 2021 at 11:39 AM Jim Lemon wrote: >> Hi H, >> Looking at your example and the help page, it looks to me as though >> the plot is consistent with the "A" matrix: >> >> Oz >> Rain Nice >> Rain 0.25 0.75 >> Nice 0.60

Re: [R] adding results to plot

2021-09-16 Thread Jim Lemon
Hi Petr, The hard part is the names for the data frame that addtable2plot requires: set.seed(753) res <- shapiro.test(rnorm(100)) library(plotrix) plot(0,0,type="n",axes=FALSE) addtable2plot(0,0,data.frame(element=names(res)[1:2], value=round(as.numeric(res[1:2]),3)),xjust=0.5, title=res$metho

[R] boxplots and dotplots by color group 1 and shape group2

2021-09-16 Thread Yuan Chun Ding via R-help
Dear R users, I generated a boxplots in combination of dotplots using the R code below for the attached test file. boxplot(value~score, data = test, outpch = NA, xlab="",ylab="",xaxt='n', cex.lab=1.2, cex.axis=1.2, main="Correlation of SCNV score and SCNV value ") mtext(side=2, "SCNV val

Re: [R] order stacked bar plot from total frequency

2021-09-16 Thread Jim Lemon
Hi Kai, I don't know about ggplot, but it may be easier to do it before plotting: set.seed(753) testdat<-matrix(sample(1:10,9),nrow=3) # first plot the raw matrix barplot(testdat) # then plot the matrix ordered by column sums barplot(testdat[,order(colSums(testdat))]) Jim On Fri, Sep 17, 2021 at

[R] order stacked bar plot from total frequency

2021-09-16 Thread Kai Yang via R-help
Hello List, I can order the general bar chart based on frequency, using ggplot2 with the code : aes((reorder(Var1, Freq)), Freq))  I don't know how to order stacked bar plot by total frequency Can you give me some of example? Thank you Kai [[alternative HTML version deleted]] ___

Re: [R] unable to remove NAs from a data frame

2021-09-16 Thread Ana Marija
Completely true. Thank you for your help On Thu, Sep 16, 2021 at 12:37 PM Rui Barradas wrote: > Hello, > > You are trying to access elements that do not exist, see the example below: > > > x <- 1:3 > x[5] # beyond the last element > #[1] NA > > dim(df) > #[1] 145092258 > > df[145092

Re: [R] unable to remove NAs from a data frame

2021-09-16 Thread Rui Barradas
Hello, You are trying to access elements that do not exist, see the example below: x <- 1:3 x[5] # beyond the last element #[1] NA dim(df) #[1] 145092258 df[14509227,] # beyond nrow(df) by 2 Hope this helps, Rui Barradas Às 15:12 de 16/09/21, Ana Marija escreveu: Hi All, I

Re: [R] Good practice for database with utf-8 string in package

2021-09-16 Thread Jeff Newmiller
Agree with Bert per your stated problem, but want to point out that you don't have control over the locale in which your users will be trying to display the encoded strings in your data. I am no expert in this, but you will need to become one in order to understand your own problem and any solut

Re: [R] Good practice for database with utf-8 string in package

2021-09-16 Thread Bert Gunter
This should not be posted here. Post on the R-package-devel list instead. 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 Thu, Sep 16, 2021 at 9:13 AM Marc Giron

[R] Good practice for database with utf-8 string in package

2021-09-16 Thread Marc Girondot via R-help
Hello everyone, I am a little bit stucked on the problem to include a database with utf-8 string in a package. When I submit it to CRAN, it reports NOTES for several Unix system and I try to find a solution (if it exists) to not have these NOTES. The database has references and some names have

Re: [R] [EXT] Re: adding results to plot

2021-09-16 Thread David K Stevens
This is pretty kludgy but ... res.p <- capture.output(res)   # creates a list of what goes to the screen res.pl <- '' "   # initialize res.pl res.nul <- sapply(res.p,function(x.c) res.pl <<- paste(res.pl,res.c,sep='\n'))  # adds the list items separated by a line feed text(x, y, res.pl, pos=4,

Re: [R] [EXT] Re: adding results to plot

2021-09-16 Thread David K Stevens
This is pretty kludgy but ... res.p <-capture.output(x.t) res.pl <- '' res.nul <- sapply(res.p,function(x.c) res.pl <<- paste(res.pl,res.c,sep='\n')) text(x,y,rel.pl,pos=4,cex=mycex) This will replicate the print object for the t.test that goes to the screen so you can add it to a plot. One n

Re: [R] adding results to plot

2021-09-16 Thread PIKAL Petr
Thanks, I will try to elaborate on it. Best regards. Petr > -Original Message- > From: R-help On Behalf Of Kimmo Elo > Sent: Thursday, September 16, 2021 4:45 PM > To: r-help@r-project.org > Subject: Re: [R] adding results to plot > > Hi! > > Maybe with this: > > text(x=0.6, y=1.2, p

Re: [R] adding results to plot

2021-09-16 Thread PIKAL Petr
Hallo Thanks, I will try wat option is better if yours or Kimmo's Best regards Petr > -Original Message- > From: Bert Gunter > Sent: Thursday, September 16, 2021 5:00 PM > To: PIKAL Petr > Cc: r-help > Subject: Re: [R] adding results to plot > > I was wrong. text() will attempt to co

Re: [R] adding results to plot

2021-09-16 Thread Bert Gunter
I was wrong. text() will attempt to coerce to character. This may be informative: > as.character(res) [1] "c(W = 0.992709285275917)""0.869917232073854" [3] "Shapiro-Wilk normality test" "rnorm(100)" plot(0:1, 0:1); text(0,seq(.1,.9,.2), labels = res, pos = 4) Bert Bert Gunter "The trouble

Re: [R] ODP: ggplot question

2021-09-16 Thread Kai Yang via R-help
Hi Grzegorz, this is great! it works for me. Thank you, Kai On Wednesday, September 15, 2021, 11:09:20 PM PDT, Grzegorz Smoliński wrote: Hi, of course you can. This should work: ggplot(s8_plot, aes(fill=GTresult, y=cases, x=gc_label)) + geom_bar(position="stack", stat="identity")) + t

Re: [R] adding results to plot

2021-09-16 Thread Kimmo Elo
Hi! Maybe with this: text(x=0.6, y=1.2, paste0(capture.output(res), collapse="\n"), adj=0) HTH, Kimmo to, 2021-09-16 kello 14:12 +, PIKAL Petr kirjoitti: > Virhe vahvistaessa allekirjoitusta: Virhe tulkittaessa > Dear all > > I know I have seen the answer somewhere but I am not able

Re: [R] adding results to plot

2021-09-16 Thread Bert Gunter
res is a list of class "htest" . You can only add text strings to a plot via text(). I don't know what ggplot does. 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 )

Re: [R] unable to remove NAs from a data frame

2021-09-16 Thread Eric Berger
You are getting this because you asked for the contents of a row that is beyond the number of rows in your data frame. On Thu, Sep 16, 2021 at 5:12 PM Ana Marija wrote: > > Hi All, > > I have lines in file that look like this: > > > df[14509227,] > SNP A1 A2 freq b se p N > 1: NA

Re: [R] unable to remove NAs from a data frame

2021-09-16 Thread PIKAL Petr
Hi You should consult either complete.cases function or to remove only rows in which are only NAs you could use something like (untested) df[!(colSums(is.na(df))==8),] Cheers Petr > -Original Message- > From: R-help On Behalf Of Ana Marija > Sent: Thursday, September 16, 2021 4:12 PM

[R] adding results to plot

2021-09-16 Thread PIKAL Petr
Dear all I know I have seen the answer somewhere but I am not able to find it. Please help > plot(1,1) > res <- shapiro.test(rnorm(100)) > res Shapiro-Wilk normality test data: rnorm(100) W = 0.98861, p-value = 0.5544 I would like to add whole res object to the plot. I can do it one

[R] unable to remove NAs from a data frame

2021-09-16 Thread Ana Marija
Hi All, I have lines in file that look like this: > df[14509227,] SNP A1 A2 freq b se p N 1: NA NA NA NA NA data looks like this: > head(df) SNP A1 A2 freq b se p N 1: rs74337086 G A 0.0024460 0.1627 0.1231 0.1865 218792 2: rs76388980 G