Sounds like a job for 'rle'. Patrick Burns patrick@burns-stat.com +44 (0)20 8525 0696 http://www.burns-stat.com (home of S Poetry and "A Guide for the Unwilling S User") Hello, I'm trying to detect r
This is known as 'Last Observation Carried Forward' or LOCF. There is a discussion of algorithms for it somewhere in the R archives. You do not want to do serious computing in Excel or other spreadsh
You can cut out some of the arithmetic by only adding the last slice: cumsumA[,,1] <- A[,,1] for(z in seq(len=dim(A)[3])[-1]) cumsumA[,,z] <- cumsumA[,,z-1] + A[,,z] Also if the product of the first
If all of your data is numeric, as in your example, then you can just use a 3-dimensional array. (S Poetry talks about them, but they are quite simple.) Patrick Burns patrick@burns-stat.com +44 (0)20
I don't have a comment on the errors that you are getting, but I do on trying to fit the model in the first place. 300 observations is probably too few to get a meaningful estimate from the model. It
Version 3 of POP Portfolio Construction Suite is now released. This is commercial software that runs under both S-PLUS and R. The highlights are: It is now available under Linux as well as Windows. M
If I understand correctly, you want the "get" function. Patrick Burns patrick@burns-stat.com +44 (0)20 8525 0696 http://www.burns-stat.com (home of S Poetry and "A Guide for the Unwilling S User") Hi
The 'corner' function uses 'do.call' on '[' to perform a similar task. The code is available in the Public Domain Code area of the Burns Statistics website. The reason for 'corner' being there was no
You want to have a list and use the correct subscripting. object <- vector('list', 10) for(i in 1:10) { object[[i]] <- A %*% B } S Poetry can tell you more. Patrick Burns patrick@burns-stat.com +44 (
I'll chip in my $0.02: ... 4. BDR said in one of his talks a few years ago that R probably has more bugs than S-PLUS. However, bugs in R get fixed a lot quicker than in S-PLUS. Also, R is developed
Your problem with 'names' is that you are using a list where you should use a vector. That is: names(alist) <- c('array 1', 'array 2') On the 'lapply' question, you should be able to do it, I would w
In S-PLUS (but not R) the length of a function is the number of arguments plus 1 (for the body). Patrick Burns Burns Statistics patrick@burns-stat.com +44 (0)20 8525 0696 http://www.burns-stat.com (h
There's a new page on the Burns Statistics website http://www.burns-stat.com/pages/Tutor/spreadsheet_addiction.html that looks at spreadsheets from a quality assurance perspective. It presents R as a
That is equivalent to the first spot in the search list, which is specified by pos=1 or where=1 in various functions. Patrick Burns Burns Statistics patrick@burns-stat.com +44 (0)20 8525 0696 http://