Re: [R] Google's R Style Guide

2009-08-29 Thread diegol
Max Kuhn wrote: > > Perhaps this is obvious, but Ive never understood why this is the > general convention: > >> An opening curly brace should never go on its own line; > > I tend to do this: > > f <- function() > { > if (TRUE) > { > cat("TRUE!!\n") > } else { > cat("FAL

Re: [R] Same initial seed

2009-06-28 Thread diegol
Great. Your suggestion is most welcome, everything is clear now. Thank you for your time, Duncan! Regards, Diego Duncan Murdoch-2 wrote: > > diegol wrote: >> Hello, >> >> I have tried a few searches without luck before posting, since this one >> seems a p

Re: [R] Same initial seed

2009-06-28 Thread diegol
Update: I had tried, immediately after launching the console: > rm(list=ls()) which did not seem to affect .Random.seed. But now I try: > rm(.Random.seed) which seems to force .Random.seed to regenerate from current time. Can I feel confident to have solved the problem? Thanks!

[R] Same initial seed

2009-06-28 Thread diegol
Hello, I have tried a few searches without luck before posting, since this one seems a pretty basic question. I am using R 2.7.0 on WinXP, as I have long started using this version for my thesis work and am reluctant to update fearing consistency/backward compatibility issues could happen. I no

Re: [R] Testing for Inequality à la "select case"

2009-03-15 Thread diegol
> That's what I meant by element-by -element. A vector in R corresponds > to a row or a column in Excel, and a vector operation in R corresponds > to a row or column of formulae, e.g. > > Excel > A B C > 1) 5 10 a1+b1 (= 15) > 2) 3 2 a2+b2 (= 5) > etc. >

Re: [R] Testing for Inequality à la "select case"

2009-03-15 Thread diegol
(percent, z, drop = FALSE) <- perc >> split(minimum, z, drop = FALSE) <- min >> >> mydf <- data.frame(x, range= z, percent, minimum) >> >> mydf <- within(mydf, product <- x * percent) >> >> mydf$result <- with(mydf, ifelse(product < minimum

Re: [R] Testing for Inequality à la "select case"

2009-03-15 Thread diegol
you could get a cleaner solution using ?cut to split your data > in given ranges (the break argument), and then using this factor to > give the appropriate percentage. > > > Hope this helps, > > baptiste > > On 15 Mar 2009, at 20:12, diegol wrote: > >> &

Re: [R] Testing for Inequality à la "select case"

2009-03-15 Thread diegol
min = c(0,14,40,75,175,250)*1000 function(x) {if (length(x) >1) stop("x must have length 1") idx <- which(x<=range)[1] max( x*perc[idx], min[idx] ) } }) Thank you very much for your help. Diego Stavros Macrakis-2 wrote: > > On Sun, Mar 15, 2

[R] Testing for Inequality à la "select case"

2009-03-15 Thread diegol
Using R 2.7.0 under WinXP. I need to write a function that takes a non-negative vector and returns the parallell maximum between a percentage of this argument and a fixed value. Both the percentages and the fixed values depend on which interval x falls in. Intervals are as follows: >From |

Re: [R] Percent damage distribution

2008-12-27 Thread diegol
it with a standard method. Regards, Diego Ben Bolker wrote: > > diegol gmail.com> writes: > >> >> >> R version: 2.7.0 >> Running on: WinXP >> >> I am trying to model damage from fire losses (given that the loss >> occurred). >&

Re: [R] Percent damage distribution

2008-12-26 Thread diegol
d back to Ben yesterday and the post was not accepted yet, so it probably does not show in the thread, but there I stated I was going to use a beta distribution, so my problem is solved by now. If you want, we may continue this conversation privately. Many thanks. On Thu, 25 Dec 2008, diegol wrote:

[R] Percent damage distribution

2008-12-25 Thread diegol
R version: 2.7.0 Running on: WinXP I am trying to model damage from fire losses (given that the loss occurred). Since I have the individual insured amounts, rather than sampling dollar damage from a continuous distribution ranging from 0 to infinity, I want to sample from a percent damage distrib

[R] Adding x-axis values to a histogram

2008-03-11 Thread diegol
Dear useRs, Is there a way one can add x-axis values to a histogram? Example: z = rgamma(n=1000, shape = 8, scale = 1000) hist(z, breaks = 30) Currently I see 4 x-axis values: 5000, 1, 15000, 2. Can I add more values or modify the ones currently showing? I tried ?hist, yet couldn't work

Re: [R] Announce: Contributed Documentation

2008-01-05 Thread diegol
Dear Prof. Vincent Goulet, Vincent Goulet wrote: > > If there is any interest, I might prepare an English version of > the document. > Maybe a little little late, but if by chance you happened to create the English version of the document, I would also be interested in reading it. Thank you

Re: [R] updating R version and packages.

2007-12-31 Thread diegol
A menu-driven alternative: in the R Console GUI, select Packages | Update packages. Milton Cezar Ribeiro wrote: > > Dear All, > > Is there a way of I update automatically the R version and the respective > packages which I have installed on my computer? Case not, how can I know > about what p

Re: [R] MS Excel Data

2007-12-08 Thread diegol
Prof Brian Ripley wrote: > > Why not read the 'R Data Import/Export' manual? It ships with R, or can > be accessed from http://cran.r-project.org/manuals.html . > Dear Professor, I'd like to make a suggestion. When I first read some articles ands posts about R's wonderful capabilities, th

Re: [R] Packages - a great resource, but hard to find the right one

2007-11-25 Thread diegol
Hi all, I've been reading your suggestions and I'd like to share my thoghts, which might be common to people not so deeply involved in the development of R. One of the advantages of R is that it's an open source software, meaning that anyone can peruse the code for whatever purpose they might ha