[R] Vi mode in Linux console - how to stop it ?

2011-06-20 Thread rivercode
Hi, When I am editing a command using default R console in Linux, sometimes it is going into vi mode...not too sure how/why this happening. It then requires me to use vi commands to edit the line, which is very frustrating when I just want to use the delete key instead of x to delete a

[R] Source Code File For an Object

2011-04-19 Thread rivercode
Is there anyway to query an object to find its source code file ? Created object F from file F.r, can object F tell me this ? Thanks, Chris -- View this message in context: http://r.789695.n4.nabble.com/Source-Code-File-For-an-Object-tp3461566p3461566.html Sent from the R help mailing list

Re: [R] Replace split with regex for speed ?

2011-03-19 Thread rivercode
Thanks for your suggestions. Cheers, Chris -- View this message in context: http://r.789695.n4.nabble.com/Replace-split-with-regex-for-speed-tp3386098p3388958.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org

[R] Replace split with regex for speed ?

2011-03-17 Thread rivercode
Have timestamp in format HH:MM:SS.MMM.UUU and need to remove the last . so it is in format HH:MM:SS.MMMUUU. What is the fastest way to do this, since it has to be repeated on millions of rows. Should I use regex ? Currently doing it with a string split, which is slow: head(ts) [1]

[R] Error: evaluation nested too deeply: infinite recursion / options(expressions=)?

2011-03-09 Thread rivercode
Hi, I am processing tick data and my code has stopped working as I have increased the size of data being processed. Now I am receiving error for basic tasks in RConsole: a = c(1:1000) Error: evaluation nested too deeply: infinite recursion / options(expressions=)? My R code worked fine with

Re: [R] Error: evaluation nested too deeply: infinite recursion / options(expressions=)?

2011-03-09 Thread rivercode
For further info, I cannot check my memory usage or even use ls() : memory.limit Error: evaluation nested too deeply: infinite recursion / options(expressions=)? ?memory.limit Error: evaluation nested too deeply: infinite recursion / options(expressions=)? ls() Error: evaluation nested too

[R] Replace for loop when vector calling itself

2011-03-07 Thread rivercode
Hi, I am missing something obvious. Need to create vector as: (0, i-1 + TheoP(i) - TheoP(i-1), repeat) Where i is the index position in the vector and i[1] is always 0. Found myself having to use a For Loop because I could not get sapply working. Any suggestions ? delta - function(x)

Re: [R] Replace for loop when vector calling itself

2011-03-07 Thread rivercode
Hope this clarifies my Q. Creating a vector where each element is (except the first which is 0) is: the previous element + a calculation from another vector theoP[i] - theoP[i-1] I could not figure out how to do this without a for loop, as the vector had to reference itself for the next

Re: [R] Replace for loop when vector calling itself

2011-03-07 Thread rivercode
Hi, Thanks for your replies. In summary: 1. Replace code with c(0, cumsum(diff(theoP)) ). This is indeed correct and I had not realized it !! d = vector(mode = numeric, length= len) d[1] = 0 if (len1) for (i in 2:len) { d[i] = d[i-1] + theoP[i] - theoP[i-1] } 2. How to create

Re: [R] xts POSIXct index format

2011-03-05 Thread rivercode
Thank you for your help. indexFormat(x) solved the problem nicely. head(a) 2011-03-04 09:30:00.0 22.10 2011-03-04 09:30:00.1 22.09 2011-03-04 09:30:00.2 22.10 2011-03-04 09:30:00.3 22.09 2011-03-04 09:30:00.4 22.10 2011-03-04 09:30:00.5 22.09 indexFormat(a) - %H:%M:%OS3 head(a)

[R] xts POSIXct index format

2011-03-04 Thread rivercode
Hi, I cannot figure out how to change the index format when displaying POSIXct objects. Would like the xts index to display as %H:%M:%OS3 when doing viewing the xts object. Think I am missing the obvious. Cheers, Chris -- View this message in context:

[R] as.POSIXct show milliseconds with format

2011-03-03 Thread rivercode
Hi, Trying to create a POSIXct index for an xts object that will display the POSIXct index as HH:MM:SS.MMM. First of all, I am trying to get the as.POSIXct to work with format... as.POSIXct(paste(2011-03-02 09:00:00.000, sep=), tz=EST, format=%H:%M:%OS3) [1] NA Why is this returning NA ? I

[R] Create a zoo/xts Time Series with Millisecond jumps

