Re: [R] sequence with start and stop positions

2008-08-26 Thread Christos Hatzis
Try: unlist(mapply(seq, c(1,20,50), c(7,25,53))) [1] 1 2 3 4 5 6 7 20 21 22 23 24 25 50 51 52 53 -Christos -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Chris Oldmeadow Sent: Tuesday, August 26, 2008 12:42 AM To: r-help@r-project.org

Re: [R] lattice plotting character woes

2008-08-26 Thread Murray Jorgensen
Hi Rolf, Hi Mark, Hi List, I have not digested Rolf's response yet. It may well answer my problems. In the meantime I have some reproducible code which actually shows my problem: patches - structure(list(URBAN_AREA = structure(c(2L, 19L, 23L, 2L, 19L, 23L, 2L, 19L, 23L, 2L, 19L, 23L),

Re: [R] Displaying Equations in Documentation

2008-08-26 Thread Prof Brian Ripley
On Tue, 26 Aug 2008, Rolf Turner wrote: On 26/08/2008, at 4:50 AM, Jarrett Byrnes wrote: I'm currently working on writing up some documentation for some of my code, but am having the darndest time coding in equations. For example, the equation in the following: \details{ Calculated the R

Re: [R] problem using cat within Sweave code chunks when fig=TRUE

2008-08-26 Thread Prof Brian Ripley
On Mon, 25 Aug 2008, Wolfgang Huber wrote: Hi Paul, You could label=codechunk1a,fig=TRUE,include=FALSE= plot(1:10) @ label=codechunk1b= cat(figure1.eps caption goes here \n,file=readme.txt,append=T) cat(figure1.pdf caption goes here \n,file=readme.txt,append=T) @ You can suppress one of the

[R] parse and eval character vector

2008-08-26 Thread Rob Foxall
Dear R-help, I have a character vector, some elements will be numeric, some not, and some even empty. E.g.: temp1 - c(abcd, 2 ,) I'm only interested in the numeric elements, the rest I can just throw away. It is easy enough to loop through the vector: temp - try(eval(parse(text=temp1[1])),

Re: [R] parse and eval character vector

2008-08-26 Thread ONKELINX, Thierry
Just use as.numeric. Non numeric will be NA. So the solution of your problem is na.omit(as.numeric(temp1)) HTH, Thierry ir. Thierry Onkelinx Instituut voor natuur- en bosonderzoek / Research Institute for Nature and

Re: [R] parse and eval character vector

2008-08-26 Thread Rob Foxall
That's great, thanks. I can live with the warnings! Cheers, Rob On Tue, Aug 26, 2008 at 4:49 PM, ONKELINX, Thierry [EMAIL PROTECTED] wrote: Just use as.numeric. Non numeric will be NA. So the solution of your problem is na.omit(as.numeric(temp1)) HTH, Thierry

[R] environments

2008-08-26 Thread Antje
Hi there, I try to understand the usage of environments but I'm not sure if I get it. I wrote a test script like this: testenv - new.env(environment()) myfun - function(x) { print(testvar) testenv$testvar_2 - 20 } environment(myfun) - testenv testenv$testvar - 10

[R] savePlot() does not save plot with format set

2008-08-26 Thread Luis Ridao Cruz
R-help, Whenever I try to save a plot with savePlot the file is not stored in my hard disk with the selected format. Several formats are set and none of them works. I just get the file name with missing extension and it can't be open with programs like Paint and Microsoft Photo Editor Th only one

[R] Variance-covariance matrix

2008-08-26 Thread Laura Bonnett
Dear R help forum, I am using the function 'coxph' to obtain hazard ratios for the comparison of a standard treatment to new treatments. This is easily obtained by fitting the relevant model and then calling exp(coef(fit1)) say. I now want to obtain the hazard ratio for the comparison of two

Re: [R] Output to Latex using Memisc almost works

2008-08-26 Thread Eelke
Thank you Martin, It turned out that my problem was that I used underscores _ in my variable names. No problem for R, but Latex didn't like it. Kind regards, Eelke Martin Elff wrote: On Monday 25 August 2008 (15:36:50), Eelke wrote: Hello, I'm using memisc to output regression results to

Re: [R] Variance-covariance matrix

2008-08-26 Thread Peter Dalgaard
Laura Bonnett wrote: Dear R help forum, I am using the function 'coxph' to obtain hazard ratios for the comparison of a standard treatment to new treatments. This is easily obtained by fitting the relevant model and then calling exp(coef(fit1)) say. I now want to obtain the hazard ratio

[R] options(contrasts)

2008-08-26 Thread David Epstein
Code: options(contrasts) $contrasts factor ordered contr.treatment contr.poly I want to change the first entry ONLY, without retyping contr.poly. How do I do it? I have tried various possibilities and cannot get anything to work. I found out that the response to

