Re: [R] Variable Wildcard Value

2009-04-01 Thread Patrick Burns
I would be truly amazed if the answer were yes. I find this the most fascinating question on R-help for a long time, maybe ever. Can you tell us what you have in mind and what your ultimate purpose is? Patrick Burns patr...@burns-stat.com +44 (0)20 8525 0696 http://www.burns-stat.com (home

Re: [R] Programming objects in R

2009-03-31 Thread Patrick Burns
I think that 'Software for Data Analysis' by John Chambers should certainly be on the reading list. Patrick Burns patr...@burns-stat.com +44 (0)20 8525 0696 http://www.burns-stat.com (home of The R Inferno and A Guide for the Unwilling S User) Tom Backer Johnsen wrote: I am planning a project

Re: [R] nls, convergence and starting values

2009-03-28 Thread Patrick Burns
to reject the model. That is, to answer your specific question, I think it is acceptable but not sufficient. Patrick Burns patr...@burns-stat.com +44 (0)20 8525 0696 http://www.burns-stat.com (home of The R Inferno and A Guide for the Unwilling S User) Patrick

Re: [R] function question

2009-03-19 Thread Patrick Burns
functions are different in this respect. Patrick Burns patr...@burns-stat.com +44 (0)20 8525 0696 http://www.burns-stat.com (home of The R Inferno and A Guide for the Unwilling S User) __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo

Re: [R] Removing

2009-03-12 Thread Patrick Burns
Simpler, but maybe wrong. Not duplicated was my first response as well, but then I began wondering if the question implied globally duplicated or duplicated within subgroups. Patrick Burns patr...@burns-stat.com +44 (0)20 8525 0696 http://www.burns-stat.com (home of The R Inferno and A Guide

Re: [R] character string as object name

2009-03-05 Thread Patrick Burns
Does the first item on page 52 of 'The R Inferno' explain it for you? If not, can you give some hints about how to improve the explanation? Patrick Burns patr...@burns-stat.com +44 (0)20 8525 0696 http://www.burns-stat.com (home of The R Inferno and A Guide for the Unwilling S User) Fuchs Ira

Re: [R] Help How to use a loop to do pair comparison

2009-02-24 Thread Patrick Burns
One possible first step could be: ifelse(outer(x, x, ''), 'Big', 'Small') Patrick Burns patr...@burns-stat.com +44 (0)20 8525 0696 http://www.burns-stat.com (home of The R Inferno and A Guide for the Unwilling S User) Chunhao Tu wrote: Hi R users, I have a question. How can I use for loop

Re: [R] Help How to use a loop to do pair comparison

2009-02-24 Thread Patrick Burns
Patrick Burns wrote: One possible first step could be: ifelse(outer(x, x, ''), 'Big', 'Small') Second step: use 'lower.tri'. Patrick Burns patr...@burns-stat.com +44 (0)20 8525 0696 http://www.burns-stat.com (home of The R Inferno and A Guide for the Unwilling S User) Chunhao Tu wrote

Re: [R] difference between assignment syntax - vs =

2009-02-23 Thread Patrick Burns
will be partially released to others) if the '-' - style is the preferred one (Personally, with a strong background from other programming languages, I have always used '=' so far). thanks, Thomas Patrick Burns wrote: 'The R Inferno' page 78 is one source you can look at. Patrick Burns patr

Re: [R] Use of ifelse for indicating specific rownumber

2009-02-19 Thread Patrick Burns
I think you are looking for something like: ifelse(1:nrow(b2) %in% i, 1, 0) Patrick Burns patr...@burns-stat.com +44 (0)20 8525 0696 http://www.burns-stat.com (home of The R Inferno and A Guide for the Unwilling S User) joe1985 wrote: Hello I have a dataset named b2 with 1521 rows

Re: [R] Alternate to for-loop

2009-02-16 Thread Patrick Burns
, ...) { colMeans(array(distfun(size * replicates, ...), c(size, replicates))) } Patrick Burns patr...@burns-stat.com +44 (0)20 8525 0696 http://www.burns-stat.com (home of The R Inferno and A Guide for the Unwilling S User) Uwe Ligges wrote: megh wrote: No, it is not homework. I obviously

Re: [R] Alternate to for-loop

2009-02-16 Thread Patrick Burns
Wacek Kusnierczyk wrote: Patrick Burns wrote: If the goal is to look professional, then 'replicate' probably suits. If the goal is to compute as fast as possible, then that isn't the case because 'replicate' is really a 'for' loop in disguise and there are other ways. Here's one other way

