Re: [R] Solving equations
On 08-09-2014, at 06:55, Mohan Radhakrishnan radhakrishnan.mo...@gmail.com wrote: No. I was not looking for an answer to that question. I wasn't clear :-) I already code using Octave and R to solve ML algorithms. I am trying to understand how R packages can help us to solve such equations using LU decomposition etc. The question was about using R with these math algorithms. It’s still unclear what you want. Look at ?solve The solution to your simultaneous system of linear equations is x=0 and w=0. Berend Mohan On Mon, Sep 8, 2014 at 12:31 AM, Rui Barradas ruipbarra...@sapo.pt wrote: Hello, Inline. Em 07-09-2014 09:54, Mohan Radhakrishnan escreveu: Hi, I code R to parse data but not for solving equations. So this is my first such problem. It is a programming puzzle. I have these two equations. 1)4x - 3w = 0 2)8x - 7w =0 I know the value of x and w for equation 1). x = 3 and w = 4 equation 2). x = 7 and w = 8 Why? Any of those equations defines a straight line, not a point. Those two points are just one of the infinitely many solutions. Your equations are equivalent to eq1) w = 4/3x eq2) w = 8/7x the equations of straight lines passing through the origin (no independent term). I also know how to write more equations based on data available in the puzzle. How do I solve a set of such equations ? I need to find out the values of x and w for each such equation. There are packages to solve simultaneous equations but I've never used them. Hope this helps, Rui Barradas I know that here the equations are simple because the puzzle can be simplfied. Thanks, Mohan [[alternative HTML version deleted]] __ R-help@r-project.org mailing list 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 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 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] sequential input script dataframe process functionality
On Sat, 6 Sep 2014 08:21:19 -0700 William Dunlap wdun...@tibco.com wrote: testdataextract1-switch(menu(c(unique(levels(testdata[,1]))),graphics=FALSE,title='Select something')) The switch function does not work the way you are expecting it to. Read help(switch) and read the introduction to R that comes with R. You probably want to use the output of menu() to extract a row of testdata with testdata[outputOfMenu,]. (How could testdataextract1 contain anything in the 2nd or 3rd columns of testdata if the expression producing testdataextract1 does not contain any reference to that column?) I tried: testdataextract1-function (testdata) { + selectionresult-switch(menu(c(unique(levels(testdata[,1]))),graphics=FALSE,title='Select something')) + return (testdata[selectionresult,]) + } testdataextract1(testdata) Select something 1: text test1 2: text test2 3: text test3 Selection: 2 [1] variablea variableb variablec 0 rows (or 0-length row.names) Why does this error occur? Although the menu must show only unique values to be chosen, the resultant output must show all values that match the chosen value in this example: text test2 other texty 200 text test2 other texty 700 text test2 other texty 300 text test2 other texty 250 __ R-help@r-project.org mailing list 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] using edit to extract codes from vignette failed
Try: edit(vignette(grobs,package = grid)) (edit is a method. It looks at the class of the first entry, name, to identify which method to use. See ?edit. You want it to use edit.vignette, so you need to drop 'file=' so you pass the vignette to edit as the first argument or name=. Then edit will pass it to edit.vignette and it'll work. Or go direct: edit.vignette(vignette(grobs,package = grid)). See ?vignette. Maybe the use of name as the first argument of a method is a little misleading? But you can work out what is going if you work through the help documentation.) Karl Message: 9 Date: Sun, 7 Sep 2014 17:06:44 +0800 (CST) From: PO SU rhelpmaill...@163.com To: R. Help r-help@r-project.org Subject: [R] using edit to extract codes from vignette failed Message-ID: 4d3c1c8a.1c96.1484f5d8d31.coremail.rhelpmaill...@163.com Content-Type: text/plain; charset=UTF-8 Dear expeRts, ? ? When i using the following code, i get a error as follows: ?edit(file=vignette(grobs,package = grid)) Error in edit.vignette(file = vignette(grobs, package = grid)) :? ? argument name is missing, with no default I investigated edit function, but still can't ?get codes from a vignette, May you help me? -- PO SU mail: desolato...@163.com Majored in Statistics from SJTU __ R-help@r-project.org mailing list 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] sequential input script dataframe process functionality
Again, feed the output of menu() directly into [. Do not use switch(). Bill Dunlap TIBCO Software wdunlap tibco.com On Mon, Sep 8, 2014 at 2:12 AM, r...@openmailbox.org wrote: On Sat, 6 Sep 2014 08:21:19 -0700 William Dunlap wdun...@tibco.com wrote: testdataextract1-switch(menu(c(unique(levels(testdata[,1]))),graphics=FALSE,title='Select something')) The switch function does not work the way you are expecting it to. Read help(switch) and read the introduction to R that comes with R. You probably want to use the output of menu() to extract a row of testdata with testdata[outputOfMenu,]. (How could testdataextract1 contain anything in the 2nd or 3rd columns of testdata if the expression producing testdataextract1 does not contain any reference to that column?) I tried: testdataextract1-function (testdata) { + selectionresult-switch(menu(c(unique(levels(testdata[,1]))),graphics=FALSE,title='Select something')) + return (testdata[selectionresult,]) + } testdataextract1(testdata) Select something 1: text test1 2: text test2 3: text test3 Selection: 2 [1] variablea variableb variablec 0 rows (or 0-length row.names) Why does this error occur? Although the menu must show only unique values to be chosen, the resultant output must show all values that match the chosen value in this example: text test2 other texty 200 text test2 other texty 700 text test2 other texty 300 text test2 other texty 250 __ R-help@r-project.org mailing list 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] sequential input script dataframe process functionality
On Mon, 8 Sep 2014 07:55:23 -0700 William Dunlap wdun...@tibco.com wrote: Again, feed the output of menu() directly into [. Do not use switch(). Bill Dunlap The function was changed to: testdataextract1-function (testdata) { selectionresult-menu(c(unique(levels(testdata[,1]))),graphics=FALSE,title='Select something') return (testdata[selectionresult,]) } testdataextract1(testdata) testdataextract1(testdata) Select something 1: text test1 2: text test2 3: text test3 Selection: 2 variablea variableb variablec 2 text test2 other texty 200 However, how to adjust the function 'return' so that _all_ values that match the selected value from the menu are returned (as below)? Although the menu must show only unique values to be chosen, the resultant output must show all values that match the chosen value in this example: text test2 other texty 200 text test2 other texty 700 text test2 other texty 300 text test2 other texty 250 __ R-help@r-project.org mailing list 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] sequential input script dataframe process functionality
d - data.frame(Choices=c(One,Two,One,Three), X=1:4) i - 1 # possible output of menu(unique(d$Choices)) d[ d$Choices[i] == d$Choices, ] # Choices X #1 One 1 #3 One 3 I believe this sort of thing is covered in the Introduction to R pdf that comes with R. It is worth reading. Bill Dunlap TIBCO Software wdunlap tibco.com On Mon, Sep 8, 2014 at 8:13 AM, r...@openmailbox.org wrote: On Mon, 8 Sep 2014 07:55:23 -0700 William Dunlap wdun...@tibco.com wrote: Again, feed the output of menu() directly into [. Do not use switch(). Bill Dunlap The function was changed to: testdataextract1-function (testdata) { selectionresult-menu(c(unique(levels(testdata[,1]))),graphics=FALSE,title='Select something') return (testdata[selectionresult,]) } testdataextract1(testdata) testdataextract1(testdata) Select something 1: text test1 2: text test2 3: text test3 Selection: 2 variablea variableb variablec 2 text test2 other texty 200 However, how to adjust the function 'return' so that _all_ values that match the selected value from the menu are returned (as below)? Although the menu must show only unique values to be chosen, the resultant output must show all values that match the chosen value in this example: text test2 other texty 200 text test2 other texty 700 text test2 other texty 300 text test2 other texty 250 __ R-help@r-project.org mailing list 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] using edit to extract codes from vignette failed
Tks for correcting me not using the file argument, but the codes you supply seem still not work. edit(vignette(grobs,package = grid)) can't work. I am using win7, the latest version of Rstudio which using R.3.1.1.The error is: Error in editor(file = file, title = title) : argument name is missing, with no default -- PO SU mail: desolato...@163.com Majored in Statistics from SJTU At 2014-09-08 05:46:39, Karl Ropkins k.ropk...@its.leeds.ac.uk wrote: Try: edit(vignette(grobs,package = grid)) (edit is a method. It looks at the class of the first entry, name, to identify which method to use. See ?edit. You want it to use edit.vignette, so you need to drop 'file=' so you pass the vignette to edit as the first argument or name=. Then edit will pass it to edit.vignette and it'll work. Or go direct: edit.vignette(vignette(grobs,package = grid)). See ?vignette. Maybe the use of name as the first argument of a method is a little misleading? But you can work out what is going if you work through the help documentation.) Karl Message: 9 Date: Sun, 7 Sep 2014 17:06:44 +0800 (CST) From: PO SU rhelpmaill...@163.com To: R. Help r-help@r-project.org Subject: [R] using edit to extract codes from vignette failed Message-ID: 4d3c1c8a.1c96.1484f5d8d31.coremail.rhelpmaill...@163.com Content-Type: text/plain; charset=UTF-8 Dear expeRts, ? ? When i using the following code, i get a error as follows: ?edit(file=vignette(grobs,package = grid)) Error in edit.vignette(file = vignette(grobs, package = grid)) :? ? argument name is missing, with no default I investigated edit function, but still can't ?get codes from a vignette, May you help me? -- PO SU mail: desolato...@163.com Majored in Statistics from SJTU __ R-help@r-project.org mailing list 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 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] using edit to extract codes from vignette failed
On Mon, Sep 8, 2014 at 11:21 AM, PO SU rhelpmaill...@163.com wrote: Tks for correcting me not using the file argument, but the codes you supply seem still not work. edit(vignette(grobs,package = grid)) can't work. I am using win7, the latest version of Rstudio which using R.3.1.1.The error is: Error in editor(file = file, title = title) : argument name is missing, with no default The following worked for me: edit(vignette(grobs,package=grid),editor=notepad) Sys.info() returns: Sys.info() sysname release Windows 7 x64 version nodename build 7601, Service Pack 1 IT-JMCKOWN machinelogin x86-64john.mckown user effective_user john.mckownjohn.mckown Apparently there is some option, called editor?, which neither of us has set. And I guess Rstudio doesn't have a default. -- There is nothing more pleasant than traveling and meeting new people! Genghis Khan Maranatha! John McKown __ R-help@r-project.org mailing list 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] using edit to extract codes from vignette failed
On 08/09/2014 12:21 PM, PO SU wrote: Tks for correcting me not using the file argument, but the codes you supply seem still not work. edit(vignette(grobs,package = grid)) can't work. I am using win7, the latest version of Rstudio which using R.3.1.1.The error is: Error in editor(file = file, title = title) : argument name is missing, with no default That appears to be an RStudio bug. edit(vignette(grobs,package = grid)) works fine in R. You should report it to them. Duncan Murdoch -- PO SU mail: desolato...@163.com Majored in Statistics from SJTU At 2014-09-08 05:46:39, Karl Ropkins k.ropk...@its.leeds.ac.uk wrote: Try: edit(vignette(grobs,package = grid)) (edit is a method. It looks at the class of the first entry, name, to identify which method to use. See ?edit. You want it to use edit.vignette, so you need to drop 'file=' so you pass the vignette to edit as the first argument or name=. Then edit will pass it to edit.vignette and it'll work. Or go direct: edit.vignette(vignette(grobs,package = grid)). See ?vignette. Maybe the use of name as the first argument of a method is a little misleading? But you can work out what is going if you work through the help documentation.) Karl Message: 9 Date: Sun, 7 Sep 2014 17:06:44 +0800 (CST) From: PO SU rhelpmaill...@163.com To: R. Help r-help@r-project.org Subject: [R] using edit to extract codes from vignette failed Message-ID: 4d3c1c8a.1c96.1484f5d8d31.coremail.rhelpmaill...@163.com Content-Type: text/plain; charset=UTF-8 Dear expeRts, ? ? When i using the following code, i get a error as follows: ?edit(file=vignette(grobs,package = grid)) Error in edit.vignette(file = vignette(grobs, package = grid)) :? ? argument name is missing, with no default I investigated edit function, but still can't ?get codes from a vignette, May you help me? -- PO SU mail: desolato...@163.com Majored in Statistics from SJTU __ R-help@r-project.org mailing list 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 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 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] using edit to extract codes from vignette failed
Complain to the RStudio people - RStudio defines its own options(editor) which is not completely compatible with R's option(editor=internal). If you set options(editor=internal) in RStudio then you can look at the code in the vignette. (I tried with last year's RStudio 0.98.501 and this may have been fixed by now.) Bill Dunlap TIBCO Software wdunlap tibco.com On Mon, Sep 8, 2014 at 9:21 AM, PO SU rhelpmaill...@163.com wrote: Tks for correcting me not using the file argument, but the codes you supply seem still not work. edit(vignette(grobs,package = grid)) can't work. I am using win7, the latest version of Rstudio which using R.3.1.1.The error is: Error in editor(file = file, title = title) : argument name is missing, with no default -- PO SU mail: desolato...@163.com Majored in Statistics from SJTU At 2014-09-08 05:46:39, Karl Ropkins k.ropk...@its.leeds.ac.uk wrote: Try: edit(vignette(grobs,package = grid)) (edit is a method. It looks at the class of the first entry, name, to identify which method to use. See ?edit. You want it to use edit.vignette, so you need to drop 'file=' so you pass the vignette to edit as the first argument or name=. Then edit will pass it to edit.vignette and it'll work. Or go direct: edit.vignette(vignette(grobs,package = grid)). See ?vignette. Maybe the use of name as the first argument of a method is a little misleading? But you can work out what is going if you work through the help documentation.) Karl Message: 9 Date: Sun, 7 Sep 2014 17:06:44 +0800 (CST) From: PO SU rhelpmaill...@163.com To: R. Help r-help@r-project.org Subject: [R] using edit to extract codes from vignette failed Message-ID: 4d3c1c8a.1c96.1484f5d8d31.coremail.rhelpmaill...@163.com Content-Type: text/plain; charset=UTF-8 Dear expeRts, ? ? When i using the following code, i get a error as follows: ?edit(file=vignette(grobs,package = grid)) Error in edit.vignette(file = vignette(grobs, package = grid)) :? ? argument name is missing, with no default I investigated edit function, but still can't ?get codes from a vignette, May you help me? -- PO SU mail: desolato...@163.com Majored in Statistics from SJTU __ R-help@r-project.org mailing list 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 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 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] Testing general hypotheses on regression coefficients
Others have discussed some of the theoretical approaches (delta method), but as has also been pointed out, this is a mailing list about R, not theory, so here are some approaches to your question from the approach of those of us who like programming R more than remembering theory. I assume that one reason you may be interested in B2/B1 is that you want the confidence interval on the quantity, not just the test of whether it is 0 (that test being equivalent to B2=0 unless B1 is exactly equal to 0). So I will focus more on confidence intervals (which you can use as tests by seeing if the null value is in the interval/region or not). Approach 1, simulation: If all the assumptions hold for the linear regression, then the parameter estimates are considered to by multivariate normal. You can get the covariance matrix for this normal using the vcov function on the summary of your fitted object. Now you can use the mvrnorm function with the estimated means and covariance to generate a bunch of observations from this multivariate normal and compute B2/B1 or some combination of B2/B1 and B4/B3 for each observation. These values represent the distribution of interest and you can calculate a confidence interval by finding the quantiles of the values (0.025 and 0.975 for 95%) or finding the HPD interval (minimum width interval), the emp.hpd function in the TeachingDemos package is one way to do this. For your second hypothesis you could look at B2/B1 - B4/B3 = 0 or (B2/B1) / (B4/B3) = 1, or create a joint confidence region on the 2 ratios and see if the x=y line intersects that region. Approach 2, bootstrap: Bootstrap the whole process, fit the regression model then find the ratio of the estimates. Find the bootstrap confidence interval of the ratio(s), follow above advice. Approach 3, Bayes: Fit a Bayesian regression model and look at the posterior distribution of the ratio(s) of interest, calculate the credible interval/region (the steps will be similar to the previous approaches). Approach 4, simulate from the null: Fit your regression model under then null hypothesis of interest being true (for a more complicated null, your second, you may need to use optimization or quadratic programming to allow some values to vary, but have others dependent on those, then find the least squares solution). Now simulate data based on that model, fit the full regression to the simulated data sets and compare the parameter estimates (or ratios thereof) to the parameter estimates from the original data. You could try any of these approaches for hypotheses where traditional linear hypotheses work and compare the results from the traditional approach to the above approaches to see how they compare (and how many iterations/samples you will need). On Fri, Sep 5, 2014 at 8:17 PM, Chris bonsxa...@yahoo.com wrote: Hi. Say I have a model like y = a + B1*x1 + B2*x2 + B3*x3 + B4*x4 + e and I want to test H0: B2/B1 = 0 or H0: B2/B1=B4/B3 (whatever H1). How can I proceed? I now about car::linearHypothesis, but I can't figure out a way to do the tests above. Any hint? Thanks. C __ R-help@r-project.org mailing list 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. -- Gregory (Greg) L. Snow Ph.D. 538...@gmail.com __ R-help@r-project.org mailing list 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] using edit to extract codes from vignette failed
On 08/09/2014 12:35 PM, Duncan Murdoch wrote: On 08/09/2014 12:21 PM, PO SU wrote: Tks for correcting me not using the file argument, but the codes you supply seem still not work. edit(vignette(grobs,package = grid)) can't work. I am using win7, the latest version of Rstudio which using R.3.1.1.The error is: Error in editor(file = file, title = title) : argument name is missing, with no default That appears to be an RStudio bug. edit(vignette(grobs,package = grid)) works fine in R. You should report it to them. Yes, confirmed: RStudio sets the editor option to a function that requires a name argument, but file.edit doesn't provide one. The documentation for that editor option is pretty weak, but I'd still say this is an RStudio bug. Duncan Murdoch Duncan Murdoch -- PO SU mail: desolato...@163.com Majored in Statistics from SJTU At 2014-09-08 05:46:39, Karl Ropkins k.ropk...@its.leeds.ac.uk wrote: Try: edit(vignette(grobs,package = grid)) (edit is a method. It looks at the class of the first entry, name, to identify which method to use. See ?edit. You want it to use edit.vignette, so you need to drop 'file=' so you pass the vignette to edit as the first argument or name=. Then edit will pass it to edit.vignette and it'll work. Or go direct: edit.vignette(vignette(grobs,package = grid)). See ?vignette. Maybe the use of name as the first argument of a method is a little misleading? But you can work out what is going if you work through the help documentation.) Karl Message: 9 Date: Sun, 7 Sep 2014 17:06:44 +0800 (CST) From: PO SU rhelpmaill...@163.com To: R. Help r-help@r-project.org Subject: [R] using edit to extract codes from vignette failed Message-ID: 4d3c1c8a.1c96.1484f5d8d31.coremail.rhelpmaill...@163.com Content-Type: text/plain; charset=UTF-8 Dear expeRts, ? ? When i using the following code, i get a error as follows: ?edit(file=vignette(grobs,package = grid)) Error in edit.vignette(file = vignette(grobs, package = grid)) :? ? argument name is missing, with no default I investigated edit function, but still can't ?get codes from a vignette, May you help me? -- PO SU mail: desolato...@163.com Majored in Statistics from SJTU __ R-help@r-project.org mailing list 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 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 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] ggplot - boxplot and points split by two factors
Hi, I'm trying to create a boxplot overlayed with points where the data is split by two factor groups. So far: x1-factor(rep(LETTERS[1:4],5)) x2-factor(rep(letters[1:2],10)) z-runif(20,0,10) data-data.frame(x1=x1,x2=x2,z=z) ggplot(data,aes(x=x1,y=z,fill=x2)) + geom_boxplot() + geom_point() Obviously I'd also like to separate the points to overlay the relevant boxplots. Any hints gratefully received. Thanks, Tom __ R-help@r-project.org mailing list 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] ggplot - boxplot and points split by two factors
ggplot(data,aes(x = z1, y = x, fill=x2)) + geom_boxplot() + geom_point(alpha=0.5, position=position_jitterdodge(jitter.width=0.1), aes(group=x2)) On Mon, 2014-09-08 at 13:10 -0400, Tom Wright wrote: Hi, I'm trying to create a boxplot overlayed with points where the data is split by two factor groups. So far: x1-factor(rep(LETTERS[1:4],5)) x2-factor(rep(letters[1:2],10)) z-runif(20,0,10) data-data.frame(x1=x1,x2=x2,z=z) ggplot(data,aes(x=x1,y=z,fill=x2)) + geom_boxplot() + geom_point() Obviously I'd also like to separate the points to overlay the relevant boxplots. Any hints gratefully received. Thanks, Tom __ R-help@r-project.org mailing list 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] using edit to extract codes from vignette failed
On 08/09/2014 12:48 PM, Duncan Murdoch wrote: On 08/09/2014 12:35 PM, Duncan Murdoch wrote: On 08/09/2014 12:21 PM, PO SU wrote: Tks for correcting me not using the file argument, but the codes you supply seem still not work. edit(vignette(grobs,package = grid)) can't work. I am using win7, the latest version of Rstudio which using R.3.1.1.The error is: Error in editor(file = file, title = title) : argument name is missing, with no default That appears to be an RStudio bug. edit(vignette(grobs,package = grid)) works fine in R. You should report it to them. No need to do that, I've just done so. Duncan Murdoch Yes, confirmed: RStudio sets the editor option to a function that requires a name argument, but file.edit doesn't provide one. The documentation for that editor option is pretty weak, but I'd still say this is an RStudio bug. Duncan Murdoch Duncan Murdoch -- PO SU mail: desolato...@163.com Majored in Statistics from SJTU At 2014-09-08 05:46:39, Karl Ropkins k.ropk...@its.leeds.ac.uk wrote: Try: edit(vignette(grobs,package = grid)) (edit is a method. It looks at the class of the first entry, name, to identify which method to use. See ?edit. You want it to use edit.vignette, so you need to drop 'file=' so you pass the vignette to edit as the first argument or name=. Then edit will pass it to edit.vignette and it'll work. Or go direct: edit.vignette(vignette(grobs,package = grid)). See ?vignette. Maybe the use of name as the first argument of a method is a little misleading? But you can work out what is going if you work through the help documentation.) Karl Message: 9 Date: Sun, 7 Sep 2014 17:06:44 +0800 (CST) From: PO SU rhelpmaill...@163.com To: R. Help r-help@r-project.org Subject: [R] using edit to extract codes from vignette failed Message-ID: 4d3c1c8a.1c96.1484f5d8d31.coremail.rhelpmaill...@163.com Content-Type: text/plain; charset=UTF-8 Dear expeRts, ? ? When i using the following code, i get a error as follows: ?edit(file=vignette(grobs,package = grid)) Error in edit.vignette(file = vignette(grobs, package = grid)) :? ? argument name is missing, with no default I investigated edit function, but still can't ?get codes from a vignette, May you help me? -- PO SU mail: desolato...@163.com Majored in Statistics from SJTU __ R-help@r-project.org mailing list 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 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 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] ggplot - boxplot and points split by two factors
Use geom_jitter() instead of geom_point On Mon, Sep 8, 2014 at 12:37 PM, Tom Wright t...@maladmin.com wrote: ggplot(data,aes(x = z1, y = x, fill=x2)) + geom_boxplot() + geom_point(alpha=0.5, position=position_jitterdodge(jitter.width=0.1), aes(group=x2)) On Mon, 2014-09-08 at 13:10 -0400, Tom Wright wrote: Hi, I'm trying to create a boxplot overlayed with points where the data is split by two factor groups. So far: x1-factor(rep(LETTERS[1:4],5)) x2-factor(rep(letters[1:2],10)) z-runif(20,0,10) data-data.frame(x1=x1,x2=x2,z=z) ggplot(data,aes(x=x1,y=z,fill=x2)) + geom_boxplot() + geom_point() Obviously I'd also like to separate the points to overlay the relevant boxplots. Any hints gratefully received. Thanks, Tom __ R-help@r-project.org mailing list 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 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] Parliament Seats Graph
Hi, Is there any package (or homegrown function) that can produce Parliament Seats Graph? I'm referring to the nice looking concentric half circles of colored seats as seen on Wikipedia (for example). I can pretty easily plot the points and color them. But I can't group the colored points in sectors, as seen on the example. Example: http://en.wikipedia.org/wiki/Verkhovna_Rada#mediaviewer/File:Fractions_of_the_Parliament_of_Ukraine.svg Found here (on the right, a bit down): http://en.wikipedia.org/wiki/Verkhovna_Rada TIA __ R-help@r-project.org mailing list 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] splitting data
Dear R members, I have this data frame of 100 years in the following format yearmonth day A B C D where A,B,C and D are item number sold each day. I am trying 1-split the data w.r.t the monthly values for each year 2-then, sum them up I am pasting here just a part of data to make it more clearer structure(list(year = c(1961, 1961, 1961, 1961, 1961, 1961, 1961, 1961, 1961, 1961, 1961, 1961), month = c(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1), day = 1:12, A = 1:12, B = 3:14, C = 6:17, D = 16:27), .Names = c(year, month, day, A, B, C, D), row.names = c(NA, 12L), class = data.frame) I initially tried to use dcast command but for no use. Your kind help is needed. Thanks in advance Eliza [[alternative HTML version deleted]] __ R-help@r-project.org mailing list 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] Using R to get updated access token on FB Graph API?
Hi, R users, Is it possible to use R to obtain access token to Facebook API automatically? The access token generated in Facebook Graph API expires very soon so I'd like to use R to generate new access token and grab it and save it to a variable automatically every 60 days. Is it possible? If so, which packages should I use? Could someone shed light? Thanks! [[alternative HTML version deleted]] __ R-help@r-project.org mailing list 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] splitting data
?tapply e.g. with(yourdata, tapply(A,list(year,month),sum,simplify=FALSE)) This assumes sum them up means summing each column separately. You were unclear as to exactly what you meant by this. -- Bert Bert Gunter Genentech Nonclinical Biostatistics (650) 467-7374 Data is not information. Information is not knowledge. And knowledge is certainly not wisdom. Clifford Stoll On Mon, Sep 8, 2014 at 12:08 PM, eliza botto eliza_bo...@hotmail.com wrote: Dear R members, I have this data frame of 100 years in the following format yearmonth day A B C D where A,B,C and D are item number sold each day. I am trying 1-split the data w.r.t the monthly values for each year 2-then, sum them up I am pasting here just a part of data to make it more clearer structure(list(year = c(1961, 1961, 1961, 1961, 1961, 1961, 1961, 1961, 1961, 1961, 1961, 1961), month = c(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1), day = 1:12, A = 1:12, B = 3:14, C = 6:17, D = 16:27), .Names = c(year, month, day, A, B, C, D), row.names = c(NA, 12L), class = data.frame) I initially tried to use dcast command but for no use. Your kind help is needed. Thanks in advance Eliza [[alternative HTML version deleted]] __ R-help@r-project.org mailing list 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 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] splitting data
On Mon, Sep 8, 2014 at 2:08 PM, eliza botto eliza_bo...@hotmail.com wrote: Dear R members, I have this data frame of 100 years in the following format yearmonth day A B C D where A,B,C and D are item number sold each day. I am trying 1-split the data w.r.t the monthly values for each year 2-then, sum them up I am pasting here just a part of data to make it more clearer structure(list(year = c(1961, 1961, 1961, 1961, 1961, 1961, 1961, 1961, 1961, 1961, 1961, 1961), month = c(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1), day = 1:12, A = 1:12, B = 3:14, C = 6:17, D = 16:27), .Names = c(year, month, day, A, B, C, D), row.names = c(NA, 12L), class = data.frame) I initially tried to use dcast command but for no use. Your kind help is needed. Thanks in advance Eliza I'm not sure if I really understand what you want, but perhaps this? library(dplyr); summarize(group_by(data,year,month),sum(A),sum(B),sum(C),sum(D)); If you are SQL oriented this is equivalent to the SQL query: select year, month, sum(A), sum(B), sum(C), sum(D) from data group by year, month ; -- There is nothing more pleasant than traveling and meeting new people! Genghis Khan Maranatha! John McKown __ R-help@r-project.org mailing list 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] splitting data
On Sep 8, 2014, at 12:08 PM, eliza botto wrote: Dear R members, I have this data frame of 100 years in the following format yearmonth day A B C D where A,B,C and D are item number sold each day. I am trying 1-split the data w.r.t the monthly values for each year 2-then, sum them up I am pasting here just a part of data to make it more clearer structure(list(year = c(1961, 1961, 1961, 1961, 1961, 1961, 1961, 1961, 1961, 1961, 1961, 1961), month = c(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1), day = 1:12, A = 1:12, B = 3:14, C = 6:17, D = 16:27), .Names = c(year, month, day, A, B, C, D), row.names = c(NA, 12L), class = data.frame) I initially tried to use dcast command but for no use. This is typical use for base function aggregate: with( dfrm, aggregate(dfrm[4:7], dfrm[1:2], FUN=sum)) year month A B C D 1 1961 1 78 102 138 258 [[alternative HTML version deleted]] Please stop posting in plain text. (You have already been asked multiple times.) -- David Winsemius Alameda, CA, USA __ R-help@r-project.org mailing list 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] splitting data
On Sep 8, 2014, at 2:01 PM, David Winsemius wrote: On Sep 8, 2014, at 12:08 PM, eliza botto wrote: This is typical use for base function aggregate: with( dfrm, aggregate(dfrm[4:7], dfrm[1:2], FUN=sum)) year month A B C D 1 1961 1 78 102 138 258 [[alternative HTML version deleted]] Please stop posting in plain text. (You have already been asked multiple times.) I have now been asked by three readers if I really meant this. No, I did not I mean that... Eliza, stop posting in HTML and start posting in plain text. -- David Winsemius Alameda, CA, USA __ R-help@r-project.org mailing list 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] Problems with bstats::white.test()
Hi, I am trying to test for heteroskedascity in an OLS model, but I am not able to run the white.test() if the model has dummy variables built from factors. Any suggestions? Please find a reproducible code below: myswiss - swiss myswiss$fert - ifelse( myswiss$Fertility70, High,Low) myswiss$fert - factor(myswiss$fert) str(myswiss) mod1 - lm(Infant.Mortality ~ fert, data=myswiss) library(bstats) bptest(mod1) white.test(mod1) myswiss$fertlow - ifelse( myswiss$Fertility70, 0,1) mod2 - lm(Infant.Mortality ~ fertlow, data=myswiss) library(bstats) bptest(mod2) white.test(mod2) Results: bptest(mod2) studentized Breusch-Pagan test for homoscedasticity data: mod2 BP = 2e-04, df = 1, p-value = 0.989 white.test(mod2) White test for constant variance data: White = 2e-04, df = 1, p-value = 0.989 bptest(mod1) studentized Breusch-Pagan test for homoscedasticity data: mod1 BP = 2e-04, df = 1, p-value = 0.989 white.test(mod1) Error in `contrasts-`(`*tmp*`, value = contr.funs[1 + isOF[nn]]) : contrasts can be applied only to factors with 2 or more levels In addition: Warning message: In Ops.factor(fert, fert) : * not meaningful for factors __ R-help@r-project.org mailing list 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] KDE routines for data that is aggregated
Hello, Couldn't think of a better subject line. Rather than a matrix like x,y ..,.. .,.. I have a matrix like x,y,n, ..,..,.., ..,..,.. and so on. Also, sum(n) is roughly few hundred million. The number of rows is 1MM Are they routines to fit a 2d kde estimate to data provided in this form? I can sample from the data according to weights given by 'n' but i am curious if there is something that can use all the data when given a structure of this form. Regards Saptarshi [[alternative HTML version deleted]] __ R-help@r-project.org mailing list 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] using edit to extract codes from vignette failed
OK, i get it, i should set the editor argument , i don't know how to report a bug to Rstudio, may you do that ? -- PO SU mail: desolato...@163.com Majored in Statistics from SJTU At 2014-09-09 00:41:33, William Dunlap wdun...@tibco.com wrote: Complain to the RStudio people - RStudio defines its own options(editor) which is not completely compatible with R's option(editor=internal). If you set options(editor=internal) in RStudio then you can look at the code in the vignette. (I tried with last year's RStudio 0.98.501 and this may have been fixed by now.) Bill Dunlap TIBCO Software wdunlap tibco.com On Mon, Sep 8, 2014 at 9:21 AM, PO SU rhelpmaill...@163.com wrote: Tks for correcting me not using the file argument, but the codes you supply seem still not work. edit(vignette(grobs,package = grid)) can't work. I am using win7, the latest version of Rstudio which using R.3.1.1.The error is: Error in editor(file = file, title = title) : argument name is missing, with no default -- PO SU mail: desolato...@163.com Majored in Statistics from SJTU At 2014-09-08 05:46:39, Karl Ropkins k.ropk...@its.leeds.ac.uk wrote: Try: edit(vignette(grobs,package = grid)) (edit is a method. It looks at the class of the first entry, name, to identify which method to use. See ?edit. You want it to use edit.vignette, so you need to drop 'file=' so you pass the vignette to edit as the first argument or name=. Then edit will pass it to edit.vignette and it'll work. Or go direct: edit.vignette(vignette(grobs,package = grid)). See ?vignette. Maybe the use of name as the first argument of a method is a little misleading? But you can work out what is going if you work through the help documentation.) Karl Message: 9 Date: Sun, 7 Sep 2014 17:06:44 +0800 (CST) From: PO SU rhelpmaill...@163.com To: R. Help r-help@r-project.org Subject: [R] using edit to extract codes from vignette failed Message-ID: 4d3c1c8a.1c96.1484f5d8d31.coremail.rhelpmaill...@163.com Content-Type: text/plain; charset=UTF-8 Dear expeRts, ? ? When i using the following code, i get a error as follows: ?edit(file=vignette(grobs,package = grid)) Error in edit.vignette(file = vignette(grobs, package = grid)) :? ? argument name is missing, with no default I investigated edit function, but still can't ?get codes from a vignette, May you help me? -- PO SU mail: desolato...@163.com Majored in Statistics from SJTU __ R-help@r-project.org mailing list 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 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 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] How to use multi paragraph comment like /* and */ in cpp?
Dear expeRts, I find it's terrible when i want to comment multi paragraph (e.g. a 30 lines function) , i have to comment each line with #, is there any good way to do that ? I investgate it, but found no easy way, may you help me ? -- PO SU mail: desolato...@163.com Majored in Statistics from SJTU __ R-help@r-project.org mailing list 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] How to use multi paragraph comment like /* and */ in cpp?
There are no multi line comment markers in R. However, since you are always referring to RStudio you might want to look into roxygen, since their editor supports that tool. I would also suggest making more functions that are smaller. --- Jeff NewmillerThe . . Go Live... DCN:jdnew...@dcn.davis.ca.usBasics: ##.#. ##.#. Live Go... Live: OO#.. Dead: OO#.. Playing Research Engineer (Solar/BatteriesO.O#. #.O#. with /Software/Embedded Controllers) .OO#. .OO#. rocks...1k --- Sent from my phone. Please excuse my brevity. On September 8, 2014 7:49:32 PM PDT, PO SU rhelpmaill...@163.com wrote: Dear expeRts, I find it's terrible when i want to comment multi paragraph (e.g. a 30 lines function) , i have to comment each line with #, is there any good way to do that ? I investgate it, but found no easy way, may you help me ? -- PO SU mail: desolato...@163.com Majored in Statistics from SJTU __ R-help@r-project.org mailing list 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 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] How to use multi paragraph comment like /* and */ in cpp?
A workaround is to escape the evaluation of the lines. For example: tt - 0 while(tt 0){ cat('rr\n') } Regards, Pascal On Tue, Sep 9, 2014 at 11:49 AM, PO SU rhelpmaill...@163.com wrote: Dear expeRts, I find it's terrible when i want to comment multi paragraph (e.g. a 30 lines function) , i have to comment each line with #, is there any good way to do that ? I investgate it, but found no easy way, may you help me ? -- PO SU mail: desolato...@163.com Majored in Statistics from SJTU __ R-help@r-project.org mailing list 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. -- Pascal Oettli Project Scientist JAMSTEC Yokohama, Japan __ R-help@r-project.org mailing list 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-es] problema con los cambios de marcas temporales en el eje X
Hola, Ya, me lo he imaginado al poco de enviarlo... De esta forma sí que se respeta la separación por fecha en el eje X... #-- library(lubridate) datIn$xlabels - as.Date(dmy(datIn$fecha), format=%Y-%m-%d) datIn$mes - month(dmy(datIn$fecha), label=T, abbr=T) datIn$anio - year(dmy(datIn$fecha)) datIn$mesanio - paste(datIn$mes,-,datIn$anio,sep=) plot ( datIn$xbar ~ datIn$xlabels ,ylim=c(400,660), xaxt=n, type=b, pch=19,cex=1, ,axes=F ) axis.Date(1,at=datIn$xlabels,format=%b-%y, labels=datIn$mesanio, las=2, cex.axis=0.5) axis(2) box() arrows( x0=datIn$xlabels,y0=datIn$lci ,x1=datIn$xlabels,y1=datIn$lcs ,angle=90,code=3,length=.1 ) #-- [image: Imágenes integradas 1] El 8 de septiembre de 2014, 13:35, Carlos Fernández-Delgado ba1fe...@uco.es escribió: Muchísimas gracias Carlos, de verdad que te agradezco la ayuda, pero no es lo que voy buscando. Quiero colocar en el eje de abscisas la secuencia temporal de los meses, es decir, agosto septiembre, octubre, etc… pero no las fechas de las toma de datos, sino que aparezca la marca de un mes, y la siguiente marca sea la del siguiente mes, etc…, y además que las muestras estén separadas de acuerdo con la fecha que les corresponde, en la que me envías las fechas están ahora equidistantes. He hecho una simulación de la gráfica que voy buscando en la imagen adjunta. Muchas gracias Carlos El 08/09/2014, a las 11:43, Carlos Ortega c...@qualityexcellence.es escribió: Hola, En vez de utilizar un eje X de tipo Date, prefiero ajustarlo utilizando las fechas como si fuesen strings. Mira si esto es lo que buscabas... #--- datIn - read.csv(Libro1.csv, header=T, sep=;, dec=,) library(lubridate) datIn$mes - month(dmy(datIn$fecha), label=T, abbr=T) datIn$anio - year(dmy(datIn$fecha)) xlabels - paste(datIn$mes,-,datIn$anio,sep=) par(oma=c(4,2,1,1)) plot(datIn$xbar, axes=F, type=b, pch=19, ylim=c(400,650), xlab=, ylab=xbar) axis(1,at=1:length(datIn$xbar), labels=xlabels,cex.lab=0.5, las=2) axis(2) box() datIn$xorig - 1:dim(datIn)[1] arrows( x0=datIn$xorig, y0=datIn$lci ,x1=datIn$xorig, y1=datIn$lcs, ,angle=90, code=3, length=0.1 ) mtext(Fechas, side=1, line=1, outer=T) #--- Rplot.png Saludos, Carlos Ortega www.qualityexcellence.es El 8 de septiembre de 2014, 10:57, Carlos Fernández-Delgado ba1fe...@uco.es escribió: Muchas gracias Carlos, previo a mi correo, entre las pruebas que hice estaba una parecida a la que apuntas de la siguiente manera: attach (Libro1) plot (xbar~as.Date(fechas,%d/%m/%y), ylim=c(400,660), xaxt=n, type=b, pch=19,cex=1) xlabels-strptime(fecha,format=%d/%m/%Y) axis.Date (1,at=xlabels,format=%b-%y) arrows(x0=as.Date(fechas,%d/%m/%y),y0=lci, x1=as.Date(fechas,%d/%m/%y),y1=lcs,angle=90,code=3,length=.1) Pero esta me saca las etiquetas que yo tengo (ver grafica adjunta), sin embargo lo que voy buscando es colocar las marcas de los meses enteros (con 30 o 31 días según corresponda) en donde se ha realizado el estudio a lo largo del eje x. Muchas gracias por tu ayuda. Carlos El 08/09/2014, a las 00:05, Carlos Ortega c...@qualityexcellence.es escribió: Hola, Una forma de hacerlo es: 1. incluyes un parámetro en plot(..., axes=F) y así indicas que no quieres pintar automáticamente los ejes. 2. Y ahora construyes el eje x con la función axis(). 3. Dentro de axis(), dirás cada cuánto quieres pintar una marca (parámetro at) y qué quieres incluir en la marca (parámetro label). Para ver un ejemplo, mira el ejemplo que aparece en la ayuda de la función axis(). Saludos, Carlos Ortega www.qualityexcellence.es El 7 de septiembre de 2014, 20:46, Carlos Fernández-Delgado ba1fe...@uco.es escribió: Estimada Comunidad, solicito vuestra ayuda en un tema quizás un poco tonto, pero no logro dar con la tecla. Estoy intentando hacer una gráfica de la evolución temporal de una variable (xbar) a lo largo del tiempo. La secuencia que he hecho es la siguiente: attach(Libro1) plot (xbar~as.Date(fechas,%d/%m/%y), ylim=c(400,650), type=b, pch=19,cex=1) arrows(x0=as.Date(fechas,%d/%m/%y),y0=lci,x1=as.Date(fechas,%d/%m/%y),y1=lcs,angle=90,code=3,length=.1) El problema es que la gráfica emitida por R me saca en abscisas una serie de meses que me los coloca por defecto (ver gráfica adjunta) y lo que yo quiero es poner marcas mensuales desde agosto de 2013 hasta mayo 2014, incluido el cambio de año (ya sea dic’13 o ene’14), pero por mucho que lo intento no me sale. ¿Podéis ayudarme?. Muchas gracias por adelantado y un cordial saludo Carlos ___ R-help-es mailing list R-help-es@r-project.org https://stat.ethz.ch/mailman/listinfo/r-help-es -- Saludos, Carlos Ortega www.qualityexcellence.es