Re: [R] Variance-covariance matrix

2008-08-26 Thread Laura Bonnett
The standard treatment is the same in both comparison. How do you do a three-level treatment factor? I thought you had to have a censoring indicator which took values 0 or 1 not 1, 2 or 3? Thanks, Laura On Tue, Aug 26, 2008 at 11:05 AM, Peter Dalgaard [EMAIL PROTECTED]wrote: Laura Bonnett

[R] loop with splitted data

2008-08-26 Thread Knut Krueger
Hi to all, seems to be simple, but I do not find the solution: What must I write for the splitted to get splitted$3$x and splitted$3$x y = c(rep(2,5),rep(3,5)) ma - data.frame(x = 1:10, y=y ) splitted - split(ma, ma$y) for (counter in (min(ma$y):max(ma$y))) { splitted$x } Regards

Re: [R] paste: multiple collapse arguments?

2008-08-26 Thread Henrique Dallazuanna
Try this also: paste(apply(matrix(x, 2), 2, paste, collapse = ' '), collapse = \n) On Mon, Aug 25, 2008 at 8:36 PM, remko duursma [EMAIL PROTECTED] wrote: Dear R-helpers, I have a numeric vector, like: x - c(1,2,3,4,5,6) I make this into a string for output to a text file, separated by

Re: [R] environments

2008-08-26 Thread Henrique Dallazuanna
I think you need assign, see ?assign for more details. On Tue, Aug 26, 2008 at 6:02 AM, Antje [EMAIL PROTECTED] wrote: Hi there, I try to understand the usage of environments but I'm not sure if I get it. I wrote a test script like this: testenv - new.env(environment()) myfun -

Re: [R] savePlot() does not save plot with format set

2008-08-26 Thread Henrique Dallazuanna
You need type the extension of the file: plot(rnorm(10)) savePlot(test.png, type=png) savePlot(test.bmp, type=bmp) On Tue, Aug 26, 2008 at 6:29 AM, Luis Ridao Cruz [EMAIL PROTECTED] wrote: R-help, Whenever I try to save a plot with savePlot the file is not stored in my hard disk with the

Re: [R] options(contrasts)

2008-08-26 Thread Duncan Murdoch
On 26/08/2008 6:30 AM, David Epstein wrote: Code: options(contrasts) $contrasts factor ordered contr.treatment contr.poly I want to change the first entry ONLY, without retyping contr.poly. How do I do it? I have tried various possibilities and cannot get anything

Re: [R] How to do a meta-analysis plot

2008-08-26 Thread Michael Dewey
At 19:44 25/08/2008, Jorge Ivan Velez wrote: Dear R-list, I'd like to do a meta-analysis plot similar to Since these plots are known as forest plots ?forestplot might help you. As it says you have to do a bit more work but you do get much more flexibility install.packages('rmeta')

Re: [R] Two envelopes problem