2011-03-02 Thread rivercode
Is there a easy way to create the time index for a zoo/xts object for every 100 milliseconds. eg. time Index would be: 10:00:00:100 10:00:00:200 10:00:00:300 10:00:00:400 I am looking to build an empty zoo/xts object with time index from 10am to 3pm, index jumps by 100ms each row. Thanks,

[R] Aggragating subsets of data in larger vector with sapply

2011-01-09 Thread rivercode
Have 40,000 rows of buy/sell trade data and am trying to add up the buys for each second, the code works but it is very slow. Any suggestions how to improve the sapply function ? secEP = endpoints(xSym$Direction, secs) # vector of last second on an XTS timeseries object with multiple entries

[R] XTS : merge.xts seems to have problem with character vectors

2011-01-04 Thread rivercode
Hi, Please can you tell me what I am doing wrong. When trying to merge two xts objects, one of which has multiple character vectors for columns...I am just getting NAs. str(t) POSIXct[1:1], format: 2011-01-04 11:45:37 y2 = xts(matrix(c(letters[1:10]),5), order.by=as.POSIXct(c(t + 1:5)))

[R] Regex to remove last character

2011-01-03 Thread rivercode
Hi, Have been having trouble trying to figure out the right regex parameters to remove the last . in timestamp with the following format: Convert 09:30:00.377.853 to 09:30:00.377853 Thanks, Chris -- View this message in context:

[R] Slow reading multiple tick data files into list of dataframes

2010-10-11 Thread rivercode
Hi, I am trying to find the best way to read 85 tick data files of format: head(nbbo) 1 bid CON 09:30:00.72209:30:00.722 32.71 98 2 ask CON 09:30:00.78209:30:00.810 33.14 300 3 ask CON 09:30:00.80909:30:00.810 33.14 414 4 bid CON 09:30:00.78309:30:00.810 33.06

Re: [R] Time OffSet From GMT - Losing it

2010-10-11 Thread rivercode
That is embarrassingthanks for pointing out my mistake. Chris -- View this message in context: http://r.789695.n4.nabble.com/Time-OffSet-From-GMT-Losing-it-tp2968940p2990987.html Sent from the R help mailing list archive at Nabble.com. __

[R] SApply versus for loop for list of data.frames

2010-10-11 Thread rivercode
Hi, I am trying to find the total number of rows for a list of data.frames and want to know if there is a better way than using a loop like: df = { list of data.frame with varying number of rows...each one has a column called COL } r = 0 for (i in 1:length(df)) { + r = r + length(n[[i]]$CON) +

Re: [R] Odp: Vector replace 0 elements without using a loop

2010-10-08 Thread rivercode
Petr and Bill, Thanks for your replies. I have gone with Petr use of na.locf(), but expect I can use Bill's full function in the near future. Chris -- View this message in context: http://r.789695.n4.nabble.com/Vector-replace-0-elements-without-using-a-loop-tp2966191p2968909.html Sent from

[R] Time OffSet From GMT - Losing it

2010-10-08 Thread rivercode
Losing time offset from GMT: sTime = as.POSIXct(paste(2008-03-03,09:30:01), origin=1970-01-01) sTime [1] 2008-03-03 09:30:01 EST 9.31am EST sTime [1] 1204554601 t = as.numeric(sTime) as.POSIXct(t, origin=1970-01-01) [1] 2008-03-03 14:30:01 EST - no tz option and t is sTime +

Re: [R] Loop too slow for Bid calc - BUT cannot figure out how to do with matrix

2010-10-06 Thread rivercode
Duncan and Martin, Thank you for your replies. I went with Martin's suggestion as it did not require loops and is probably the fastest...though it did take me 3 hours to figure out exactly how it was working !!! Here is what I am now using: bids = cbind(bids, timeCalc) orderBids =

[R] Vector replace 0 elements without using a loop

2010-10-06 Thread rivercode
Hi, With a vector like: x = c (22, 23, 22.5, 0,0,24, 0, 23.2, 23.5, 0,0,0, 26) How can I replace the 0's with the previous last value without looping through the vector ? Something tells me I am missing the obvious. Thanks, Chris -- View this message in context:

[R] Loop too slow for Bid calc - BUT cannot figure out how to do with matrix

2010-10-04 Thread rivercode
Hi, I am trying to create Bid/Ask for each second from a high volume stock and the only way I have been able to solve this is using loops to create the target matrix from the source tick data matrix. Looping is too slow and not practical to use on multiple stocks. For example: Bids Matrix (a