Re: [R] Extending each element in a list, or rbind()-ing arrays of different length without recycling

2009-02-13 Thread Patrick Burns
My question is: Why would you want a data structure that is clearly not expressive of the data involved? Let me guess. You are coming from statistical software where data are always rectangular. Patrick Burns patr...@burns-stat.com +44 (0)20 8525 0696 http://www.burns-stat.com (home of The R

Re: [R] Problems with Histogram

2009-02-13 Thread Patrick Burns
One possibility is something along the lines of: plot(density(bootstraps)) abline(v=original.value) Patrick Burns patr...@burns-stat.com +44 (0)20 8525 0696 http://www.burns-stat.com (home of The R Inferno and A Guide for the Unwilling S User) TomPoes wrote: Hello Currently i'm working

Re: [R] The Origins of R

2009-02-04 Thread Patrick Burns
was that it was a disjointed mess due to editing rather than a slight to anyone anywhere. Patrick Burns patr...@burns-stat.com +44 (0)20 8525 0696 http://www.burns-stat.com (home of The R Inferno and A Guide for the Unwilling S User) John Maindonald wrote: In another thread on this list, various wild allegations have

Re: [R] Problems in Recommending R

2009-02-03 Thread Patrick Burns
Ajay ohri wrote: How much time do you think is needed to read 133 pages of FAQ. About 132.5 / 133 more times longer than most people are wanting to spend. Patrick Burns patr...@burns-stat.com +44 (0)20 8525 0696 http://www.burns-stat.com (home of The R Inferno and A Guide for the Unwilling

Re: [R] scoping rules for 'for' [was - Re: for/if loop ]

2009-01-30 Thread Patrick Burns
'The R Inferno' page 36. Patrick Burns patr...@burns-stat.com +44 (0)20 8525 0696 http://www.burns-stat.com (home of The R Inferno and A Guide for the Unwilling S User) SnowManPaddington wrote: Hi ya, thanks a lot everyone!! I changed rr:ii-1 to rr:(ii-1) and the code works!!! I finally get

Re: [R] paste together object names to pass it on to a function

2009-01-30 Thread Patrick Burns
A rule of thumb is that if the solution seems a lot harder than the task, there is probably a better approach. I think you want something like: lapply(gnuff[nam], function(x) x$LE) Patrick Burns patr...@burns-stat.com +44 (0)20 8525 0696 http://www.burns-stat.com (home of The R Inferno

Re: [R] Question about collapse/aggregate and avoidance of loops

2009-01-29 Thread Patrick Burns
I think you are looking for split(author, id) Patrick Burns patr...@burns-stat.com +44 (0)20 8525 0696 http://www.burns-stat.com (home of The R Inferno and A Guide for the Unwilling S User) Weiss, Bernd wrote: Dear all, given the following data ## original data id - c(1,1,1,2,2,3) author

Re: [R] scoping rules for 'for' [was - Re: for/if loop ]

2009-01-29 Thread Patrick Burns
Certainly not a complete description, but 'The R Inferno' talks about this on page 62. Patrick Burns patr...@burns-stat.com +44 (0)20 8525 0696 http://www.burns-stat.com (home of The R Inferno and A Guide for the Unwilling S User) dav...@rhotrading.com wrote: I apologize for posting a wrong

Re: [R] Using help()

2009-01-25 Thread Patrick Burns
Michael Kubovy wrote: Dear R-helpers, [...] (2) If I remember dnorm() and want to be reminded of the call, I also get a list of pages. It sounds to me like here you want: args(dnorm) Patrick Burns patr...@burns-stat.com +44 (0)20 8525 0696 http://www.burns-stat.com (home of The R

Re: [R] Extra rows of 'NAs' in imported dataset

2009-01-23 Thread Patrick Burns
'The R Inferno' page 87 talks about getting extra columns from data derived from spreadsheets. It happens because the spreadsheet program thinks for some reason that the extra cells are used -- a cell was probably clicked on. Patrick Burns patr...@burns-stat.com +44 (0)20 8525 0696 http

Re: [R] how to get a primitive function object

2009-01-23 Thread Patrick Burns
extra side effect that you want to happen. That is not in the spirit of R. Patrick Burns patr...@burns-stat.com +44 (0)20 8525 0696 http://www.burns-stat.com (home of The R Inferno and A Guide for the Unwilling S User) Yi Zhang wrote: i was sort-of joking, though it's a real option if you want

Re: [R] changing a range of values

2009-01-17 Thread Patrick Burns
The R Inferno, page 38. Patrick Burns patr...@burns-stat.com +44 (0)20 8525 0696 http://www.burns-stat.com (home of The R Inferno and A Guide for the Unwilling S User) Jörg Groß wrote: Hi, If I have following vector; x - c(1,1,1,2,2,3,4,4,5) and I want to change values in the range of 1

Re: [R] Vectorization of three embedded loops

2009-01-14 Thread Patrick Burns
' comes in from the outer-most loop. Patrick Burns patr...@burns-stat.com +44 (0)20 8525 0696 http://www.burns-stat.com (home of The R Inferno and A Guide for the Unwilling S User) Thomas Terhoeven-Urselmans wrote: Dear R-programmer, I wrote an adapted implementation of the Kennard-Stone

Re: [R] Converting Factor to Vector

2009-01-13 Thread Patrick Burns
Using 'str' to see what you have is excellent practice (and very helpful to show in messages to R-help). However, you need to look at the output you get more carefully. You have a data frame that contains a factor. So: as.character(repo[, 1]) should do what you want. Patrick Burns patr

Re: [R] assign a list using expression?

2009-01-12 Thread Patrick Burns
I think this is glossing over 9.7 of 'The R Inferno'. You aren't telling us what you really want to achieve. It seems hard for me to believe that the approach you are taking is going to be the easiest route to whatever that is. Patrick Burns patr...@burns-stat.com +44 (0)20 8525 0696 http

[R] The R Inferno

2009-01-09 Thread Patrick Burns
) for additional items are encouraged. Patrick Burns patr...@burns-stat.com +44 (0)20 8525 0696 http://www.burns-stat.com (home of The R Inferno and A Guide for the Unwilling S User) __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman

Re: [R] New York Times Article: Data Analysts Captivated by R's Power

2009-01-08 Thread Patrick Burns
what the sentence was trying to say is that a WHOLE LOT of what is done in Excel would be better done in R. Patrick Burns patr...@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) Simon

Re: [R] rbind for matrices - rep argument

2009-01-07 Thread Patrick Burns
(list(x), 3)) Patrick Burns patr...@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) __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read

Re: [R] Newbie Question: parts of a dataframe

2008-12-30 Thread Patrick Burns
I believe you are looking for: Test[1, 2:6, drop=TRUE] Patrick Burns patr...@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) glenn wrote: Assuming I have dataframe ³test² with dim = (2,10) say; And that I can choose some

Re: [R] filling values in a vector using smaller vector

2008-12-24 Thread Patrick Burns
I believe the following does what is wanted: desired - large desired[large] - small Patrick Burns patr...@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) Milton Huang wrote: Dear list members: I am looking for an elegant

Re: [R] Ordered Multidimensional Arrays

2008-12-23 Thread Patrick Burns
The old fashioned solution is to have the N x N x T array and use character strings of the dates as the dimnames on the third dimension. Is there something you think you need to do that is hard with such a setup? Patrick Burns patr...@burns-stat.com +44 (0)20 8525 0696 http://www.burns

Re: [R] Creating a vector

2008-12-13 Thread Patrick Burns
of values that you describe (assuming I understand properly). If you need that to be some other length than what it actually is, then perhaps 'rep' can be of use. Patrick Burns patr...@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

Re: [R] The end of Matlab

2008-12-12 Thread Patrick Burns
How about: x[, -seq(to=ncol(x), length=n)] Patrick Burns patr...@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) Claudia Beleites wrote: Dear list, Learning to use the power of R's indexing and functios like head

Re: [R] how to test for the empty set

2008-11-24 Thread Patrick Burns
You seem to want: length(x) == 0 Patrick Burns [EMAIL PROTECTED] +44 (0)20 8525 0696 http://www.burns-stat.com (home of S Poetry and A Guide for the Unwilling S User) G. Jay Kerns wrote: Dear R-help, I first thought that the empty set (for a vector) would be NULL. x - c() x However

Re: [R] How to avoid $ operator is invalid for atomic vectors

2008-11-06 Thread Patrick Burns
to hang yourself, you can do things like: x - numeric(0) or x - NULL Patrick Burns [EMAIL PROTECTED] +44 (0)20 8525 0696 http://www.burns-stat.com (home of S Poetry and A Guide for the Unwilling S User) Thanks, cruz __ R-help@r-project.org mailing list

Re: [R] Goto loop

2008-11-01 Thread Patrick Burns
to this list. Patrick Burns [EMAIL PROTECTED] +44 (0)20 8525 0696 http://www.burns-stat.com (home of S Poetry and A Guide for the Unwilling S User) __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting

Re: [R] odd behaviour of identical

2008-10-27 Thread Patrick Burns
, but I don't recall a time when I've ever needed to know if a vector in R was integer or double. Patrick Burns [EMAIL PROTECTED] +44 (0)20 8525 0696 http://www.burns-stat.com (home of S Poetry and A Guide for the Unwilling S User) jim holtman wrote: If you want them to be identical, then you

Re: [R] VEC Operator in R

2008-10-23 Thread Patrick Burns
than a simple function that you write. Not true (barring bugs). R is egalitarian -- your functions have the same standing as official functions. A lot of times it is faster to write a function of your own rather than search out someone else's even if you know such functions exist. Patrick Burns

Re: [R] optim bug/help?

2008-10-23 Thread Patrick Burns
the answer it might be worse when I don't if I don't understand the characteristics of the algoritmns involved. One approach to this problem is to do the optimization several times with different (random?) starts. Patrick Burns [EMAIL PROTECTED] +44 (0)20 8525 0696 http://www.burns-stat.com

Re: [R] VEC Operator in R

2008-10-23 Thread Patrick Burns
know such functions exist. Patrick Burns [EMAIL PROTECTED] +44 (0)20 8525 0696 http://www.burns-stat.com (home of S Poetry and A Guide for the Unwilling S User) megh wrote: Can anyone please tell whether there is any R function to act as VEC and VECH operator on Matrix? Yes of course, I can write

Re: [R] VEC Operator in R

2008-10-23 Thread Patrick Burns
know such functions exist. Patrick Burns [EMAIL PROTECTED] +44 (0)20 8525 0696 http://www.burns-stat.com (home of S Poetry and A Guide for the Unwilling S User) megh wrote: Can anyone please tell whether there is any R function to act as VEC and VECH operator on Matrix? Yes of course, I can write

Re: [R] R seven years ago

2008-10-10 Thread Patrick Burns
denigrating R documentation nor letting questioners off the hook when the answer to their question is clearly and prominently documented. I'm saying that for whatever reason the questioner found it less costly to post a question than to find the answer in the documentation. Cost functions vary. Patrick

Re: [R] vectorization instead of using loop

2008-10-09 Thread Patrick Burns
One thing that would speed it up is if you inverted 'covmat' once and then used 'inverted=TRUE' in the call to 'mahalanobis'. Patrick Burns [EMAIL PROTECTED] +44 (0)20 8525 0696 http://www.burns-stat.com (home of S Poetry and A Guide for the Unwilling S User) Frank Hedler wrote: Dear all, I've

Re: [R] question about working with workspaces

2008-10-02 Thread Patrick Burns
environment. 'attach' creates a new item in the search list containing the objects in the file. Patrick Burns [EMAIL PROTECTED] +44 (0)20 8525 0696 http://www.burns-stat.com (home of S Poetry and A Guide for the Unwilling S User) Nothing is written into 2 until you save the workspace. I think you mean

Re: [R] Bug or feature with finding a list element?

2008-10-02 Thread Patrick Burns
I think you will find that this follows the partial matching rules: * exact match * unique partial match * take evasive action if non-unique partial match Patrick Burns [EMAIL PROTECTED] +44 (0)20 8525 0696 http://www.burns-stat.com (home of S Poetry and A Guide for the Unwilling S User) B Fox

Re: [R] lapply where each list object has multiple parts

2008-10-02 Thread Patrick Burns
The function in 'lapply' gets each component, so write a function that does what you want given a component of the list: lapply(BigList, function(x) mean(x$label1)) Patrick Burns [EMAIL PROTECTED] +44 (0)20 8525 0696 http://www.burns-stat.com (home of S Poetry and A Guide for the Unwilling S

Re: [R] Error: subscript out of bounds.

2008-09-23 Thread Patrick Burns
, it isn't clear (to me at least) what such a change would break. Patrick Burns [EMAIL PROTECTED] +44 (0)20 8525 0696 http://www.burns-stat.com (home of S Poetry and A Guide for the Unwilling S User) Rolf Turner wrote: Consider: x - array(1:12,dim=12) x[13] [1] NA] m - array

Re: [R] swap

2008-08-22 Thread Patrick Burns
I'm guessing that the following (untested) does what is wanted: function(x) { pos - sample(length(x), 2, replace=FALSE) x[pos] - x[ pos[2:1] ] x } Patrick Burns [EMAIL PROTECTED] +44 (0)20 8525 0696 http://www.burns-stat.com (home of S Poetry and A Guide for the Unwilling S User

Re: [R] effective matrix subset

2008-08-10 Thread Patrick Burns
it. Whether time or code clarity are more important depends on the particular application. Patrick Burns [EMAIL PROTECTED] +44 (0)20 8525 0696 http://www.burns-stat.com (home of S Poetry and A Guide for the Unwilling S User) [EMAIL PROTECTED] wrote: It seems that this solution provided by Dan

Re: [R] Creating an array of lists

2008-08-07 Thread Patrick Burns
myListArray - array(list(NULL), c(3,2)) myListArray[[1,2]] - list(letters, 1:4) Patrick Burns [EMAIL PROTECTED] +44 (0)20 8525 0696 http://www.burns-stat.com (home of S Poetry and A Guide for the Unwilling S User) Gang Chen wrote: Hi, I want to store some number of outputs from running

Re: [R] access object inside a function

2008-08-03 Thread Patrick Burns
'plot' is on the scene is going to make that search impossible. One solution is to create 'my.function.from.package' and change the return value to include 'object.inside.package.function'. Patrick Burns [EMAIL PROTECTED] +44 (0)20 8525 0696 http://www.burns-stat.com (home of S Poetry and A Guide

Re: [R] Reading data in R-metrics

2008-08-01 Thread Patrick Burns
My suspicion is that there is some value that R does not think is numeric, so the column becomes a factor, and you are seeing the codes for the factor. Patrick Burns [EMAIL PROTECTED] +44 (0)20 8525 0696 http://www.burns-stat.com (home of S Poetry and A Guide for the Unwilling S User) Kerpel

Re: [R] Help with a loop

2008-07-28 Thread Patrick Burns
You are right to be dissatisfied with your code. I suspect you will get more response if you say what the code is supposed to do, and give a smaller example of what the answer should be. Patrick Burns [EMAIL PROTECTED] +44 (0)20 8525 0696 http://www.burns-stat.com (home of S Poetry and A Guide

Re: [R] Legality Question about R's Open Source GNU GPL License

2008-07-28 Thread Patrick Burns
not be such a bad thing after all. Patrick Burns [EMAIL PROTECTED] +44 (0)20 8525 0696 http://www.burns-stat.com (home of S Poetry and A Guide for the Unwilling S User) zerfetzen wrote: Hi, I use R at home, and am interested in using it at my work company (which is in the Fortune 100). I began the request

Re: [R] Case statements in R

2008-07-28 Thread Patrick Burns
off a cliff that is probably the key feature. Patrick Burns [EMAIL PROTECTED] +44 (0)20 8525 0696 http://www.burns-stat.com (home of S Poetry and A Guide for the Unwilling S User) Ted. On Mon, Jul 28, 2008 at 10:36 AM, Wade Wall [EMAIL PROTECTED] wrote: Hi all, I am trying to convert

Re: [R] Dividing by 0

2008-07-25 Thread Patrick Burns
. Patrick Burns [EMAIL PROTECTED] +44 (0)20 8525 0696 http://www.burns-stat.com (home of S Poetry and A Guide for the Unwilling S User) nmarti wrote: I'm well aware these are not errors, I guess I miss-wrote. I understand your concern. Thanks for passionately looking out for my well being, you

Re: [R] convert a vector of words into a matrix

2008-07-24 Thread Patrick Burns
And what should the matrix look like? Patrick Burns [EMAIL PROTECTED] +44 (0)20 8525 0696 http://www.burns-stat.com (home of S Poetry and A Guide for the Unwilling S User) Daren Tan wrote: How to convert the strings into matrix ? (strings - strsplit(c(1 2 3, 1 2, 1 3 4 5), ))[[1]][1] 1 2 3

Re: [R] Using if, else statements

