[R] Plotting zoo objects with chron axis

2013-08-09 Thread Manta
Dear all, I have a problem which I'm not to fix. I have the following two series: a=structure(c(33242.5196150509, 34905.8434338503, 38490.6957848689, 38747.0287172129, 38919.1028597142, 39026.3956586941, 38705.5344288997, 38545.6274379387, 38651.2079354205, 38748.2769580121), index =

[R] Comma separated vector

2013-05-17 Thread Manta
Hi all, I have a vector of numbers, and to be able to pass it to RMySQL and use the IN clause I need to have this vector to be a single list numeric and comma separated. I saw the post below but it is about strings, which I do not need (I cannot pass strings in this SQL query, I need something

Re: [R] Possible bug in 'data.table'

2013-05-15 Thread Manta
As somebody else replied (but for some reason did not get through it) the solution to this is to convert the variable TIME3 from POSIXlt to POSIXct. It works like a charm. Nevertheless, there is a bug in that R should give me a warning/error message, and not simply crash. I reported the bug to

[R] Possible bug in 'data.table'

2013-05-14 Thread Manta
Dear R users, I may have found a bug in the function 'data.table'. I have a similar question as the one in this post: http://stackoverflow.com/questions/3367190/aggregate-and-weighted-mean-in-r I have a dataset with assets, quantity traded, date and time. I would like to calculate the value

[R] Superimpose exponential density function to histogram

2013-05-07 Thread Manta
Dear all, I have a large vector of durations (in seconds) and I create an histogram as follows: hist(durations,breaks=500,xlim=c(0,2000),main=,xlab=Duration (Seconds),ylab=Frequency (%),prob=TRUE) Next, I would like to superimpose the exponential distribution with the maximum likelihood

Re: [R] Superimpose exponential density function to histogram

2013-05-07 Thread Manta
Cant believe it was that -- View this message in context: http://r.789695.n4.nabble.com/Superimpose-exponential-density-function-to-histogram-tp4666468p4666480.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org

[R] Write date class as number of days from 1970

2013-05-03 Thread Manta
Dear all, I have a dataset with one column being of class Date. When I write the output, I would like that column being written as number of days from 1970-01-01. I could not find anywhere a way to do it. Thanks, Marco -- View this message in context:

Re: [R] inefficient ifelse() ?

2012-03-28 Thread Manta
I have a similar problem. I have a dataset and an element. If the element is equal to YY, I want to take the first column of the dataset, otherwise I want to take the second column. The following does not work, as it only evaluates the first element. Any idea? a=c(AAAXXX,BBBXXX)

Re: [R] Positioning text in top left corner of plot

2012-02-07 Thread Manta
Dear all, another questions related to zoo plotting. I would like to do as in the subject. Here a reproducible code: library(zoo) par(mfrow=c(2,1) plot(zoo(seq(1:10),as.Date(seq(1:10),origin=1970-01-01)),xlab=,ylab=,main=Value,las=1) mtext(EUR billions,adj=0,cex=0.7)

Re: [R] Positioning text in top left corner of plot

2012-02-07 Thread Manta
Thanks, although I still have a couple of questions: 1. What is the line parameter? I could not find it in the manual... 2. How does exactly work the adj parameter when giving two different values? -- View this message in context:

Re: [R] Positioning text in top left corner of plot

2012-02-07 Thread Manta
Thanks, mtext with option 'line' does the trick. I could not see that option in my version of R, but it appeared when I installed it again. -- View this message in context: http://r.789695.n4.nabble.com/Positioning-text-in-top-left-corner-of-plot-tp831723p4365088.html Sent from the R help

Re: [R] R for windows 64 bit

2012-01-12 Thread Manta
Dear all, I know this may have been already discussed, but I could not find a solution. I am using R 13.2 64 bit on a 64 bit machine dual core. I'm fitting a Cox proportional model to a matrix 1e06x7. Before starting the model fitting I set memory.size(max=1) and I do a clean of the garbage

Re: [R] R for windows 64 bit

2012-01-12 Thread Manta
Dear Uwe, many thanks for your message. To reply to your questions, as you imagined I cannot provide a reproducible example. In addition, I cannot expand the memory, as I'm working on a virtual desktop. At any rate, the program is really on 'standstill' as the memory usage is flat and does not

Re: [R] R for windows 64 bit

2012-01-12 Thread Manta
It was already done, as I reduced the dataset at the minimum I could. I really need to solve this issue somehow. -- View this message in context: http://r.789695.n4.nabble.com/R-for-windows-64-bit-tp1011346p4289419.html Sent from the R help mailing list archive at Nabble.com.

[R] 45 degress line in zoo plot

2011-09-24 Thread Manta
Dear all, I am not able to draw a 45 degrees line in a zoo plot. The time index is a sequence of 15 min bins from 7 in the morning to 18:45 in the evening. Thanks, Marco -- View this message in context: http://r.789695.n4.nabble.com/45-degress-line-in-zoo-plot-tp3839182p3839182.html Sent from

Re: [R] SetInternet2, RCurl and proxy

2011-03-01 Thread Manta
Dear all, I am facing a problem. I am trying to install packages using a proxy, but I am not able to call the setInternet2 function, either with the small or capital s. What package do I have to call then? And, could there be a reason why this does not function? Thanks, Marco -- View this

Re: [R] SetInternet2, RCurl and proxy

2011-03-01 Thread Manta
It says the function does not exist. The version is around 2.8, cant check right now. Is it because it's an older version? If so, is there any way to do it in a different way then? -- View this message in context: http://r.789695.n4.nabble.com/SetInternet2-RCurl-and-proxy-tp3248576p3330244.html

[R] Plot two zoo object with different indexes

2010-11-23 Thread Manta
Dear R community, I have the following two zoo objects: MONTHLY CPI plot(z) par(usr) [1] 1977.76333 2011.15333 70.39856 227.03744 z=zooreg(cpius$Value,as.yearmon(1979-11),frequency=12) str(z) ‘zooreg’ series from Nov 1979 to Oct 2010 Data: num [1:372] 76.2 77 77.8 78.5 79.5 80.3 81.1

Re: [R] Plot two zoo object with different indexes

2010-11-23 Thread Manta
Thanks as always Gabor. What I was looking for was to plot the daily series on the same graph of the monthly using the command 'lines'. That is why I wanted to change the index of one of the two, as it seems the reason why at the moment it is not working! -- View this message in context:

Re: [R] Plot two zoo object with different indexes

2010-11-23 Thread Manta
Ok this helps definitely! But I still would like to know 1. How to change from one index to another within a 'zoo' object 2. How to import using as index 'Date' a monthly series (code below). The series in the US CPI from November 1979 to October 2010. z - zoo(cpius$Value,

Re: [R] Plot two zoo object with different indexes

2010-11-23 Thread Manta
Gabor Grothendieck wrote: 2. How to import using as index 'Date' a monthly series (code below). The series in the US CPI from November 1979 to October 2010. z - zoo(cpius$Value, as.Date(1979-11-30)+0:372) Assuming the question is how to turn this daily series into a monthly series:

Re: [R] Plot two zoo object with different indexes

2010-11-23 Thread Manta
Gabor Grothendieck wrote: How to convert a monthly series to a daily series has already been illustrated in multiple ways in this thread. Fair enough. However, my last question was different. I simply want to know if there is a simple neat way to import a monthly series as a zoo object

Re: [R] Ordeing Zoo object

2010-11-22 Thread Manta
And how about if I want to order the series from the smallest to the largest value, keeping the date index in order to see when the values were predominantly negative etc... Thanks, Marco -- View this message in context: http://r.789695.n4.nabble.com/Ordeing-Zoo-object-tp955868p3054192.html

Re: [R] Chron object in time series plot

2010-10-27 Thread Manta
Ok, so you may be right, but I do not understand why ;) The commands you suggested are applied to temp_plot, where temp_plot is a 'zoo' object as follows (there is actually something strange in here, if I just want to see the whole object I do not get the warning message that I got when

Re: [R] Chron object in time series plot

2010-10-27 Thread Manta
This is the output, thanks again for the help! structure(c(48608, 46686, 55216, 59268, 50967, 55067, 57783, 60021, 61480, 63853, 58267, 72442, 63926, 49102, 74320, 63433, ... 55337, 54919, 63230, 57756, 80296, 58319, 56993, 59161, 56184, 65331, 56179, 61115, 59874, 85050), index =

Re: [R] Chron object in time series plot

2010-10-27 Thread Manta
Here it is: dput(temp_plot) structure(c(48608, 46686, 55216, 59268, 50967, 55067, 57783, 60021, 61480, 63853, 58267, 72442, 63926, 49102, 74320, 63433, 66256, 68483, 67736, 60507, 60888, 78008, 64326, 65665, 57288, 54663, 54984, 54073, 59632, 52523, 55266, 54836, 61408, 53813, 85855, 65204,

Re: [R] Chron object in time series plot

2010-10-26 Thread Manta
Thanks for your help Gabor. That would be exactly what I am looking for. If I use your code I get the nice representation I am looking for. However, when I try to apply the code in the same fashion to my case, it does not produce the x-axis. I believe the problem hinges on the following warning

Re: [R] Chron object in time series plot

2010-10-25 Thread Manta
I would like to thank you all for the help given so far! I have the following object of the class 'zoo' temp_mean_plot[31:35] 2008-02-13 2008-02-14 2008-02-15 2008-02-18 2008-02-19 14.86834 14.89609 14.89358 14.87610 14.87652 The sample runs from Jan 2008 to July 2010. How can I

Re: [R] Chron object in time series plot

2010-10-25 Thread Manta
My bad! What I meant is that I want to plot the whole series, but the legend in the x-axis would only present some specific months depending on the window I want to choose, say 6 months. At the moment, it only present 2008, 2009 and 2010. Thanks -- View this message in context:

Re: [R] Chron object in time series plot

2010-10-25 Thread Manta
I apologize for not being very precise. I meant the tick marks on the x-axis. As for the code, the situation is just the one describe above, just that I would like to be able to specify the tick marks (say every 3 or 6 months). -- View this message in context:

Re: [R] Chron object in time series plot

2010-10-25 Thread Manta
Wonderful! Thanks a lot for your help, super appreciated! -- View this message in context: http://r.789695.n4.nabble.com/Chron-object-in-time-series-plot-tp3002285p3012793.html Sent from the R help mailing list archive at Nabble.com. __

Re: [R] Chron object in time series plot

2010-10-20 Thread Manta
Sorry R community, I am still stucked wit this. How can avoid the x-limit error? -- View this message in context: http://r.789695.n4.nabble.com/Chron-object-in-time-series-plot-tp3002285p3004070.html Sent from the R help mailing list archive at Nabble.com.

Re: [R] Chron object in time series plot

2010-10-20 Thread Manta
Well, I was listening, but the error was due to the extra function 'format'. Without that, it works perfectly. Thanks for the help, Marco -- View this message in context: http://r.789695.n4.nabble.com/Chron-object-in-time-series-plot-tp3002285p3004177.html Sent from the R help mailing list

[R] Chron object in time series plot

2010-10-19 Thread Manta
Dear R users, I have the following script to create bins of specified time intervals bin_end=60/bin_size bin_size=bin_size*100 h=seq(07,18,by=1) breaks=c() for (i in h) { for (j in 0:(bin_end-1)) { value=i+(bin_size)*j

Re: [R] Chron object in time series plot

2010-10-19 Thread Manta
David Winsemius wrote: You seen to be under the mistaken impression that the internal representation of DateTime classes of 08:00 would be 8. Since the internal representation of time is in seconds, the even number hours would be at integer multiples of 60*60. In addition the

Re: [R] Chron object in time series plot

2010-10-19 Thread Manta
I do not think that importing the time as character will help me, as I need to perform several operation with them. Again, maybe I am not able to express clearly enough. Let's just focus on this series: breaks [1] 7 71500 73000 74500 8 81500 83000 84500 9 91500 93000

Re: [R] Chron object in time series plot

2010-10-19 Thread Manta
Thanks Phil, it is exactly what I was looking for. David, I took into account how to make valid math operations, so I understand your concern about it. I will definitely change all my scripts and functions to considered the time as character, but as I need a clear output soon (deadline is close)

[R] Pasting function arguments and strings

2010-10-13 Thread Manta
Dear R community, I am struggling a bit with a probably fairly simple task. I need to use some already existing functions as argument for a new function that I am going to create. 'dataset' is an argument, and it comprises objects named 'mean_test', 'sd_test', 'kurt_test' and so on. 'arg1' tells

Re: [R] Pasting function arguments and strings

2010-10-13 Thread Manta
Thaks for your quick reply Bert, although I doubt it works. The reason is that the names of the objects of the dataset, all end with the sufix '_test' and therefore I need to attach/paste/glue this suffix to the 'arg2' of the function. Any other idea? -- View this message in context:

[R] Large dataset importing, columns merging and splitting

2010-01-26 Thread Manta
Dear All, I have a large data set that looks like this: CVX 20070201 9 30 51 73.25 81400 0 CVX 20070201 9 30 51 73.25 100 0 CVX 20070201 9 30 51 73.25 100 0 CVX 20070201 9 30 51 73.25 300 0 First, I would like to import it by merging column 3 4 and 5, since that is the timestamp. Then, I would

[R] VAR forecasts and out-of-sample prediction

2009-11-27 Thread manta
done at the moment betas-read.table(C:\\Users\\Manta\\Desktop\\betas.txt,header=T,dec=,) BETA-ts(betas,start=(1984),frequency=12) BETAS-TSdata(output=BETA) VAR1-estVARXls(window(BETAS,end=c(2003,12)),max.lag=1) pr-forecast(VAR1,horizon=1) pr3-forecast(VAR1,horizon=3) pr12-forecast(VAR1,horizon=12

[R] Re cursive regression

2009-09-30 Thread manta
Hi there, I'm in desperate need to figure out how to solve this issue. I need to estimate a recursive model for a time series data of asset returns. The dependent variable is the asset return and then I have a set of k variables, a lagged value of the dependent variable (plus an intercept) as

[R] Function output

2009-09-20 Thread manta
Good afternoon, I know it is a simple question but I cannot figure out how to solve this issue. I have a function that calculate two objects. I would like to choose everytime about the tree object, with default to not show it. OP-function(S=100,X,sigma,mu=0,r=0,time=1,n) { value=(S)

Re: [R] Cross-Correlation function (CCF) issues

2009-04-21 Thread manta
?? -- View this message in context: http://www.nabble.com/Cross-Correlation-function-%28CCF%29-issues-tp23145411p23156769.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list

Re: [R] Cross-Correlation function (CCF) issues

2009-04-21 Thread manta
Sorry, my bad, i did not mean to 'be mean'. Here are the first five observations for three variables (dr1, dr2 and doil) dr1 1996-01-021996-01-031996-01-041996-01-051996-01-08 0.0005814396 -0.0023725000 -0.0072835915 0.0074536448 -0.0007004221 dr2 1996-01-03

Re: [R] Cross-Correlation function (CCF) issues

2009-04-21 Thread manta
of differencing (whatever it was) offset the date registration of the zoo series in dr2, but ccf(do1, dr2) still does not appear to choke on that input. -- David On Apr 21, 2009, at 4:06 PM, manta wrote: DW: Modifications of that output to reconstruct the series: do1

Re: [R] Cross-Correlation function (CCF) issues

2009-04-21 Thread manta
that I created from your dput output, then I don't have an answer, since there were no missing values in those objects. -- David Winsemius On Apr 21, 2009, at 5:21 PM, manta wrote: This is what I get. ccf(do1,dr1) Errore in na.fail.default(ts.intersect(as.ts(x), as.ts(y

Re: [R] Cross-Correlation function (CCF) issues

2009-04-21 Thread manta
in a full working example with an extract of the data. Suggest you try using dput as a method of creating a working example. That way we (and the R interpreter) would get labels and class information. -- David Winsemius On Apr 21, 2009, at 10:56 AM, manta wrote: Sorry, my bad, i did

[R] Cross-Correlation function (CCF) issues

2009-04-20 Thread manta
Dear all, I have two series of returns and I want to find the cross-correlations between these two series. I know of the ccf, but it does not work as I'd like if i type ccf(x,y,lag.max=20,type=correlation,plot=FALSE) i got the error message Error in na.fail.default(ts.intersect(as.ts(x),

Re: [R] From daily series to monthly and viceversa

2009-04-18 Thread manta
at 2:13 PM, manta mantin...@libero.it wrote: any update anybody? I'm really stucked! -- View this message in context: http://www.nabble.com/From-daily-series-to-monthly-and-viceversa-tp23064454p23103052.html Sent from the R help mailing list archive at Nabble.com

Re: [R] From daily series to monthly and viceversa

2009-04-18 Thread manta
Thanks so much -- View this message in context: http://www.nabble.com/From-daily-series-to-monthly-and-viceversa-tp23064454p23116875.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list

Re: [R] From daily series to monthly and viceversa

2009-04-17 Thread manta
any update anybody? I'm really stucked! -- View this message in context: http://www.nabble.com/From-daily-series-to-monthly-and-viceversa-tp23064454p23103052.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org

Re: [R] From daily series to monthly and viceversa

2009-04-16 Thread manta
Ok, I'll try to explain my issue. I have a monthly series (CPI index) and I want to interpolate it using a specific lagged harmonized formula to get the corresponding daily series. The formula is the following CPI^=CPI(t-3)+(d-1)/D*(CPI(t-2)-CPI(t-3)) where CPI^ is the CPI for the day we are

[R] From daily series to monthly and viceversa

2009-04-15 Thread manta
I have the following daily exchange rate series (from january 1st 1996 to december 31st 2008) and I want to obtain them monthly series from it. I've read about the 'zoo' library but I'm not getting it how to do it. These are the data (left column day-month-year, right column the index)

Re: [R] From daily series to monthly and viceversa

2009-04-15 Thread manta
Ok, thanks for the quick reply. I was not able to use the first command, but reading the quick reference helped me. Here's what I did. cambio-read.zoo(C:\\Users\\Manta\\Desktop\\useuro.txt, format = %d/%m/%Y, dec = ,,header=T) cambio #this is what i get 1996-01-01 1996-01-02 1996-01-03 1996

Re: [R] From daily series to monthly and viceversa

2009-04-15 Thread manta
Ok, using mcambio - aggregate(cambio, as.yearmon, mean) works perfectly!! Should I worry about the missing values or not anyway? And then I go to the following question. From monthly data to daily using a specific formula? -- View this message in context: