[R] question about converting a matrix to a dataframe

2010-09-16 Thread Leigh E. Lommen
First I have a matrix called stocks1: > class(stocks1) [1] "matrix" Here are the first 5 rows of the last 4 columns: > stocks1[1:5,2:5] [,1] [,2] [,3] [,4] [1,] 80.73 31.95 25.4 25.69 [2,] 83.66 31.95 27.12 25.2 [3,] 83.27 32.93 28.74 26.29 [4,] 83.9 34.07 29.77 26.6 [

[R] argument is of length 0 & condition has length>1

2010-08-04 Thread Leigh E. Lommen
I have the following array: > head(stocks) DATE TICKER PERMNO EXCHCD TSYMBOL TRDSTAT SHROUTPRC RET 1 19950131 EWST 10001 3EWST A 2224 -7.75000 -0.031250 2 19950228 EWST 10001 3EWST A 2224 7.54688 -0.026210 3 19950331 EWST 10001 3

[R] mixing strings and numeric doubles in an array

2010-08-03 Thread Leigh E. Lommen
I have an array called "stocks" which contains numeric dates, ticker symbols,prices, etc. > stocks[1:3,] DATETICKER PERMNO EXCHCD TSYMBOL TRDSTAT SHROUT PRC RET 1 19950131 EWST 10001 3 EWST A 2224 -7.75000 -0.031250 2 19950228 EWST 10001

Re: [R] sorting by date

2010-08-02 Thread Leigh E. Lommen
tc. Thanks. Leigh From: Henrique Dallazuanna [mailto:www...@gmail.com] Sent: Monday, August 02, 2010 8:12 PM To: Leigh E. Lommen Cc: r-help@r-project.org Subject: Re: [R] sorting by date a <- c( 20071031,20071130, 20071231) sort(a) Or if you want conve

[R] sorting by date

2010-08-02 Thread Leigh E. Lommen
I am unsure how to sort a column by date if it is currently in the form: MMDD For example the months: 20071031 20071130 20071231 Etc. Regards, Leigh [[alternative HTML version deleted]] __ R-help@r-project.org mailing list htt

[R] Durban Watson statistics

2010-07-11 Thread Leigh E. Lommen
I would like to do the Durban-Watson test on a time series of log returns. 2 questions: 1) If I am just trying to find out if there is serial correlation, what do I do for the residuals? there is no model, so do I just use the log returns (time series) itself? 2) what is the code in R t