2008-07-23 Thread Patrick Burns
: Patrick Burns [mailto:[EMAIL PROTECTED] Sent: 23 July 2008 17:44 To: Robin Williams Subject: Re: [R] Using if, else statements You might have found 'ifelse' in S Poetry, which is one way of solving your problem. Patrick Burns [EMAIL PROTECTED] +44 (0)20 8525 0696 http://www.burns-stat.com (home

Re: [R] initialize a factor vector

2008-07-19 Thread Patrick Burns
'c' does not have a method for factors. If you were to try implementing one, you would probably quickly figure out why not. You want to call 'call' factor on the result of the call to 'c'. Patrick Burns [EMAIL PROTECTED] +44 (0)20 8525 0696 http://www.burns-stat.com (home of S Poetry

Re: [R] initialize a factor vector

2008-07-19 Thread Patrick Burns
Somehow the mail system garbled my last sentence. It should read: You want to call 'factor' on the result of the call to 'c'. Pat Patrick Burns wrote: 'c' does not have a method for factors. If you were to try implementing one, you would probably quickly figure out why not. You want to call

Re: [R] column wise paste of data.frames

2008-07-18 Thread Patrick Burns
do.call('paste', c(data.frame(letters, LETTERS), list(sep='/'))) Patrick Burns [EMAIL PROTECTED] +44 (0)20 8525 0696 http://www.burns-stat.com (home of S Poetry and A Guide for the Unwilling S User) Sebastian Weber wrote: Hi everybody! I'm sure that I overlook something and feel quite

Re: [R] function eigen AND Minitab

2008-07-18 Thread Patrick Burns
always have opposite signs, and for eigenvalues that are multiple the eigenvectors need look nothing alike. Patrick Burns [EMAIL PROTECTED] +44 (0)20 8525 0696 http://www.burns-stat.com (home of S Poetry and A Guide for the Unwilling S User) [EMAIL PROTECTED] wrote: Simple. Minitab must

Re: [R] Supressing printing from a function: ecdf

2008-07-15 Thread Patrick Burns
not sure of the best advice for the current situation. Patrick Burns [EMAIL PROTECTED] +44 (0)20 8525 0696 http://www.burns-stat.com (home of S Poetry and A Guide for the Unwilling S User) [EMAIL PROTECTED] wrote: Dear R Users, I am trying to suppress the information printed by the ecdf function

Re: [R] Regression problem

2008-07-15 Thread Patrick Burns
That can be accomplished with 8 keystrokes. A hint is to do the 4 keystrokes: ?lm Patrick Burns [EMAIL PROTECTED] +44 (0)20 8525 0696 http://www.burns-stat.com (home of S Poetry and A Guide for the Unwilling S User) Angila Albaros wrote: Hello all, I am new to r programmeand

Re: [R] Subsetting an array by a vector of dimensions

2008-07-11 Thread Patrick Burns
I think you are looking for subscripting with a matrix: x[cbind(1,1,2)] See, for instance, the subscripting section of chapter 1 of S Poetry. Patrick Burns [EMAIL PROTECTED] +44 (0)20 8525 0696 http://www.burns-stat.com (home of S Poetry and A Guide for the Unwilling S User) Richard Pearson

Re: [R] Sum(Random Numbers)=100

2008-07-08 Thread Patrick Burns
example constraints are that each position should have no more than 5% weight, and the volatility should be no more than 15%. More on random portfolios can be found at http://www.burns-stat.com/pages/Finance/random_portfolios.html Patrick Burns [EMAIL PROTECTED] +44 (0)20 8525 0696 http://www.burns

Re: [R] about EM algorithm

2008-07-08 Thread Patrick Burns
I don't think there can be. The EM algorithm isn't really an algorithm -- it's an outline for an algorithm. Patrick Burns [EMAIL PROTECTED] +44 (0)20 8525 0696 http://www.burns-stat.com (home of S Poetry and A Guide for the Unwilling S User) Peng Jiang wrote: Hi, dear R experts

Re: [R] [SPAM] - constructing arbitrary (positive definite) covariance matrix - Found word(s) list error in the Text body

2008-06-26 Thread Patrick Burns
of the first two. Patrick Burns [EMAIL PROTECTED] +44 (0)20 8525 0696 http://www.burns-stat.com (home of S Poetry and A Guide for the Unwilling S User) [EMAIL PROTECTED] wrote: Well, if you think about the geometry, all correlations equal usually won't work. Think of the SDs as the sides of a simplex

Re: [R] weighted inverse chi-square method for combining p-values

2008-06-25 Thread Patrick Burns
Are you sure you want to use Fisher's method? http://www.burns-stat.com/pages/Working/perfmeasrandport.pdf page 13 shows an example where Fisher's method is not attractive, but Stouffer's method gives reasonable results. Weighting in Stouffer's method is straightforward. Patrick Burns [EMAIL

Re: [R] Improving data processing efficiency

2008-06-06 Thread Patrick Burns
One thing that is likely to speed the code significantly is if you create 'result' to be its final size and then subscript into it. Something like: result[i, ] - bestpeer (though I'm not sure if 'i' is the proper index). Patrick Burns [EMAIL PROTECTED] +44 (0)20 8525 0696 http://www.burns

Re: [R] Improving data processing efficiency

2008-06-06 Thread Patrick Burns
Burns said the following: One thing that is likely to speed the code significantly is if you create 'result' to be its final size and then subscript into it. Something like: result[i, ] - bestpeer (though I'm not sure if 'i' is the proper index). Patrick Burns [EMAIL PROTECTED] +44 (0)20

Re: [R] Improving data processing efficiency

2008-06-06 Thread Patrick Burns
] On Behalf Of Patrick Burns Sent: Friday, June 06, 2008 12:04 PM To: Daniel Folkinshteyn Cc: r-help@r-project.org Subject: Re: [R] Improving data processing efficiency That is going to be situation dependent, but if you have a reasonable upper bound, then that will be much easier and not far from

Re: [R] Securities earning covariance

2008-06-05 Thread Patrick Burns
are going, a factor model variance may be better. You can get 'factor.model.stat' from the public domain area of the Burns Statistics website. This is especially useful if there are missing values in your matrix. Patrick Burns [EMAIL PROTECTED] +44 (0)20 8525 0696 http://www.burns-stat.com (home

Re: [R] how to bind lists recursively

2008-05-28 Thread Patrick Burns
. Patrick Burns [EMAIL PROTECTED] +44 (0)20 8525 0696 http://www.burns-stat.com (home of S Poetry and A Guide for the Unwilling S User) apparently similar a - list(0) for(i in 1:1) a - c(a, list(i)) will take a lot longer, although the result is the same. For example: system.time

Re: [R] Pros and Cons of R

2008-05-22 Thread Patrick Burns
platforms. As for installation problems with Linux, some people do have problems but I don't think that is the typical experience. Patrick Burns [EMAIL PROTECTED] +44 (0)20 8525 0696 http://www.burns-stat.com (home of S Poetry and A Guide for the Unwilling S User) Monica Pisica wrote: Thanks

Re: [R] A very simple question

2008-05-15 Thread Patrick Burns
There have been several solutions like: k[k != 3] The more general form of this idea is: k[!(k %in% 3)] Sticking closer to the original form would be: out - which(k == 3) if(length(out)) k[-out] else k Patrick Burns [EMAIL PROTECTED] +44 (0)20 8525 0696 http://www.burns-stat.com (home of S

Re: [R] merge numerous columns of unequal length

2008-05-06 Thread Patrick Burns
the idea of spreadsheet out of your head. (It is probably best anyway.) Patrick Burns [EMAIL PROTECTED] +44 (0)20 8525 0696 http://www.burns-stat.com (home of S Poetry and A Guide for the Unwilling S User) T.D.Rudolph wrote: I have numerous objects, each containing continuous data representing the same

Re: [R] Generating a new matrix using rbinom and a matrix of probabilities.

2008-03-11 Thread Patrick Burns
I think the following does what you want: probMatrix - matrix(runif(5 * 5), 5, 5) binomialMatrix - matrix(rbinom(5 * 5, 1, probMatrix), 5, 5) Patrick Burns [EMAIL PROTECTED] +44 (0)20 8525 0696 http://www.burns-stat.com (home of S Poetry and A Guide for the Unwilling S User) Economics Guy

Re: [R] listing components of an object

2008-03-03 Thread Patrick Burns
Does names(obj) do what you want? Patrick Burns [EMAIL PROTECTED] +44 (0)20 8525 0696 http://www.burns-stat.com (home of S Poetry and A Guide for the Unwilling S User) Nair, Murlidharan T wrote: Is there a method to list the components of an object, instead of looking at the help

Re: [R] [OT] normal (as in Guassian)

2008-03-03 Thread Patrick Burns
Douglas Bates wrote: On Mon, Mar 3, 2008 at 8:25 AM, Duncan Murdoch [EMAIL PROTECTED] wrote: On 3/3/2008 9:10 AM, Rogers, James A [PGRD Groton] wrote: As someone of partly French heritage, I would also ask how this distribution came to be called Gaussian. It seems very unfair to de

Re: [R] Cross Validation

2008-02-27 Thread Patrick Burns
http://www.burns-stat.com/pages/Tutor/bootstrap_resampling.html may be of some use to you. Patrick Burns [EMAIL PROTECTED] +44 (0)20 8525 0696 http://www.burns-stat.com (home of S Poetry and A Guide for the Unwilling S User) Carla Rebelo wrote: Hello, How can I do a cross validation in R

Re: [R] Question in R

2008-02-02 Thread Patrick Burns
Perhaps the 'page' function? Patrick Burns [EMAIL PROTECTED] +44 (0)20 8525 0696 http://www.burns-stat.com (home of S Poetry and A Guide for the Unwilling S User) Oliver Herbst wrote: HI, can anybody help me how to observe or read the output of an r command pagewise? (E.g. to make a break

Re: [R] Linux, UNIX, XP32, Vista X64 or ...? [SEC=UNCLASSIFIED]

2008-01-25 Thread Patrick Burns
, and have never had any problems. Patrick Burns [EMAIL PROTECTED] +44 (0)20 8525 0696 http://www.burns-stat.com (home of S Poetry and A Guide for the Unwilling S User) [EMAIL PROTECTED] wrote: Hi Peter, Thank you for the quick answer. Given that we have UNIX system available here in Geoscience

Re: [R] FW: R memory management

2007-12-08 Thread Patrick Burns
of times. Patrick Burns [EMAIL PROTECTED] +44 (0)20 8525 0696 http://www.burns-stat.com (home of S Poetry and A Guide for the Unwilling S User) Yuri Volchik wrote: Hi, I'm using R to collect data for a number of exchanges through a socket connection and constantly running into memory problems

Re: [R] Fwd: how to calculate the return?

2007-11-24 Thread Patrick Burns
You don't need a loop. If 'data' is a matrix of prices: re - diff(log(data)) creates a matrix of returns. Patrick Burns [EMAIL PROTECTED] +44 (0)20 8525 0696 http://www.burns-stat.com (home of S Poetry and A Guide for the Unwilling S User) Denver XU wrote: hi,scionforbai, Thank you very

Re: [R] PCA with NA

2007-11-23 Thread Patrick Burns
no missing values. If that doesn't work for you, then I would guess that doing missing value imputation could be another approach. I'm sure there be dragons there -- perhaps others on the list know where they lie. Patrick Burns [EMAIL PROTECTED] +44 (0)20 8525 0696 http://www.burns-stat.com (home of S

Re: [R] R routines vs. MATLAB/SPSS Routines

2007-10-27 Thread Patrick Burns
in learning thus has a long-term payoff. I don't agree with the characterization of appropriate fields for R. R is rapidly gaining acceptance in finance. Demand seems to be outstripping supply for people in finance with R skills. Patrick Burns [EMAIL PROTECTED] +44 (0)20 8525 0696 http://www.burns

Re: [R] How to speed up multiple for loop over list of data frames

2007-10-17 Thread Patrick Burns
I suspect the vast majority of time is because of growing objects. Preallocate 'iv', 'jv', 'rho_sv' and 'rho_pv' to be their final length and then subscript into them with their values. Patrick Burns [EMAIL PROTECTED] +44 (0)20 8525 0696 http://www.burns-stat.com (home of S Poetry and A Guide

Re: [R] R routines vs. MATLAB/SPSS Routines

2007-10-03 Thread Patrick Burns
I don't think it is so much that the R routines work faster/more efficiently/more accurately but that the user works faster/more efficiently/ more accurately. Patrick Burns [EMAIL PROTECTED] +44 (0)20 8525 0696 http://www.burns-stat.com (home of S Poetry and A Guide for the Unwilling S User

Re: [R] optimize() stuck in local plateau ?

2007-10-01 Thread Patrick Burns
Given a univariate problem where the maximum must be between -1 and 1, I would test with a grid of points, then refine that if necessary. Patrick Burns [EMAIL PROTECTED] +44 (0)20 8525 0696 http://www.burns-stat.com (home of S Poetry and A Guide for the Unwilling S User) Mike Lawrence wrote: Hi

Re: [R] Who uses R?

2007-09-25 Thread Patrick Burns
numerical bug in Excel 2007. Guess what 850 * 77.1 equals. Patrick Burns [EMAIL PROTECTED] +44 (0)20 8525 0696 http://www.burns-stat.com (home of S Poetry and A Guide for the Unwilling S User) Eleni Rapsomaniki wrote: Dear R users, I have started work in a Statistics government department and I am

Re: [R] Who uses R?

2007-09-25 Thread Patrick Burns
(Ted Harding) wrote: On 25-Sep-07 12:34:47, Duncan Murdoch wrote: On 9/25/2007 7:45 AM, (Ted Harding) wrote: On 25-Sep-07 11:11:44, Patrick Burns wrote: Just speaking of the field I'm most familiar with, there are now users of R in many of the largest financial companies

<    1   2   3