Re: [R] How to add error bars to a line plot with ggplot2?

2023-07-14 Thread Luigi Marongiu
Thank you, the problem was indeed about factors. Case solved On Fri, Jul 14, 2023 at 7:05 PM Rui Barradas wrote: > > Às 17:33 de 14/07/2023, Luigi Marongiu escreveu: > > Hello, > > I am measuring a certain variable at given time intervals and > > different concentrations of a reagent. I would

Re: [R] How to add error bars to a line plot with ggplot2?

2023-07-14 Thread Rui Barradas
Às 17:33 de 14/07/2023, Luigi Marongiu escreveu: Hello, I am measuring a certain variable at given time intervals and different concentrations of a reagent. I would like to make a scatter plot of the values, joined by a line to highlight the temporal measure. I can plot this all right. Now,

Re: [R] How to add error bars to a line plot with ggplot2?

2023-07-14 Thread Ivan Krylov
В Fri, 14 Jul 2023 18:33:38 +0200 Luigi Marongiu пишет: > COLS = c("green", "red", "blue", "yellow") > geom_errorbar(aes(x=Time, ymin=ddC-SD, ymax=ddC+SD, colour=mM, > group=mM), width=.1, colour=COLS) + The last `colour` argument in the call above is a character vector of length 4. You

[R] How to add error bars to a line plot with ggplot2?

2023-07-14 Thread Luigi Marongiu
Hello, I am measuring a certain variable at given time intervals and different concentrations of a reagent. I would like to make a scatter plot of the values, joined by a line to highlight the temporal measure. I can plot this all right. Now, since I have more than one replicate, I would like to

Re: [R] how to add count to pie chart legend

