Re: [R] Switching log(J) to log(J+1) to avoid log(0) in HAR-RVJ model

2012-07-19 Thread Joshua Ulrich
Cross-posted on Stack Overflow: http://stackoverflow.com/q/11567745/271616 -- Joshua Ulrich | FOSS Trading: www.fosstrading.com On Thu, Jul 19, 2012 at 12:23 PM, cursethiscure wrote: > I am working with xts dependent data, and my code is as follows (the problem > is explained throughout): > >

Re: [R] switching off commands within character vector

2011-09-20 Thread Marion Wenty
hello, thank you for your answer! yes, now it is working! marion 2011/9/19 Duncan Murdoch > On 11-09-19 7:30 AM, Marion Wenty wrote: > >> Hello, >> >> could someone help me with this problem?: >> >> I would like to create a latex-script inside of a character vector in >> order >> to being able t

Re: [R] switching off commands within character vector

2011-09-19 Thread Duncan Murdoch
On 11-09-19 7:30 AM, Marion Wenty wrote: Hello, could someone help me with this problem?: I would like to create a latex-script inside of a character vector in order to being able to compilate it within latex in the end. if i try the following commands: l1<- "Hello world" latexscript<- paste(

[R] switching off commands within character vector

2011-09-19 Thread Marion Wenty
Hello, could someone help me with this problem?: I would like to create a latex-script inside of a character vector in order to being able to compilate it within latex in the end. if i try the following commands: l1 <- "Hello world" latexscript <- paste("\c",l1,"\c") ... I get an error message

[R] switching y-axis to x-axis for qqmath

2011-02-04 Thread Anderson, Chris
This is the qqmath example from the lattice package. I added the scales to the example. I would like to switch the axis and not sure how? Meaning I would like the "height" on the x-axis and the probability on the y-axis. Will you show me the correct syntax for this switch thanks. qqmath(~ hei

Re: [R] switching only axis off in plot

2010-11-11 Thread David Winsemius
On Nov 12, 2010, at 12:50 AM, sachinthaka.abeyward...@allianz.com.au wrote: Hi R, In the following code my x-axis is formatted in month format. Which Im happy with. The y-axis is what I want to re-format with something else. Did you mean x-axis? My question is, is it possible just to

Re: [R] switching only axis off in plot

2010-11-11 Thread Dennis Murphy
Hi: Do you mean to leave the x-axis as is and redo the y? If so, use graphical parameter yaxt: x <- y <- 1:10 plot(x, y, yaxt = 'n') axis(2, at = ..., lab = ..., ...)# fill in the blanks In case it matters, xaxt = 'n' suppresses the x-axis labels but not the y labels. HTH, Dennis On Thu,

[R] switching only axis off in plot

2010-11-11 Thread sachinthaka . abeywardana
Hi R, In the following code my x-axis is formatted in month format. Which Im happy with. The y-axis is what I want to re-format with something else. My question is, is it possible just to switch off the xaxis in plot function (see below). If not how do you get the months to show up as FEB-, M

Re: [R] switching elements of a vector

2010-05-24 Thread Bert Gunter
AM To: r-help@r-project.org Subject: [R] switching elements of a vector Hi, I would like to receive help for the following matter: If I'm dealing with a numeric vectors containing increasing elements. i.e. a<-c(1,2,2,2,2,3,3,3,4,4,4,5,5,6,7,7,7) There exist an efficient way to o

Re: [R] switching elements of a vector

2010-05-24 Thread speretti
it works as well! -- View this message in context: http://r.789695.n4.nabble.com/switching-elements-of-a-vector-tp2228373p2228485.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/m

Re: [R] switching elements of a vector

2010-05-24 Thread speretti
Thank you ! Great answers...now it seems very easy... As usual...a the obviousness of a solution depends on how you face the problem... Thank you for help me in find the good approaches... -- View this message in context: http://r.789695.n4.nabble.com/switching-elements-of-a-vector-tp2228373p2

Re: [R] switching elements of a vector

2010-05-24 Thread Gabor Grothendieck
Try this: > which(diff(a) > 0) + 1 [1] 2 6 9 12 14 15 On Mon, May 24, 2010 at 6:02 AM, speretti wrote: > > Hi, > > I would like to receive help for the following matter: > > If I'm dealing with a numeric vectors containing increasing elements. > i.e. > > a<-c(1,2,2,2,2,3,3,3,4,4,4,5,5,6,7,7,

Re: [R] switching elements of a vector

2010-05-24 Thread schuster
Hi, is this what you need? b <- c(NA, a[1:length(a)-1]) # shift values of a one step to the right which(a-b == 1) On Monday 24 May 2010 12:02:55 pm speretti wrote: > Hi, > > I would like to receive help for the following matter: > > If I'm dealing with a numeric vectors containing increasin

Re: [R] switching elements of a vector

2010-05-24 Thread Chuck Cleland
On 5/24/2010 6:02 AM, speretti wrote: > Hi, > > I would like to receive help for the following matter: > > If I'm dealing with a numeric vectors containing increasing elements. > i.e. > > a<-c(1,2,2,2,2,3,3,3,4,4,4,5,5,6,7,7,7) > > There exist an efficient way to obtain an vector that indicate

[R] switching elements of a vector

2010-05-24 Thread speretti
Hi, I would like to receive help for the following matter: If I'm dealing with a numeric vectors containing increasing elements. i.e. a<-c(1,2,2,2,2,3,3,3,4,4,4,5,5,6,7,7,7) There exist an efficient way to obtain an vector that indicates the position of the changing element of "a"? In this ca

Re: [R] Switching Axis in Time Series plotting

2010-02-12 Thread Peter Ehlers
Assuming that you are using the xts package, try this: data(sample_matrix) sample.xts <- as.xts(sample_matrix) open <- as.vector(sample.xts[,1]) month <- as.Date(time(sample.xts)) plot(open, month, type="l") -Peter Ehlers JSmaga wrote: Basically it works, but I use the xts format and the

Re: [R] Switching Axis in Time Series plotting

2010-02-11 Thread JSmaga
Basically it works, but I use the xts format and the axis are messed up. plot(c(time(ser)) ~ c(ser), type = "l") Error in as.POSIXct.default(x) : do not know how to convert 'x' to class "POSIXlt" I don't know why do you have any idea? Besides, why do you use the c(...) function in your code

Re: [R] Switching Axis in Time Series plotting

2010-02-11 Thread Gabor Grothendieck
Try this using the builtin ts series, Nile: year <- c(time(Nile)) Nile. <- c(Nile) plot(year ~ Nile., type = "l") On Thu, Feb 11, 2010 at 10:19 PM, JSmaga wrote: > > Hi guys, > > I would like to know if it is possible to switch the X Y axis when plotting > a time series. > > Precisely, what I w

[R] Switching Axis in Time Series plotting

2010-02-11 Thread JSmaga
Hi guys, I would like to know if it is possible to switch the X Y axis when plotting a time series. Precisely, what I would like to do is having the dates on the Y axis, and the numbers on the X axis. I know it is pretty uncommon but it would help me a lot! Thanks, Jeremie -- View this messa

[R] Switching

2010-02-11 Thread JSmaga
-- View this message in context: http://n4.nabble.com/Switching-tp1478064p1478064.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posti

Re: [R] Switching entries in vector in by groups of two

2008-06-27 Thread Peter Dalgaard
Henrique Dallazuanna wrote: > Try this: > > ave(X, rep(1:(length(X)/2), each = 2), FUN=rev) > > Also, ix <- 2*rep(1:(length(X)/2-1), each = 2) + 2:1 X[ix] or ix <- seq_along(X) + c(1,-1) X[ix] > On Fri, Jun 27, 2008 at 11:11 AM, David Afshartous < > [EMAIL PROTECTED]> wrote: > > >> All, >>

Re: [R] Switching entries in vector in by groups of two

2008-06-27 Thread David Afshartous
Thanks Henrique, Marc, and Gabor! On 6/27/08 10:17 AM, "Henrique Dallazuanna" <[EMAIL PROTECTED]> wrote: > Try this: > > ave(X, rep(1:(length(X)/2), each = 2), FUN=rev) > > On Fri, Jun 27, 2008 at 11:11 AM, David Afshartous <[EMAIL PROTECTED]> > wrote: >> >> All, >> >> I have a long vector

Re: [R] Switching entries in vector in by groups of two

2008-06-27 Thread Marc Schwartz
on 06/27/2008 09:17 AM Marc Schwartz wrote: on 06/27/2008 09:11 AM David Afshartous wrote: All, I have a long vector that contains an even number of entries. I'd like to switch the 1st and 2nd entry, the 3rd and 4th, and so on, without writing a loop. This code works: X = c(8, 10, 6, 3, 20,

Re: [R] Switching entries in vector in by groups of two

2008-06-27 Thread Henrique Dallazuanna
Try this: ave(X, rep(1:(length(X)/2), each = 2), FUN=rev) On Fri, Jun 27, 2008 at 11:11 AM, David Afshartous < [EMAIL PROTECTED]> wrote: > > All, > > I have a long vector that contains an even number of entries. I'd like to > switch the 1st and 2nd entry, the 3rd and 4th, and so on, without writ

Re: [R] Switching entries in vector in by groups of two

2008-06-27 Thread Marc Schwartz
on 06/27/2008 09:11 AM David Afshartous wrote: All, I have a long vector that contains an even number of entries. I'd like to switch the 1st and 2nd entry, the 3rd and 4th, and so on, without writing a loop. This code works: X = c(8, 10, 6, 3, 20, 1) index = c(2,1,4,3,6,5) X[index] But for a

Re: [R] Switching entries in vector in by groups of two

2008-06-27 Thread Gabor Grothendieck
You can do it without and index like this: c(matrix(X, 2)[2:1,]) or if you need the index for some purpose apart from this: c(matrix(seq_along(X), 2)[2:1,]) On Fri, Jun 27, 2008 at 10:11 AM, David Afshartous <[EMAIL PROTECTED]> wrote: > > All, > > I have a long vector that contains an even numb

[R] Switching entries in vector in by groups of two

2008-06-27 Thread David Afshartous
All, I have a long vector that contains an even number of entries. I'd like to switch the 1st and 2nd entry, the 3rd and 4th, and so on, without writing a loop. This code works: X = c(8, 10, 6, 3, 20, 1) index = c(2,1,4,3,6,5) X[index] But for a long list is there a way to generate the index?

Re: [R] Switching the order of legend boxes in a lattice bar graph

2008-06-13 Thread Markus Gesmann
: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Bob Green Sent: 13 June 2008 12:14 To: r-help@r-project.org Subject: [R] Switching the order of legend boxes in a lattice bar graph I suspect there is a simple solution to this problem, but have been unable to find it. Below is some code t

[R] Switching the order of legend boxes in a lattice bar graph

2008-06-13 Thread Bob Green
I suspect there is a simple solution to this problem, but have been unable to find it. Below is some code that I have run to create 3 lattice graphs. I have been asked to change the legend so that the 'No' and dark blue are above "Y" and light blue in the legend to mirror the stacked bars in