2008-08-26 Thread Jim Lemon
Hi Mario, If I understand your problem statement, the random choice of one of the two envelopes ensures that the probability of choosing one or the other is 0.5. If you find 10 (units, I can't find the pound symbol on this keyboard), there is an equal likelihood that the other envelope contains 5

[R] String search: Return closest match

2008-08-26 Thread Werner Wernersen
Hi, I have to match names where names can be recorded with errors or additions. Now I am searching for a string search function which returns always the closest match. E.g. searching for Washington it should return only Washington but not Washington, D.C. But it also could be that the list

Re: [R] Two envelopes problem

2008-08-26 Thread Jim Lemon
Hi again, Oops, I meant the expected value of the swap is: 5*0.5 + 20*0.5 = 12.5 Too late, must get to bed. Jim __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide

Re: [R] How to do a meta-analysis plot

2008-08-26 Thread Jonathan Baron
Another way to do it (based on summary data): http://finzi.psych.upenn.edu/R/Rhelp02a/archive/131342.html -- Jonathan Baron, Professor of Psychology, University of Pennsylvania Home page: http://www.sas.upenn.edu/~baron __ R-help@r-project.org

Re: [R] Two envelopes problem

2008-08-26 Thread Duncan Murdoch
On 26/08/2008 7:54 AM, Jim Lemon wrote: Hi again, Oops, I meant the expected value of the swap is: 5*0.5 + 20*0.5 = 12.5 Too late, must get to bed. But that is still wrong. You want a conditional expectation, conditional on the observed value (10 in this case). The answer depends on the

Re: [R] savePlot() does not save plot with format set

2008-08-26 Thread S Ellison
Strictly, you need to type the extension _if your filename or path include a period (.)_ but not otherwise. The filename test alone will be saved as paste(test,type). So will, for example, /plots/test. But filenames such as test.it or ../plots/test will not include the extension automatically.

Re: [R] Using interactive plots to get information about data points

2008-08-26 Thread Michael Bibo
jcarmichael jcarmichael314 at gmail.com writes: Thank you for the GGobi reference, it is a very handy tool! My main goal, however, is to be able to identify univariate outliers (with boxplots for example), and I'm having a hard time getting the rggobi package to do that. Hmmm... I

Re: [R] SQL Primer for R

2008-08-26 Thread ivo welch
Sorry, chaps. I need one more: dbDisconnect(con.in) Error in sqliteCloseConnection(conn, ...) : RS-DBI driver: (close the pending result sets before closing this connection) I am pretty sure I have fetched everything there is to be fetched. I am not sure what I need to do to say goodbye

Re: [R] environments

2008-08-26 Thread Douglas Bates
On Tue, Aug 26, 2008 at 6:07 AM, Henrique Dallazuanna [EMAIL PROTECTED] wrote: I think you need assign, see ?assign for more details. On Tue, Aug 26, 2008 at 6:02 AM, Antje [EMAIL PROTECTED] wrote: Hi there, I try to understand the usage of environments but I'm not sure if I get it. I wrote

Re: [R] String search: Return closest match

2008-08-26 Thread Richard . Cotton
I have to match names where names can be recorded with errors or additions. Now I am searching for a string search function which returns always the closest match. E.g. searching for Washington it should return only Washington but not Washington, D.C. But it also could be that the list

Re: [R] environments

2008-08-26 Thread Peter Dalgaard
Douglas Bates wrote: As Henrique said, the canonical way of assigning a value within an environment is the assign. A more obscure, but also more effective, approach is evalq which quotes an expression then evaluates it in the given environment. For example env - new.env() evalq({aa -

Re: [R] environments

2008-08-26 Thread Antje
Okay, I see, there is no really easy way (I was wondering whether I can set an environment as default for new created variables). Is there any difference if I call myenv$myvar - 10 or assign(myvar,10, env=myenv) ? Antje Douglas Bates schrieb: On Tue, Aug 26, 2008 at 6:07 AM, Henrique

[R] svymeans question

2008-08-26 Thread Doran, Harold
I have the following code which produces the output below it clus1 - svydesign(ids = ~schid, data = lower_dat) items - as.formula(paste( ~ , paste(lset, collapse= +))) rr1 - svymean(items, clus1, deff='replace', na.rm=TRUE) rr1 mean SE DEff W525209 0.719748 0.015606 2.4932

Re: [R] environments

2008-08-26 Thread Peter Dalgaard
Antje wrote: Okay, I see, there is no really easy way (I was wondering whether I can set an environment as default for new created variables). Is there any difference if I call myenv$myvar - 10 or assign(myvar,10, env=myenv) ? No. And with(myenv, myvar - 10) is also the same. However, you

Re: [R] options(contrasts)

2008-08-26 Thread Ted Harding
On 26-Aug-08 10:30:30, David Epstein wrote: Code: options(contrasts) $contrasts factor ordered contr.treatment contr.poly I want to change the first entry ONLY, without retyping contr.poly. How do I do it? I have tried various possibilities and cannot get

[R] processing subset lists and then plot(density())

2008-08-26 Thread stephen sefick
d - structure(list(Site = structure(c(8L, 12L, 7L, 6L, 11L, 5L, 10L, 4L, 3L, 2L, 1L, 9L, 8L, 12L, 7L, 6L, 11L, 5L, 10L, 4L, 3L, 2L, 1L, 9L, 8L, 12L, 7L, 6L, 11L, 5L, 10L, 4L, 3L, 2L, 1L, 9L, 8L, 12L, 7L, 6L, 11L, 5L, 10L, 4L, 3L, 2L, 1L, 9L, 8L, 12L, 7L, 6L, 11L, 5L, 10L, 4L, 3L, 2L, 1L, 9L, 8L,

Re: [R] Two envelopes problem

2008-08-26 Thread Mark Leeds
Duncan: I think I see what you're saying but the strange thing is that if you use the utility function log(x) rather than x, then the expected values are equal. Somehow, if you are correct and I think you are, then taking the log , fixes the distribution of x which is kind of odd to me. I'm sorry

Re: [R] String search: Return closest match

2008-08-26 Thread Werner Wernersen
That works perfectly, great. Thanks a lot for that Richard! Werner - Ursprüngliche Mail Von: [EMAIL PROTECTED] [EMAIL PROTECTED] An: Werner Wernersen [EMAIL PROTECTED] CC: [EMAIL PROTECTED]; [EMAIL PROTECTED] Gesendet: Dienstag, den 26. August 2008, 14:10:11 Uhr Betreff: Re: [R]

Re: [R] processing subset lists and then plot(density())

2008-08-26 Thread ONKELINX, Thierry
Here's a solution with ggplot2 library(ggplot2) ggplot(na.omit(d), aes(x = EPT.Taxa, colour = Site)) + geom_density() ggplot(na.omit(d), aes(x = EPT.Taxa)) + geom_density() + facet_grid(Site ~ .) HTH, Thierry ir.

Re: [R] Two envelopes problem

2008-08-26 Thread Mark Difford
... To pick up on what Mark has said: it strikes me that this is related to the simplex, where the bounded nature of the vector space means that normal arithmetical operations (i.e. Euclidean) don't work---that is, they can be used, but the results are wrong. Covariances and correlations for

Re: [R] savePlot() does not save plot with format set

2008-08-26 Thread Monica Pisica
Did you try: savePlot(test.bmp, type = bmp) Monica Message: 118 Date: Tue, 26 Aug 2008 10:29:13 +0100 From: Luis Ridao Cruz Subject: [R] savePlot() does not save plot with format set To: Message-ID: Content-Type:

Re: [R] processing subset lists and then plot(density())

2008-08-26 Thread stephen sefick
definitly need to look into ggplot- very cool. thanks On Tue, Aug 26, 2008 at 10:20 AM, ONKELINX, Thierry [EMAIL PROTECTED] wrote: Here's a solution with ggplot2 library(ggplot2) ggplot(na.omit(d), aes(x = EPT.Taxa, colour = Site)) + geom_density() ggplot(na.omit(d), aes(x = EPT.Taxa)) +

Re: [R] How to do a meta-analysis plot

2008-08-26 Thread Thomas Lumley
On Mon, 25 Aug 2008, Jorge Ivan Velez wrote: My problem is that I don't have the raw data as rmeta _requires_ and, even when I have my data set in the _same_ (?) format that summary(a), when I tried plot(mydata) it doesn't work. No, it doesn't _require_ that. If you just want a forest plot

Re: [R] SQL Primer for R

2008-08-26 Thread Thomas Lumley
On Tue, 26 Aug 2008, ivo welch wrote: Sorry, chaps. I need one more: dbDisconnect(con.in) Error in sqliteCloseConnection(conn, ...) : RS-DBI driver: (close the pending result sets before closing this connection) I am pretty sure I have fetched everything there is to be fetched.

Re: [R] Two envelopes problem

2008-08-26 Thread Heinz Tuechler
Mark My experience was similarly frustrating. Maybe formulating the problem a bit differently could help to clarify it. State it like this: Someone chooses an amount of money x. He puts 2x/3 of it in one envelope and x/3 in an other. There is no assumption about the distribution of x. If you

[R] more dot plots on 1 page

2008-08-26 Thread Van den Berge Joke
Hi, I would like to have six dot plots on one page. I make the plots in a 'for loop' because it is six times the same graph but for different subjects (species). I tried it with par(mfrow=c(3,2), oma=c(3,3,2,0), mar=c(2,2,2,2)); but this does not work for dot plots apparently. Then I tried

Re: [R] Two envelopes problem

2008-08-26 Thread Duncan Murdoch
On 8/26/2008 9:51 AM, Mark Leeds wrote: Duncan: I think I see what you're saying but the strange thing is that if you use the utility function log(x) rather than x, then the expected values are equal. I think that's more or less a coincidence. If I tell you that the two envelopes contain X

[R] embedded examples

2008-08-26 Thread EBo
I am working on embedding R into some visualization research programs. Can any point me to a collection of embedded and standalone R/C/C++ examples? The documentation is to terse for me to figure out how to develop this and I am looking for some simple examples to study. Thanks and best

Re: [R] environments

2008-08-26 Thread Duncan Murdoch
On 8/26/2008 9:44 AM, Peter Dalgaard wrote: Antje wrote: Okay, I see, there is no really easy way (I was wondering whether I can set an environment as default for new created variables). Is there any difference if I call myenv$myvar - 10 or assign(myvar,10, env=myenv) ? No. And with(myenv,

Re: [R] Two envelopes problem

2008-08-26 Thread Mark Leeds
Hi Duncan: I think I get you. Once one takes expectations, there is an underlying assumption about the distribution of X and , in this problem, we don't have one so taking expectations has no meaning. If the log utility fixing the problem is purely just a coincidence, then it's surely an odd one

Re: [R] embedded examples

2008-08-26 Thread hadley wickham
You might also want to look at existing visualisation applications that connect with R: * http://ggobi.org * http://rosuda.org/mondrian * http://rosuda.org/software/Gauguin/gauguin.html to name a few. Hadley On Tue, Aug 26, 2008 at 10:31 AM, EBo [EMAIL PROTECTED] wrote: I am working on

Re: [R] permutation cycles

2008-08-26 Thread Martin Maechler
I'm replying in public to this, since it relates to an R-help thread of April 15-16, 2008 (and am also adding back 'References:' to one of those postings of mine). Mark Segal mark at biostat ucsf on Mon, 25 Aug 2008 11:25:05 -0700 writes: Hi Martin, You posted the following

Re: [R] Problem with Integrate for NEF-HS distribution

2008-08-26 Thread Ravi Varadhan
Hi, Simply re-write your integrand as follows: integrand - function(X) {0.5 * cos(theta) * 2 / (exp(-pi*X/2 - X*theta) + exp(pi*X/2 - X*theta)) } Now the problem goes away. theta - -1 integrate(integrand, -Inf, 1) 0.9842315 with absolute error 1.2e-05 This would work for all theta such

[R] R binaries for linux on G4 Powerpc?

2008-08-26 Thread Tariq Perwez
Hi Everyone I just installed Yellow Dog Linux (v 5.02) on an old G4 Powerpc replacing the Mac OSX. The system is running beautifully. I would like to install R on this system. I am not sure how to go about doing it. I have installed R on my Ubuntu system as well as on Mac OSX but there are

[R] package install failure

2008-08-26 Thread George Georgalis
Hello, the arm package is failing to install, it says I need gnu make but it's not clear how I specify which make to use in the R environment. For example I already have gmake installed. How to I instruct R to use it? * Installing *source* package 'Matrix' ... usage: make [-BeikNnqrstWX] [-D

[R] Dramatic slowdown of R 2.7.2?

2008-08-26 Thread Marek Wielgosz
Dear R users/developers, simple comparison of code execution time of R 2.7.1 and R 2.7.2 shows a dramatic slowdown of the newer version. Rprof() identifies .Call function as a main cause (see the code below). What happened with R 2.7.2? Kind regards Marek Wielgosz Bayes Consulting

[R] no output when run densityplot...

2008-08-26 Thread John Sanabria
Hi, I have downloaded a R script from http://www.wessa.net/rwasp_edauni.wasp#output. This script produces a densityplot graphic, amongst others, when is executed from the web page. However, when I run it in my machine the *densityplot* function produces any output, I mean a blank graphic. But,

Re: [R] Problem with Integrate for NEF-HS distribution

2008-08-26 Thread xia wang
Thanks so much. It works well in my MCMC sampling. May I know why re-writing the integrand can solve the problem? I have been thinking it was the skewness of the distribution brought the error. Thanks! Xia From: [EMAIL PROTECTED] To: [EMAIL PROTECTED]; r-help@r-project.org Subject:

[R] plot3d origin

2008-08-26 Thread Chibisi Chima-Okereke
Hi all, I am trying to do a 3d plot where the x,y,z axes intersects with the origin (0,0,0) using the plot3d() funtion in the rgl package without success. I looked back at the past archives on this subject and someone suggested using djmrgl package. I searched and found it, installed it but when

Re: [R] sequence with start and stop positions

2008-08-26 Thread Charles C. Berry
On Tue, 26 Aug 2008, Chris Oldmeadow wrote: Hi, I have a vector of start positions, and another vector of stop positions, eg start-c(1,20,50) stop-c(7,25,53) Is there a quick way to create a sequence from these vectors? new-c(1,2,3,4,5,6,7,20,21,22,23,24,25,50,51,52,53) Vectorize the

Re: [R] Two envelopes problem

2008-08-26 Thread markleeds
Duncan: Just one more thing which Heinz alerted me to. Suppose that we changed the game so that instead of being double or half of X, we said that one envelope will contain X + 5 and the other contains X-5. So someone opens it and sees 10 dollars. Now, their remaining choices are 5 and 15 so

Re: [R] Two envelopes problem

2008-08-26 Thread Farley, Robert
So if I put $10 and $20 into the envelopes, then told you that the values were multiples of $10, it would be wrong for you to assess probabilities on $100, $1,000,000 and so on? :-) But what if you reasoned that there were far more multiples of 10 above 20 than below 20? What if I was really

Re: [R] Two envelopes problem

2008-08-26 Thread S Ellison
Duncan Murdoch [EMAIL PROTECTED] 26/08/2008 16:17:34 If this is indeed the case, switch; the expected gain is positive because _you already have the information that you hold the median value of the three possibilities_. The tendency when presented with the problem is to reason as if this is

Re: [R] Maintaining repeated ID numbers when transposing with reshape

2008-08-26 Thread jcarmichael
Thank you for your suggestion, I will play around with it. I guess my concern is that I need each test result to occupy its own cell rather than have one or more in the same row. Adaikalavan Ramasamy-2 wrote: There might be a more elegant way of doing this but here is a way of doing it

[R] Latin squares in R

2008-08-26 Thread Edna Bell
Dear R Gurus: What would be the best way to evaluate a Latin square problem, please? Does it work in Rcmdr, please? thanks, Edna Bell __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide

Re: [R] Two envelopes problem

2008-08-26 Thread Duncan Murdoch
On 8/26/2008 1:12 PM, [EMAIL PROTECTED] wrote: Duncan: Just one more thing which Heinz alerted me to. Suppose that we changed the game so that instead of being double or half of X, we said that one envelope will contain X + 5 and the other contains X-5. So someone opens it and sees 10

Re: [R] plot3d origin

2008-08-26 Thread Duncan Murdoch
On 8/26/2008 1:05 PM, Chibisi Chima-Okereke wrote: Hi all, I am trying to do a 3d plot where the x,y,z axes intersects with the origin (0,0,0) using the plot3d() funtion in the rgl package without success. I looked back at the past archives on this subject and someone suggested using djmrgl

Re: [R] Dramatic slowdown of R 2.7.2?

2008-08-26 Thread Peter Dalgaard
Marek Wielgosz wrote: Dear R users/developers, simple comparison of code execution time of R 2.7.1 and R 2.7.2 shows a dramatic slowdown of the newer version. Rprof() identifies .Call function as a main cause (see the code below). What happened with R 2.7.2? I don't see much of a

Re: [R] Two envelopes problem

2008-08-26 Thread markleeds
beautiful. now, i think i got it. the fact that the calculation works in the additive case doesn't make the calculation correct. the expected value calculation is kind of assuming that the person putting the things in the envelopes chooses what's in the second envelope AFTER knowing

[R] stats tests on large tables

2008-08-26 Thread Richard Emes
I have a large table of data which i can read in using read.table. I then want to conduct various tests on the data. Is there a simple way to conduct these tests by specifying the column headers which relate to different conditions of the experiment? e.g. data1 - read.table(test.table,

Re: [R] Problem with Integrate for NEF-HS distribution

2008-08-26 Thread xia wang
Thanks. I revised the code but it doesn't make difference. The cause of the error is just as stated in the ?integrate If the function is approximately constant (in particular, zero) over nearly all its range it is possible that the result and error estimate may be seriously wrong. I have

Re: [R] sequence with start and stop positions

2008-08-26 Thread Ray Brownrigg
And somewhat faster still (YMMV): unlist(mapply(:, start, stop)) HTH, Ray Brownrigg Victoria University of Wellington Christos Hatzis wrote: Try: unlist(mapply(seq, c(1,20,50), c(7,25,53))) [1] 1 2 3 4 5 6 7 20 21 22 23 24 25 50 51 52 53 -Christos -Original Message-

Re: [R] Problem with Integrate for NEF-HS distribution

2008-08-26 Thread Ravi Varadhan
Try the following: sech-function(X) 2/(exp(-X)+exp(X)) your.integrand - function(X) {0.5*cos(theta)*exp(X*theta)*sech(pi*X/2)} my.integrand - function(X) {0.5 * cos(theta) * 2 / (exp(-pi*X/2 - X*theta) + exp(pi*X/2 - X*theta)) } theta - -1 my.integrand(-800) your.integrand(-800) Do you

Re: [R] Two envelopes problem

2008-08-26 Thread John C Frain
A very important point is missing here. If there is x in one envelope and 2x in the other the expected gain is 3x/2. If the idea is to switch after observing the second envelope the expected gain is again 3x/2. In the case being put x will be either 5 or 10. But x is a parameter and in this

[R] error message in cor.dist

2008-08-26 Thread Tanya Yatsunenko
Hello, I am trying to calculate pairwise Pearson correlation distances, and using biodist package, function cor.dist. I start with a table of 4 rows and about 10 columns. (each of 4 samples, or rows have values in each of the 10 categories, no zeros or NAs). I am getting an error message:

Re: [R] stats tests on large tables

2008-08-26 Thread John Kane
Try t.test(data1[,1],data1[,2]) for the first two columns of data1. --- On Tue, 8/26/08, Richard Emes [EMAIL PROTECTED] wrote: From: Richard Emes [EMAIL PROTECTED] Subject: [R] stats tests on large tables To: r-help@r-project.org Received: Tuesday, August 26, 2008, 11:52 AM I have a

Re: [R] Problem with Integrate for NEF-HS distribution

2008-08-26 Thread xia wang
Got it. Thanks so much! Xia From: [EMAIL PROTECTED] To: [EMAIL PROTECTED] CC: r-help@r-project.org Subject: RE: [R] Problem with Integrate for NEF-HS distribution Date: Tue, 26 Aug 2008 14:50:18 -0400 Try the following: sech-function(X) 2/(exp(-X)+exp(X)) your.integrand -

[R] How many parameters does my model (gls) have?

2008-08-26 Thread Mark Na
Hello, Is there a way to output the number of parameters in my model (gls)? I can count the number of estimates, but I'd like to use the number of parameters as an R object. Thanks, Mark __ R-help@r-project.org mailing list

Re: [R] How many parameters does my model (gls) have?

2008-08-26 Thread roger koenker
?extractAIC url:www.econ.uiuc.edu/~rogerRoger Koenker email[EMAIL PROTECTED]Department of Economics vox: 217-333-4558University of Illinois fax: 217-244-6678Champaign, IL 61820 On Aug 26, 2008, at 2:27 PM, Mark Na wrote:

Re: [R] R for Windows GUI closes when I try to read.spss

2008-08-26 Thread Roderick Harrison
Can't thank you enough! This worked! N'DOYE Souleymane [EMAIL PROTECTED] 8/26/2008 1:20 AM Hi Roderick, Let me suggest you to save your spss file in txt, and use the read.table or read.csv fonction. That is how I proceed. I hope it will help you, Best regards On Mon, Aug 25, 2008 at

[R] Potential Error/Bug?: addition of NULL during arithmetic

2008-08-26 Thread Eric DeWitt
I encountered an error that does not make sense to me given my reading of the documentation and does not appear to be referenced in the list archives or online. The error occurred when a function received a NULL value rather than a numeric value as a parameter and then attempted to use the

Re: [R] Latin squares in R

2008-08-26 Thread John Kane
Is this of any help http://cran.r-project.org/web/views/ExperimentalDesign.html --- On Tue, 8/26/08, Edna Bell [EMAIL PROTECTED] wrote: From: Edna Bell [EMAIL PROTECTED] Subject: [R] Latin squares in R To: [EMAIL PROTECTED] Received: Tuesday, August 26, 2008, 1:55 PM Dear R Gurus: What

Re: [R] stats tests on large tables

2008-08-26 Thread Rolf Turner
On 27/08/2008, at 3:52 AM, Richard Emes wrote: I have a large table of data which i can read in using read.table. I then want to conduct various tests on the data. Is there a simple way to conduct these tests by specifying the column headers which relate to different conditions of the

[R] lattice: plotting an arbitrary number of panels, defining arbitrary groups

2008-08-26 Thread Alex Karner
R Friends, I'm running R2.7.1 on Windows XP. I'm trying to get some lattice functionality which I have not seen previously documented--I'd like to plot the exact same data in multiple panels but changing the grouping variable each time so that each panel highlights a different feature of the

Re: [R] svymeans question

2008-08-26 Thread James Reilly
On 26/8/08 9:40 AM, Doran, Harold wrote: Computing the mean of the item by itself with svymeans agrees with the sample mean mean(lower_dat$W524787, na.rm=T) [1] 0.8555471 Compare this to the value in the row 9 up from the bottom to see it is different. You might be omitting more cases due

Re: [R] lattice plotting character woes

2008-08-26 Thread Murray Jorgensen
[Rolf, this crosses with your reply. I will look at your email next.] I pasted the wrong code last time. The following code is supposed to illustrate my problem with lattice plotting character changes. patches - structure(list(URBAN_AREA = structure(c(2L, 19L, 23L, 2L, 19L, 23L, 2L, 19L,

Re: [R] loop with splitted data

2008-08-26 Thread jim holtman
Is this what you want: y = c(rep(2,5),rep(3,5)) ma - data.frame(x = 1:10, y=y ) splitted - split(ma, ma$y) for (counter in (min(ma$y):max(ma$y))) + { + cat(counter, :, splitted[[as.character(counter)]]$x, '\n') + } 2 : 1 2 3 4 5 3 : 6 7 8 9 10 On Tue, Aug 26, 2008 at 6:37 AM, Knut Krueger

Re: [R] lattice: plotting an arbitrary number of panels, defining arbitrary groups

2008-08-26 Thread Deepayan Sarkar
On Tue, Aug 26, 2008 at 2:26 PM, Alex Karner [EMAIL PROTECTED] wrote: R Friends, I'm running R2.7.1 on Windows XP. I'm trying to get some lattice functionality which I have not seen previously documented--I'd like to plot the exact same data in multiple panels but changing the grouping

Re: [R] svymeans question

2008-08-26 Thread Doran, Harold
Indeed, missing data are the problem. The function removes any row with missing data and the means are based on the remaining rows. So, I wrote a function that just loops over each variable individually and organizes the data as I need it. -Original Message- From: James Reilly on

Re: [R] loop with splitted data

2008-08-26 Thread Peter Dalgaard
jim holtman wrote: Is this what you want: y = c(rep(2,5),rep(3,5)) ma - data.frame(x = 1:10, y=y ) splitted - split(ma, ma$y) for (counter in (min(ma$y):max(ma$y))) + { + cat(counter, :, splitted[[as.character(counter)]]$x, '\n') + } 2 : 1 2 3 4 5 3 : 6 7 8 9 10 But maybe this

[R] awkward behavior with densityplot function

2008-08-26 Thread John Sanabria
Hi, I have the following script: t.R --- grafica - function() { v - read.csv('preprocessed/komolongma.ece.uprm.edu.active',sep=',') x - as.ts(v$active) bitmap(file=output.png) densityplot(~x,col='blue',main='Density Plot') dev.off() } grafica() t.R --- When I sourced it from

Re: [R] awkward behavior with densityplot function

2008-08-26 Thread Bill.Venables
Lattice functions do not create plots. In this respect they are quite different to functions like plot(...), hist(...) c, which do create plots. If you want to see the plot from a lattice function, you need to print the object it creates. It's the action of printing that creates the graphical

Re: [R] awkward behavior with densityplot function

2008-08-26 Thread Rolf Turner
See FAQ 7.22 On 27/08/2008, at 11:07 AM, John Sanabria wrote: Hi, I have the following script: t.R --- grafica - function() { v - read.csv('preprocessed/komolongma.ece.uprm.edu.active',sep=',') x - as.ts(v$active) bitmap(file=output.png) densityplot(~x,col='blue',main='Density

[R] A Tip: lm, glm, and retained cases

2008-08-26 Thread Ted Harding
Hi Folks, This tip is probably lurking somewhere already, but I've just discovered it the hard way, so it is probably worth passing on for the benefit of those who might otherwise hack their way along the same path. Say (for example) you want to do a logistic regression of a binary response Y on

Re: [R] A Tip: lm, glm, and retained cases

2008-08-26 Thread hadley wickham
On Tue, Aug 26, 2008 at 6:45 PM, Ted Harding [EMAIL PROTECTED] wrote: Hi Folks, This tip is probably lurking somewhere already, but I've just discovered it the hard way, so it is probably worth passing on for the benefit of those who might otherwise hack their way along the same path. Say

Re: [R] Problem with Integrate for NEF-HS distribution

2008-08-26 Thread Moshe Olshansky
If you look at your sech(pi*x/2) you can write it as sech(pi*x/2) = 2*exp(pi*x/2)/(1 + exp(pi*x)) For x -15, exp(pi*x) 10^-20, so for this interval you can replace sech(pi*x/2) by 2*exp(pi*x/2) and so the integral from -Inf to -15 (or even -10 - depends on your accuracy requirements) can be

Re: [R] A Tip: lm, glm, and retained cases

2008-08-26 Thread Ted Harding
On 26-Aug-08 23:49:37, hadley wickham wrote: On Tue, Aug 26, 2008 at 6:45 PM, Ted Harding [EMAIL PROTECTED] wrote: Hi Folks, This tip is probably lurking somewhere already, but I've just discovered it the hard way, so it is probably worth passing on for the benefit of those who might

Re: [R] Do I need a special package to run LSD tests?

2008-08-26 Thread michal33
Thanks for the answers, this one worked: library(Agricolae) michal33 wrote: Hi there, I am trying to run LSD.test(model) I used the following commands: attach(model) m1- glm(ttl.m ~ site+year, family=quasipoisson, data= model) df-df.residual(m1) MSerror-deviance(m1)/df The

Re: [R] Do I need a special package to run LSD tests?

2008-08-26 Thread Rolf Turner
On 27/08/2008, at 12:32 PM, michal33 wrote: Thanks for the answers, this one worked: library(Agricolae) No, it couldn't have. There is no such package as ``Agricolae''. There ***is*** a package called ``agricolae''. :-) cheers, Rolf Turner

Re: [R] A Tip: lm, glm, and retained cases

2008-08-26 Thread Marc Schwartz
on 08/26/2008 07:31 PM (Ted Harding) wrote: On 26-Aug-08 23:49:37, hadley wickham wrote: On Tue, Aug 26, 2008 at 6:45 PM, Ted Harding [EMAIL PROTECTED] wrote: Hi Folks, This tip is probably lurking somewhere already, but I've just discovered it the hard way, so it is probably worth passing

  1   2   >