2022-08-16 Thread John Fox
Dear Jim and Ana, Why not skip the legend and put the counts in the labels? with(df, pie(n, paste0(V1, " (", n, ")"), col=c(3, 2), main="Yes and No", radius=1)) Best, John On 2022-08-15 9:43 p.m., Jim Lemon wrote: Hi Ana, A lot of work for a little pie. df<-read.table(text="V1 n Yes

Re: [R] how to add count to pie chart legend

2022-08-15 Thread Rolf Turner
On Mon, 15 Aug 2022 19:20:28 -0700 Bert Gunter wrote: > Fortune Nomination! > > "A lot of work for a little pie." (in response to a query about how to > improve a pie chart) > -- Jim Lemon I second the nomination. cheers, Rolf > > On Mon, Aug 15, 2022 at 6:43 PM Jim Lemon > wrote: > > >

Re: [R] how to add comma to string vector?

2022-06-10 Thread Rasmus Liland
Hello ... raws <- c("field_1", "field_2", "field_3") paste0("['", paste0(raws, collapse="', '"), "']") rasmus@eightforty ~ % python Python 3.10.5 (main, Jun 6 2022, 18:49:26) [GCC 12.1.0] on linux Type "help", "copyright", "credits" or "license" for more information. >>> ['field_1',

[R] how to add comma to string vector?

2022-06-10 Thread Luigi Marongiu
Hello, I need to convert an R vector to a python array. Essentially, I got a vector of strings where each element must be enclosed in single quotes. The problem is that each closing single quote should contain a comma. What is the regex trick to do that? I tried with: ``` > (raws = c("field_1",

Re: [R] How to add error bars to lattice xyplot

2021-10-12 Thread Luigi Marongiu
Thank you, but on the example in use, it draws at each x a triplet of y from the same class linked by a segment. It is essentially a strip plot rather than a scatter plot... On Mon, Oct 11, 2021 at 10:28 PM Bert Gunter wrote: > > Your panel function needs to plot the points! See at

Re: [R] How to add error bars to lattice xyplot

2021-10-11 Thread Bert Gunter
Your panel function needs to plot the points! See at below xyplot(Value ~ Concentration, group = Substance, data = df, pch = 16, cex = 1.2, type = "b", xlab=expression(bold(paste("Concentration (", mu, "M)"))), ylab=expression(bold("Infection rate")),

Re: [R] How to add error bars to lattice xyplot

2021-10-11 Thread Luigi Marongiu
Thanks, now I got the bars (although without notch) but I lost the main plot: ``` xyplot(Value ~ Concentration, group = Substance, data = df, pch = 16, cex = 1.2, type = "b", xlab=expression(bold(paste("Concentration (", mu, "M)"))), ylab=expression(bold("Infection rate")), col=COLS, scales =

Re: [R] How to add error bars to lattice xyplot

2021-10-11 Thread Deepayan Sarkar
On Mon, Oct 11, 2021 at 5:41 PM Luigi Marongiu wrote: > > Hello, > I am trying to plot data using lattice. The basic plot works: > ``` > Substance = rep(c("A", "B", "C", "D"),4) > Concentration = rep(1:4,4), > Value = c(62.8067, 116.2633, 92.2600, 9.8733, 14.8233, >

[R] How to add error bars to lattice xyplot

2021-10-11 Thread Luigi Marongiu
Hello, I am trying to plot data using lattice. The basic plot works: ``` Substance = rep(c("A", "B", "C", "D"),4) Concentration = rep(1:4,4), Value = c(62.8067, 116.2633, 92.2600, 9.8733, 14.8233, 92.3733, 98.9567, 1.4833, 0.6467, 50.6600,

Re: [R] how to add a calculated column into a data frame

2020-06-05 Thread Ravi Jeyaraman
ect.org] On Behalf Of Charles Thuo Sent: Friday, June 05, 2020 12:18 AM To: r-help@r-project.org Subject: [R] how to add a calculated column into a data frame Dear Sirs, I have a data frame that has a column that shows the transaction date. How do i add another column that extracts the year o

Re: [R] how to add a calculated column into a data frame

2020-06-04 Thread Jeff Newmiller
This should get you started: x <- "2009-03-21" substr( x, 1, 4 ) y <- as.integer( substr( x, 1, 4 ) ) y or yy <- as.POSIXlt( x )$year + 1900 yy RShowDoc( "R-intro" ) On June 4, 2020 9:18:00 PM PDT, Charles Thuo wrote: >Dear Sirs, > >I have a data frame that has a column that shows the

[R] how to add a calculated column into a data frame

2020-06-04 Thread Charles Thuo
Dear Sirs, I have a data frame that has a column that shows the transaction date. How do i add another column that extracts the year of transaction from the transaction date. Charles [[alternative HTML version deleted]] __

[R] how to add annotate horizontal line between bars and decrease size and space between bars?

2020-01-20 Thread Ana Marija
Hello, I have a code like this: p <- ggplot(data = df, aes(x = Name, y = prop, fill = Name)) + geom_bar(stat = "identity") + labs(x = "", y = "EQTL / gene") + scale_fill_brewer(palette="Greens",name = "Number of cis EQTL") + theme(legend.position = "none") p which produces the attached

Re: [R] how to add annotate horizontal line between bars and decrease size and space between bars?

2020-01-20 Thread Ana Marija
I tried doing this but it didn't help p <- ggplot(data = df, aes(x = Name, y = prop, fill = Name)) + geom_bar(stat = "identity") + labs(x = "", y = "EQTL / gene") + scale_fill_brewer(palette="Greens",name = "Number of cis EQTL") + theme_classic()+ theme(panel.grid.major.x =

Re: [R] how to add p values to bar plot?

2019-09-28 Thread Jim Lemon
Hi Ana, You seem to have a p-value at the top of the second plot. Do you just want that p-value in a different place? My first guess would be the "annotate" argument. Say you wanted your p-value in the middle of the plot. # your ggplot line p+annotate("text",x=1.5,y=0.05,label="p = 1.6x10-16") p

Re: [R] how to add p values to bar plot?

2019-09-27 Thread Vivek Das
Well that means already a ratio. Could you show me how the data frame looks like? If they are array of values then you compare the distribution of your ratios like Ratio1 array from “ (#of EQTLs)/(#of genes)” vs Ratio 2 arrays of the “same for the other, RG condition”. ratio1 = c(ratio1Value1,

Re: [R] how to add p values to bar plot?

2019-09-27 Thread Ana Marija
Awesome, thanks! Yes those two numbers on y axis I calculated as (#of EQTLs)/(#of genes) and the same for the other, RG condition. So implicitly I do have a spread just that data was not used to plot this, only those ratios. Is in this case still p value not necessary? On Fri, 27 Sep 2019 at

Re: [R] how to add p values to bar plot?

2019-09-27 Thread Vivek Das
Ah, this is a single observation and not pvalue calculation over a distribution. You don’t seem to have a spread. Here your code seemed like it was over all genes(more than 1) vs RG genes(also more than one). But it is basically an observation of difference of 2 values. So it doesn’t need to

Re: [R] how to add p values to bar plot?

2019-09-27 Thread Vivek Das
You will need to add stat_compare_means. Take a look at here. http://www.sthda.com/english/articles/24-ggpubr-publication-ready-plots/76-add-p-values-and-significance-levels-to-ggplots/ library(ggpubr) p + stat_compare_means() Should be fine. Vivek On Fri, Sep 27, 2019 at 7:29 PM Ana Marija

[R] how to add p values to bar plot?

2019-09-27 Thread Ana Marija
Hi, I created a bar plot with this code: library(ggplot2) df <- data.frame("prop" = c(7.75,70.42), "Name" = c("All Genes","RG Genes")) p<-ggplot(data=df, aes(x=Name, y=prop,fill=Name)) + geom_bar(stat="identity")+ labs(x="", y = "Proportion of cis EQTLs")+ scale_fill_brewer(palette="Greens") +

Re: [R] How to add a dummy code for (G)LMER

2018-11-04 Thread Bert Gunter
I am almost certain that no dummy variables are necessary -- but mixed models questions are always better posed on the r-sig-mixed-models list. Bert On Sun, Nov 4, 2018 at 1:38 PM Yune S. Lee wrote: > Dear R experts -- > > I never needed to add a dummy column and always query statistical

[R] How to add a dummy code for (G)LMER

2018-11-04 Thread Yune S. Lee
Dear R experts -- I never needed to add a dummy column and always query statistical results by querying summary(model) for GLMER. However, I was recently asked to add a dummy column for interaction variables when performing GLMER. Could anyone tell me if it's necessary to add a dummy column for

Re: [R] How to add a geom_smooth() line

2018-08-24 Thread Jeff Reichman
Got it thank you From: Riley Finn Sent: Thursday, August 23, 2018 10:24 PM To: reichm...@sbcglobal.net Cc: R-help@r-project.org Subject: Re: [R] How to add a geom_smooth() line Jeff, You need to reshape your data frame. If you use ggplot, you will often have to present your data

Re: [R] How to add a geom_smooth() line

2018-08-23 Thread Riley Finn
Jeff, You need to reshape your data frame. If you use ggplot, you will often have to present your data in "long format" Use the reshape2 package. I made a sample data frame because you didn't provide one. I also change your x and y labels because they made no sense. data <- data.frame(

Re: [R] How to add a geom_smooth() line

2018-08-23 Thread Rui Barradas
Hello, if you want to fit different models to each of deliveries and launches, use the wide format instead: ggplot(data = data, aes(x = timeline)) + geom_point(aes(y = deliveries), color = "blue") + geom_smooth(aes(y = deliveries), color = "blue", method = lm, formula = y ~ log(x)) +

Re: [R] How to add a geom_smooth() line

2018-08-23 Thread Rui Barradas
Sorry, should be geom_smooth, not stat_smooth. They both work the same way or very close to it. Rui Barradas On 24/08/2018 05:08, Rui Barradas wrote: Hello, The trick is to reshape your data from wide to long format. There are many ways to do this, I will use package reshape2. Make up a

Re: [R] How to add a geom_smooth() line

2018-08-23 Thread Rui Barradas
Hello, The trick is to reshape your data from wide to long format. There are many ways to do this, I will use package reshape2. Make up a dataset: library(ggplot2) library(reshape2) set.seed(9773) n <- 20 data <- data.frame(timeline = 1:n, deliveries = log(1:n) + runif(n),

[R] How to add a geom_smooth() line

2018-08-23 Thread Jeff Reichman
R-help I want to add two smooth lines (geom_smooth()) for each scatter plot. How do I do that? ggplot() + geom_point(data=data, aes(x=timeline, y=deliveries), color="blue") + geom_point(data=data, aes(x=timeline, y=launches), color="red") + xlab("Deliveries") +

Re: [R] how to add a child to a child in XML

2018-03-22 Thread David L Carlson
rg> On Behalf Of Bond, Stephen Sent: Thursday, March 22, 2018 9:51 AM To: 'Ben Tupper' <btup...@bigelow.org> Cc: 'r-help' <r-help@R-project.org> Subject: Re: [R] how to add a child to a child in XML Just to clarify and hopefully catch the attention of the maintainer: The newXMLNode

Re: [R] how to add a child to a child in XML

2018-03-22 Thread Bond, Stephen
, March 22, 2018 10:40 AM To: Bond, Stephen Cc: r-help Subject: Re: [R] how to add a child to a child in XML Hi, It's a reasonable question. The answer is that it actually is included, but there are many instances across packages where multiple functions are documented on a single help page

Re: [R] how to add a child to a child in XML

2018-03-22 Thread Ben Tupper
nt: Wednesday, March 21, 2018 6:18 PM > To: Bond, Stephen > Cc: r-help > Subject: Re: [R] how to add a child to a child in XML > > Hi, > > XML doesn't use the `$` to access child nodes. Instead use either `[name]` > to get a list of children of that name or `[[name]]` to g

Re: [R] how to add a child to a child in XML

2018-03-22 Thread Bond, Stephen
: [R] how to add a child to a child in XML Hi, XML doesn't use the `$` to access child nodes. Instead use either `[name]` to get a list of children of that name or `[[name]]` to get the just the first child of that name encountered in the genealogy. Thus for your example... > root$child1 N

Re: [R] how to add a child to a child in XML

2018-03-21 Thread Ben Tupper
Hi, XML doesn't use the `$` to access child nodes. Instead use either `[name]` to get a list of children of that name or `[[name]]` to get the just the first child of that name encountered in the genealogy. Thus for your example... > root$child1 NULL > root[['child1']] On the other hand,

[R] how to add a child to a child in XML

2018-03-21 Thread Bond, Stephen
I am trying to add a child to a child using XML package in R. the following fails library(XML) node1 <- c("val1","val2","val3") names(node1) <- c("att1","att2","att3") root <- xmlNode("root", attrs=node1) node2 <- LETTERS[1:3] names(node2) <- paste("name",1:3,sep="") root <-

Re: [R] How to add make option to package compilation?

2017-09-15 Thread Martin Morgan
On 09/15/2017 08:57 AM, Michael Dewey wrote: In line On 15/09/2017 13:30, Martin Møller Skarbiniks Pedersen wrote: On 15 September 2017 at 14:13, Duncan Murdoch wrote: On 15/09/2017 8:11 AM, Martin Møller Skarbiniks Pedersen wrote: Hi, I am installing a lot

Re: [R] How to add make option to package compilation?

2017-09-15 Thread Michael Dewey
In line On 15/09/2017 13:30, Martin Møller Skarbiniks Pedersen wrote: On 15 September 2017 at 14:13, Duncan Murdoch wrote: On 15/09/2017 8:11 AM, Martin Møller Skarbiniks Pedersen wrote: Hi, I am installing a lot of packages to a new R installation and it

Re: [R] How to add make option to package compilation?

2017-09-15 Thread Martin Møller Skarbiniks Pedersen
On 15 September 2017 at 14:13, Duncan Murdoch wrote: > On 15/09/2017 8:11 AM, Martin Møller Skarbiniks Pedersen wrote: > >> Hi, >> >>I am installing a lot of packages to a new R installation and it takes >> a >> long time. >>However the machine got 4 cpus and

Re: [R] How to add make option to package compilation?

2017-09-15 Thread Duncan Murdoch
On 15/09/2017 8:11 AM, Martin Møller Skarbiniks Pedersen wrote: Hi, I am installing a lot of packages to a new R installation and it takes a long time. However the machine got 4 cpus and most of the packages are written in C/C++. So is it possible to add a -j4 flag to the make command

[R] How to add make option to package compilation?

2017-09-15 Thread Martin Møller Skarbiniks Pedersen
Hi, I am installing a lot of packages to a new R installation and it takes a long time. However the machine got 4 cpus and most of the packages are written in C/C++. So is it possible to add a -j4 flag to the make command when I use the install.packages() function? That will probably

Re: [R] How to add overall xlabel and ylabel?

2016-09-25 Thread Duncan Murdoch
On 25/09/2016 7:51 AM, Matti Viljamaa wrote: I have created a 2x2 plot using par(mfrow = c(2, 2)). I can add x- and ylabels to individual plots, but what I want is to add overall xlabel and ylabel for the entire 2x2 plot. How to do this? First you need to make space using par(oma=...), then

Re: [R] How to add overall xlabel and ylabel?

2016-09-25 Thread Ben Tupper
Hi, Here's a place to start... https://www.r-bloggers.com/two-tips-adding-title-for-graph-with-multiple-plots-add-significance-asterix-onto-a-boxplot/ You might also want to checkout the text() function and the xpd argument to par. Ben > On Sep 25, 2016, at 7:51 AM, Matti Viljamaa

[R] How to add overall xlabel and ylabel?

2016-09-25 Thread Matti Viljamaa
I have created a 2x2 plot using par(mfrow = c(2, 2)). I can add x- and ylabels to individual plots, but what I want is to add overall xlabel and ylabel for the entire 2x2 plot. How to do this? __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and

Re: [R] How to add no data entries into current dataframe?

2016-03-25 Thread Bert Gunter
?rbind 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, Mar 24, 2016 at 9:49 PM, Hiroyuki Sato wrote: > Hello members > > Question >

Re: [R] How to add no data entries into current dataframe?

2016-03-25 Thread Hiroyuki Sato
Hello Ulrik and Jeff Thank you for replying. I succeed to create data frame following steps. s <- structure(list(ID = c(101L, 102L, 103L, 103L), DATE = c(20160301L, 20160301L, 20160301L, 20160302L), VAR = c(1L, 1L, 1L, 1L), CODE = structure(c(1L, 2L, 3L, 3L), .Label = c("PDT1", "PDT2", "PDT3"),

Re: [R] How to add no data entries into current dataframe?

2016-03-25 Thread Ulrik Stervbo
You could make a vector with all possible IDs. Use %in% to get just those that are missing. missing.id <- c (101:1000) missing.id <- missing.id[! missing.id %in% s $ID] Df2 <- data.frame(ID = missing.id, CODE = paste0 (PDT, missing.id), VAR = 0) Modify your original data.frame so you can rind

Re: [R] How to add no data entries into current dataframe?

2016-03-24 Thread Jeff Newmiller
Suggested reading An Introduction to R, section 5.3 The Posting Guide, mentioned at the bottom of this message, which mentions that this is a pain text mailing list so don't post in HTML (it gets mangled). -- Sent from my phone. Please excuse my brevity. On March 24, 2016 10:09:46 PM PDT,

Re: [R] How to add no data entries into current dataframe?

2016-03-24 Thread Hiroyuki Sato
Hello Ulrik Thank you for replying. The real data has many IDs( about 3,000 IDS). So I want to find missing values with function or something. If 104 not in s, then add 104 value with all column zero. And also real data has many columns( 80 ~ 5,000, columns. it is not fixed length ). So I would

Re: [R] How to add no data entries into current dataframe?

2016-03-24 Thread Ulrik Stervbo
Hi Hiroyuki, The row bind function rbind() is what you need s <- dcast(s,ID ~ CODE, value.var="VAR",sum) df2 <- data.frame(ID = c(104, 105), PDT1 = 0, PDT2 = 0, PDT3 = 0) rbind(s, df2) hope this helps Ulrik On Fri, 25 Mar 2016 at 05:52 Hiroyuki Sato wrote: > Hello

[R] How to add no data entries into current dataframe?

2016-03-24 Thread Hiroyuki Sato
Hello members Question Could you tell me how to add ID 100, 104, 105 values with zero? 1, Source data ID 100, 104 and 105 has no values. > s ID DATE VAR CODE 1 101 20160301 1 PDT1 2 102 20160301 1 PDT2 3 103 20160301 1 PDT3 4 103 20160302 1 PDT3 s <- structure(list(ID = c(101L, 102L, 103L,

Re: [R] How to add legend to 2 different data frame overplot?

2015-10-31 Thread Jim Lemon
Hi C W, I would guess you are trying to use the base graphics "legend" function. Have you tried one of the scale_* functions in ggplot? Jim On Sat, Oct 31, 2015 at 3:10 PM, C W wrote: > Hi, > > I am trying to do add a legend to an overplot, something like this: > > ggplot()

Re: [R] How to add legend to 2 different data frame overplot?

2015-10-31 Thread Jeff Newmiller
Remove show_guide = FALSE? --- Jeff NewmillerThe . . Go Live... DCN:Basics: ##.#. ##.#. Live Go... Live:

[R] How to add legend to 2 different data frame overplot?

2015-10-30 Thread C W
Hi, I am trying to do add a legend to an overplot, something like this: ggplot() + geom_density(data = df1, aes(x = x), fill = "green", show_guide = FALSE) + geom_area(data = df2, aes(x = x), fill = "yellow", show_guide = FALSE) + scale_color_manual(values = c("green", "yellow"),

Re: [R] how to add 1 + 1 with the interface between R and C

2015-09-21 Thread Cleber Borges
I think is time to learning Rcpp! :-) thank you (Peter Dalgaard and Dirk Eddelbuettel ) by the examples! the more simples are often more informatives... cleber Em 21/09/2015 12:36, Dirk Eddelbuettel escreveu: peter dalgaard gmail.com> writes: C is call by value and k and res are

Re: [R] how to add 1 + 1 with the interface between R and C

2015-09-21 Thread Dirk Eddelbuettel
peter dalgaard gmail.com> writes: > C is call by value and k and res are pointers. You need a dereferencing step or nothing with happen. Try > > *res = *k + 1; Or you use Rcpp which writes the glue code. Save the following into a file: #include // [[Rcpp::export]] int adder(int x, int y) {

Re: [R] how to add 1 + 1 with the interface between R and C

2015-09-21 Thread peter dalgaard
> On 21 Sep 2015, at 04:03 , Cleber N.Borges wrote: > > Dear useRs, > > I would like some help on how to make the sum of 1 + 1 > but using the interface between A and C. > > the function call does .call lock and close the R. > > Thank you for any help it. Either you

[R] how to add 1 + 1 with the interface between R and C

2015-09-21 Thread Cleber N.Borges
Dear useRs, I would like some help on how to make the sum of 1 + 1 but using the interface between A and C. the function call does .call lock and close the R. Thank you for any help it. Cleber ### R code text_code <-" #include #include #include void

Re: [R] How to add legend to a dotplot

2015-06-03 Thread Duncan Mackay
of Agronomy and Soil Science University of New England Armidale NSW 2351 Email: home: mac...@northnet.com.au -Original Message- From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of li li Sent: Wednesday, 3 June 2015 13:07 To: r-help Subject: [R] How to add legend to a dotplot Hi

Re: [R] How to add legend to a dotplot

2015-06-03 Thread li li
-project.org] On Behalf Of li li Sent: Wednesday, 3 June 2015 13:07 To: r-help Subject: [R] How to add legend to a dotplot Hi all, I wanted to add the legend to a dotplot using legend funciton. If does not seem to be working? Anyone have any suggestions? Thanks! Hanna

Re: [R] How to add legend to a dotplot

2015-06-02 Thread Jim Lemon
Hi Hanna, That is because dotplot is a lattice graphics function and legend is a base graphics function. There are two things you can do to fix this. One is to use the dotchart function in base graphics. The other is to use simpleKey in the latticeExtra package for the legend. Jim On Wed, Jun

[R] How to add legend to a dotplot

2015-06-02 Thread li li
Hi all, I wanted to add the legend to a dotplot using legend funciton. If does not seem to be working? Anyone have any suggestions? Thanks! Hanna __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see

Re: [R] How to add error bars to a line xyplot (lattice package)

2015-01-28 Thread Kevin Wright
Doh, can't believe I missed that. Sorry Bert. On Tue, Jan 27, 2015 at 5:08 PM, Bert Gunter gunter.ber...@gene.com wrote: Well, the OP already referred to segplot. But, see, he shouldn't be doing this plot in the first place. Yes, I know it's fairly standard in science, but it's a bad idea

Re: [R] How to add error bars to a line xyplot (lattice package)

2015-01-27 Thread Kevin Wright
See segplot in the latticeExtra package. Kevin On Mon, Jan 26, 2015 at 7:58 PM, Jun Shen jun.shen...@gmail.com wrote: Dear list, I have a couple of lines (superimposed) in an xyplot and just want to add error bars to each of the data point. It's been a while since this question was asked

Re: [R] How to add error bars to a line xyplot (lattice package)

2015-01-27 Thread Bert Gunter
Well, the OP already referred to segplot. But, see, he shouldn't be doing this plot in the first place. Yes, I know it's fairly standard in science, but it's a bad idea (as are many others, like the infamous dynamite plot). If uncertainty intervals are desired, they should be model based,

Re: [R] How to add error bars to a line xyplot (lattice package)

2015-01-27 Thread William Revelle
You might want to look at the examples in error.bars.by in the psych package. Bill On Jan 26, 2015, at 7:58 PM, Jun Shen jun.shen...@gmail.com wrote: Dear list, I have a couple of lines (superimposed) in an xyplot and just want to add error bars to each of the data point. It's been a

Re: [R] How to add error bars to a line xyplot (lattice package)

2015-01-26 Thread Jim Lemon
Hi Jun, Here is one way to do this using the mtcars data set, although there are probably better ways. mtcars$sd-runif(32,1,2) mpgxhp-xyplot(mpg~hp,mtcars, main=Miles per gallon by horsepower, xlab=Horsepower,ylab=Miles per gallon, panel=function(x,y,ulim,llim) { yspace-diff(range(y))/100

[R] How to add error bars to a line xyplot (lattice package)

2015-01-26 Thread Jun Shen
Dear list, I have a couple of lines (superimposed) in an xyplot and just want to add error bars to each of the data point. It's been a while since this question was asked last time. But the segplot from latticeExtra is not straight forward. Just wonder if there is a better way to do this.

Re: [R] How to add a line of mean to the bwplot (lattice package)

2015-01-25 Thread Bert Gunter
Jun: Call a custom panel function that adds horizontal lines at the means of your groups. Something like (for vertical boxes, i.e.horiz=FALSE; make appropriate change for horizontal boxes) e.g. panel.mn - function(x,y,box.width=.5,horiz=FALSE,...){ panel.bwplot(x,y,box.width,horiz=horiz,...)

[R] How to add a line of mean to the bwplot (lattice package)

2015-01-25 Thread Jun Shen
Dear list, The bwplot generates box plots with a dot in median. How do I add a line of mean to the boxes? Thanks a lot. Jun [[alternative HTML version deleted]] __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see

Re: [R] How to add a legend with symbols()

2014-08-28 Thread Peter Maclean
 #How to add a legend for this bubble plot #I prefer p2 with a legend for each bubble library(graphics) set.seed(1234) n=20 x - rnorm(n)*2 y - rnorm(n) * 1/10 Z - rnorm(n)+ 100 df$r - sqrt(z/pi) df$l - replicate(n, paste(sample(LETTERS, 3, replace=TRUE), collapse=))   N - nrow(df) p1 -

[R] How to add break in axis for grouped barplot?

2014-05-27 Thread Wei Qin
Dear Sir/Madam, It is possible to make grouped bar plots via barplot. But I want to add a break in y axis for data that largely differs. However, this seems complicated. Although gap.barplot may add a break in y asis, but the bars are not grouped as I wanted. Could you help me with this

Re: [R] How to add break in axis for grouped barplot?

2014-05-27 Thread Jim Lemon
On Tue, 27 May 2014 11:36:21 AM Wei Qin wrote: ... #Then my questions is how to make a broken y axis in grouped barplot figures? # In another words, how to combine the function of barplot and gap.barplot? Hi Wei, The gap.barplot function doesn't do grouped bars (yet). You can probably

Re: [R] how to add a table under a plot?

2014-05-27 Thread Helen Gao
, daniel Feladó: r-help-boun...@r-project.org [r-help-boun...@r-project.org] ; meghatalmaz#243;: Helen Gao [helengao...@gmail.com] Küldve: 2014. május 23. 16:38 To: r-help@r-project.org Tárgy: [R] how to add a table under a plot? Dear all, If you

Re: [R] How to add break in axis for grouped barplot?

2014-05-27 Thread Wei Qin
Dear Jim, Thank you very much indeed for your quick reply and kind help. The code you provided works perfectly, which is exactly what I want. Kind regards, Wei On 27 May 2014 14:11, Jim Lemon j...@bitwrit.com.au wrote: On Tue, 27 May 2014 11:36:21 AM Wei Qin wrote: ... #Then my questions

Re: [R] how to add a table under a plot?

2014-05-24 Thread John Kane
Kingston ON Canada -Original Message- From: helengao...@gmail.com Sent: Fri, 23 May 2014 15:38:45 +0100 To: r-help@r-project.org Subject: [R] how to add a table under a plot? Dear all, If you know how to add a table under a plot, could you please send me your code? In R

[R] how to add a table under a plot?

2014-05-23 Thread Helen Gao
Dear all, If you know how to add a table under a plot, could you please send me your code? In R documentation, there is a function addtable2plot{}, do you know where to download the function? Thank you in advance, Helen [[alternative HTML version deleted]]

Re: [R] how to add a table under a plot?

2014-05-23 Thread Kehl Dániel
[helengao...@gmail.com] Küldve: 2014. május 23. 16:38 To: r-help@r-project.org Tárgy: [R] how to add a table under a plot? Dear all, If you know how to add a table under a plot, could you please send me your code? In R documentation, there is a function addtable2plot{}, do you know where

Re: [R] how to add a table under a plot?

2014-05-23 Thread Greg Snow
There is an addtable2plot function in the plotrix package, which is on CRAN and can be installed using install.packages or other standard ways of installing packages. If you need the table to line up with parts of the plot then you could leave extra margin area and call the axis function multiple

[R] How to add box layer using levelplot in R?

2014-02-21 Thread Jonsson
I would like to add some boxes with special extent to my plot. Example gh - raster() gh[] - 1:ncell(gh) SP - spsample(Spatial(bbox=bbox(gh)), 10, type=random) Then plot them levelplot(gh, col.regions = rev(terrain.colors(255)), cuts=254, margin=FALSE) + layer(sp.points(SP,

Re: [R] how to add a line in the graph?

2013-12-16 Thread David Winsemius
On Dec 15, 2013, at 4:46 AM, 水静流深 wrote: t--4:4 y-c(5,7,10,13,15,16,14,12,11) plot(t,y,type=l) how can i add a curve y=0.83*t-0.44*t^2 in the graph? [[alternative HTML version deleted]] t--4:4 y-c(5,7,10,13,15,16,14,12,11) plot(t,y,type=l, ylim=c(-4,16)) curve( 0.83*x-0.44*x^2 ,

[R] how to add a line in the graph?

2013-12-15 Thread ????????
t--4:4 y-c(5,7,10,13,15,16,14,12,11) plot(t,y,type=l) how can i add a curve y=0.83*t-0.44*t^2 in the graph? [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read

Re: [R] how to add a line in the graph?

2013-12-15 Thread Frans Marcelissen
Hi, On itself one way of doing this is: lines(seq(-4,4,0.1),sapply(seq(-4,4,0.1),function(t)0.83*t-0.44*t^2)) The curve does not fit in the scale, however. Are you sure the formula is correct? Then you have to adapt the scale: plot.new() plot.window(xlim=c(-4,4), ylim=c(-10,16)) axis(1) axis(2)

[R] How to add unique occasions based on date within a subject in R?

2013-11-21 Thread Andrzej Bienczak
Hi All, I'm trying to figure out how in my data set to add a column including a count of unique events based on date. Here is a part of my data set: trialno event date time 3 11301pm_intake 2010-11-24

Re: [R] How to add unique occasions based on date within a subject in R?

2013-11-21 Thread arun
Hi, May be you can try: ###Use dput() dat1 - structure(list(trialno = c(11301L, 11301L, 11301L, 11301L, 11301L, 11301L, 11301L, 11301L, 11301L, 11301L, 11302L, 11302L, 11302L, 11302L, 11302L, 11302L, 11302L, 11302L, 11302L, 11302L), event = c(pm_intake, am_intake, pk1, pm_intake, am_intake,

Re: [R] How to add unique occasions based on date within a subject in R?

2013-11-21 Thread arun
Hi, May be you can try: ###Use dput() dat1 - structure(list(trialno = c(11301L, 11301L, 11301L, 11301L, 11301L, 11301L, 11301L, 11301L, 11301L, 11301L, 11302L, 11302L, 11302L, 11302L, 11302L, 11302L, 11302L, 11302L, 11302L, 11302L), event = c(pm_intake, am_intake, pk1, pm_intake, am_intake,

[R] how to add a box to map plotted by a levelplot?

2013-09-24 Thread Jonsson
conne2 - file(C:\\ome1440s.bin,rb) bioms- readBin(conne2, integer(), size=1, n=1440*720, signed=F) library(raster) library(rasterVis) data(wrld_simpl) library(maptools) ## needed for wrld_simpl r - raster(nrow=720, ncol=1440) r[] - bioms;

Re: [R] how to add a box to map plotted by a levelplot?

2013-09-24 Thread Pascal Oettli
Hello, One way is: levelplot(r, col.regions=myPal) + layer(sp.polygons(wrld_simpl, lwd=0.5)) + layer(panel.rect(2,45,8,51)) Regards, Pascal 2013/9/24 Jonsson amen.alya...@bordeaux.inra.fr conne2 - file(C:\\ome1440s.bin,rb) bioms- readBin(conne2, integer(), size=1, n=1440*720,

Re: [R] how to add a box to map plotted by a levelplot?

2013-09-24 Thread Jonsson
That worked fine, thanks. But only worked when the values are positive but when I added negative values, the box was wrong. May be the order I lat and long should be different?any ideas -- View this message in context:

Re: [R] how to add a box to map plotted by a levelplot?

2013-09-24 Thread Jonsson
Thanks.That worked fine.Is there a way to print a number like 1 inside the box plotted? -- View this message in context: http://r.789695.n4.nabble.com/how-to-add-a-box-to-map-plotted-by-a-levelplot-tp4676815p4676825.html Sent from the R help mailing list archive at Nabble.com.

Re: [R] how to add a box to map plotted by a levelplot?

2013-09-24 Thread Pascal Oettli
Hello, ?panel.text ?grid.text Regards, Pascal 2013/9/24 Jonsson amen.alya...@bordeaux.inra.fr Thanks.That worked fine.Is there a way to print a number like 1 inside the box plotted? -- View this message in context:

[R] How-to add to LDA ggplot axes the Percentage of variance explained

2013-08-13 Thread Lluis
Hi, How can I add to LDA ggplot axes the Percentages of variance explained? Script: /require(MASS) require(ggplot2) iris.lda-lda(Species ~ Sepal.Length + Sepal.Width + Petal.Length + Petal.Width, data = iris) datPred-data.frame(Species=predict(iris.lda)$class,predict(iris.lda)$x)

Re: [R] how to add any extra word to existing column heading in R

2013-06-25 Thread John Kane
: suparna.mitra...@gmail.com Sent: Thu, 20 Jun 2013 12:56:24 +0800 To: r-help@r-project.org Subject: [R] how to add any extra word to existing column heading in R Hello R experts, I want to add some extra words to number to existing column header. Can anybody tell me how to do that. e.g. if I

[R] how to add any extra word to existing column heading in R

2013-06-19 Thread Suparna Mitra
Hello R experts, I want to add some extra words to number to existing column header. Can anybody tell me how to do that. e.g. if I have a data.frame Height.1 Height.2 Height.6 Height.8 Height.10 Height.11 Height.17 Height.20 Height.22 Height.31 MBR174 720 104

Re: [R] how to add any extra word to existing column heading in R

2013-06-19 Thread Pascal Oettli
Hello, What did you try to do by yourself before to ask? Regards, Pascal On 20/06/13 13:56, Suparna Mitra wrote: Hello R experts, I want to add some extra words to number to existing column header. Can anybody tell me how to do that. e.g. if I have a data.frame Height.1 Height.2

Re: [R] how to add any extra word to existing column heading in R

2013-06-19 Thread Suparna Mitra
Hello, I was trying ways to define new column names. Or very traditional way to export the data and add names in excel. But thought there must a way, but searched with several key words in forum, but couldn't find the exact what I mean. May be my search terms are not perfect. Thanks, Mitra On

Re: [R] how to add any extra word to existing column heading in R

2013-06-19 Thread Pascal Oettli
Hello, Two keywords: colnames and paste. Regards, Pascal On 20/06/13 14:09, Suparna Mitra wrote: Hello, I was trying ways to define new column names. Or very traditional way to export the data and add names in excel. But thought there must a way, but searched with several key words in

Re: [R] how to add new rows in a dataframe?

2013-04-30 Thread arun
Hi, Not sure if this is what you meant. dat1- read.table(text= id    t scores  scores2  scores3 2 0    1.2 1.4    1.9 2 2 2.3 2.5   2.2 2 3    3.6 

  1   2   3   4   >