Re: [R] odfWeave and xtable
It is verry easy with xtable package to make your own xtable.class function, if the class was not implemented in xtable package yet. It would be wonderfull if odfWeave include a framework to make such things. Ps : I would like to know if there is an R project to include all existing format outputs (latex with Sweave, odf with odfWeave, html with rWeaveHTML) and all the wonderful work of their author in a same package or in a same project. All of these use a very similar syntax (foo= R code @), but there is anyway a lot of work to rewrite the R code to make a file writes for Sweave working with odfWeave. A latex file can be convert to latex or rtf, but it depends on external programs not very easy to use. For example, I would imagine an input similar to the syntax of help files (.Rd), but the R code could be include ( foo = R code @), and a Sweave-like function could replace R code with results and convert the file into latex, html or odf. 2008/1/16, ËÎʱ¸è [EMAIL PROTECTED]: Dear Max, If you have plan to add more table making facilities into odfWeave package, I suggest you base your work on Zelig, a R package that tries to provide a unified interface to many existing R statistical libraries, created by Gary King's team at Harvard. I see great potential in this marriage. Best, Shige On Jan 13, 2008 4:09 AM, Max Kuhn [EMAIL PROTECTED] wrote: One thing on my (neglected) to-do list for odfWeave is to create a general class called odf that can be used to create output for common models (lm, glm etc). The nice thing here is that the output from this function could write mixed output. For example, a short paragraph about the specified model, the table for coefficients produced by summary.lm, diagnostic plots etc. Right now, to get the coeffcient table use: #from ?lm ## Annette Dobson (1990) An Introduction to Generalized Linear Models. ## Page 9: Plant Weight Data. ctl - c(4.17,5.58,5.18,6.11,4.50,4.61,5.17,4.53,5.33,5.14) trt - c(4.81,4.17,4.41,3.59,5.87,3.83,6.03,4.89,4.32,4.69) group - gl(2,10,20, labels=c(Ctl,Trt)) weight - c(ctl, trt) lm.D9 - lm(weight ~ group) library(odfWeave) coefTable - summary(lm.D9)$coef colnames(coefTable) - odfTranslate(colnames(coefTable), toR = FALSE) odfTable(coefTable) Max On Jan 12, 2008 1:03 PM, Frank E Harrell Jr [EMAIL PROTECTED] wrote: ??? wrote: Dear All, I am new to odfWeave and was wondering if there are something similar to the xtable package that can automatically convert model coefficients into LaTeX/ODT tables? More generally, how do people who use odfWeave transform model results into tables? The odfTable does not seem to be able to do this (maybe I am wrong, and would appreciate some demos). Thanks. Best, Shige This is not related to tables, but see the latex methods in the Design package. There are methods for using LaTeX to typeset various kinds of regression model fits. -- Max __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Different results in calculating SD of 2 numbers
Hi all, Can anyone tell me why I am getting different results in calculating SD of 2 numbers ? (1.25-0.95)/2 [1] 0.15 sd(c(1.25, 0.95)) [1] 0.2121320 # why it is different from 0.15? Regards, Send instant messages to your online friends http://uk.messenger.yahoo.com [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] help computing the AFTD
I have a data set X. I got the distance matrix using : X2 -daisy(X). I made: X3 - sqrt(X2). To calculate I did This : AFTD - cmdscale(X3) To obtain the draphics of AFTD I use : plot(AFTD). The plotting result is not what I was expecting and not true because I got curviligne. Can someone help me to solve that. I some options to use. Lassana TOURE. [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Different results in calculating SD of 2 numbers
Ron Michael [EMAIL PROTECTED] writes: Can anyone tell me why I am getting different results in calculating SD of 2 numbers ? (1.25-0.95)/2 [1] 0.15 Because this is not the SD? Try (1.25-0.95)/sqrt(2) :-) sd(c(1.25, 0.95)) [1] 0.2121320 # why it is different from 0.15? -- Bjørn-Helge Mevik __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Odp: using table function
Hi replicate your levels frequencies times and use mean, sd, max and quartile or summary. Regards Petr [EMAIL PROTECTED] [EMAIL PROTECTED] napsal dne 15.01.2008 18:55:15: Hi, How to join two large vectors ordered, where one has the variable's levels and another has the frequencies, in way similar to that showing by table function in R console? and considering this two vectors how to use summary function to produce statistical informations like mean, sd, min, max and quartile? Thanks Ricardo Looking for last minute shopping deals? __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Urgent : About R and 4D
Hello, Is it possible to interface R with 4D? Thank you very much for a fast answer. D. LEFLOCH eMail : [EMAIL PROTECTED] [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Different results in calculating SD of 2 numbers
-Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Ron Michael Sent: Wednesday, January 16, 2008 12:15 AM To: [EMAIL PROTECTED] Subject: [R] Different results in calculating SD of 2 numbers Hi all, Can anyone tell me why I am getting different results in calculating SD of 2 numbers ? (1.25-0.95)/2 [1] 0.15 Because the above is not the standard deviation of two numbers. The sample based estimate of the population standard deviation of a set of numbers (which is what sd() computes) is (sum((x-mean(x))^2 )/(length(x)-1))^.5 which for your two numbers would be ( (1.25 - 1.1)^2 + (.95 - 1.1)^2 )^.5 sd(c(1.25, 0.95)) [1] 0.2121320 # why it is different from 0.15? Regards, Hope this is helpful, Dan Daniel Nordlund Bothell, WA USA __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Urgent : About R and 4D
Quoth HAILE A. on Sweetmorn, Chaos 16, 3174: Is it possible to interface R with 4D? Thank you very much for a fast answer. Like the Law of Fives, it depends very much on the ingenuity of the user; how's that for a fast answer? __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Question concerning pdfs
Hi I have a dataset of absolute growth rates g ranging from close to 0 to around whatever of which I want to calculate a pdf. If I use density(g) the pdf will extend to below 0 so I logtransform g and do d - density(log(g)). Now I would like to transform this pdf back, i.e. d$x - exp(d$x) but what do I have to do with d$y? (below is a small example) Thanks for your help, Rainer g - exp(rnorm(100)) ## Just to generate the example data d - density(log(g)) dx - d$x dp - d$y sum(c(0, (diff(dx))) * dp) ## this is equal to one plot(dx, dp) dx2 - exp(dx) dp2 - ??? ## what should I do here? plot(dx2, dp2) ## what should I do here? sum(c(0, (diff(exp(dx2 * dp2)## this should be one sum( c(0, (diff(dx2))) * ( dp1 / c(1, (diff(exp(dx2 * c(0, (diff(dx1 ) ##This is obviously also one, but can I use this to define my dp2? i.e. dp2 - dp1 / c(1, (diff(exp(dx2 * c(0, (diff(dx1 ### __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Different results in calculating SD of 2 numbers
On 16-Jan-08 08:45:04, Martin Maechler wrote: RM == Ron Michael [EMAIL PROTECTED] on Wed, 16 Jan 2008 00:14:56 -0800 (PST) writes: RM Hi all, RM Can anyone tell me why I am getting different results in calculating SD of 2 numbers ? (1.25-0.95)/2 RM [1] 0.15 sd(c(1.25, 0.95)) RM [1] 0.2121320 # why it is different from 0.15? because 1 is different from 2 ! If 2 was 1, than sqrt(2) == 1 as well, but actually I don't think the universe and we all would exist in that case Martin Maechler, ETH Of course we would!! -- Since FALSE implies X is TRUE for any X. But FALSE would also imply that X is FALSE, so you are entitled to your view as well, Martin. With best wishes, Ted. E-Mail: (Ted Harding) [EMAIL PROTECTED] Fax-to-email: +44 (0)870 094 0861 Date: 16-Jan-08 Time: 09:47:20 -- XFMail -- __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] How to interrupt a loop by pressing a key?
Bruno Jesus a écrit : Does anyone know a way of interrupting a loop by pressing a key (besides ctrl-c)? No hit key solution sorry, but may help : if (file.exists('zefile')) stop() allows to stop given zefile is created __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Non linear regression with 2 explanatory variables
Hello! I want to do a non-linear regression with 2 explanatory variables (something like : length ~ a * time * exp( b* temperature)), having a data set (length, time, temperature). Which function could I use (I tried nls but I think it doesn't work) Thanks a lot! Janice __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Question concerning pdfs
I think you need: dx2 - exp(dx) dp2 - dp / dx2 sum(c(0, diff(dx2)) * dp2) I hope it helps. Best, Dimitris Dimitris Rizopoulos Ph.D. Student Biostatistical Centre School of Public Health Catholic University of Leuven Address: Kapucijnenvoer 35, Leuven, Belgium Tel: +32/(0)16/336899 Fax: +32/(0)16/337015 Web: http://med.kuleuven.be/biostat/ http://www.student.kuleuven.be/~m0390867/dimitris.htm - Original Message - From: Rainer M Krug [EMAIL PROTECTED] To: r-help [EMAIL PROTECTED] Sent: Wednesday, January 16, 2008 10:34 AM Subject: [R] Question concerning pdfs Hi I have a dataset of absolute growth rates g ranging from close to 0 to around whatever of which I want to calculate a pdf. If I use density(g) the pdf will extend to below 0 so I logtransform g and do d - density(log(g)). Now I would like to transform this pdf back, i.e. d$x - exp(d$x) but what do I have to do with d$y? (below is a small example) Thanks for your help, Rainer g - exp(rnorm(100)) ## Just to generate the example data d - density(log(g)) dx - d$x dp - d$y sum(c(0, (diff(dx))) * dp) ## this is equal to one plot(dx, dp) dx2 - exp(dx) dp2 - ??? ## what should I do here? plot(dx2, dp2) ## what should I do here? sum(c(0, (diff(exp(dx2 * dp2)## this should be one sum( c(0, (diff(dx2))) * ( dp1 / c(1, (diff(exp(dx2 * c(0, (diff(dx1 ) ##This is obviously also one, but can I use this to define my dp2? i.e. dp2 - dp1 / c(1, (diff(exp(dx2 * c(0, (diff(dx1 ### __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Disclaimer: http://www.kuleuven.be/cwis/email_disclaimer.htm __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Different results in calculating SD of 2 numbers
(Ted Harding) wrote: On 16-Jan-08 08:45:04, Martin Maechler wrote: RM == Ron Michael [EMAIL PROTECTED] on Wed, 16 Jan 2008 00:14:56 -0800 (PST) writes: RM Hi all, RM Can anyone tell me why I am getting different results in calculating SD of 2 numbers ? (1.25-0.95)/2 RM [1] 0.15 sd(c(1.25, 0.95)) RM [1] 0.2121320 # why it is different from 0.15? because 1 is different from 2 ! If 2 was 1, than sqrt(2) == 1 as well, but actually I don't think the universe and we all would exist in that case Martin Maechler, ETH Of course we would!! -- Since FALSE implies X is TRUE for any X. But FALSE would also imply that X is FALSE, so you are entitled to your view as well, Martin. Then again, as pi might have been equal to 1 prior to the Big Bang, I see no reason why sqrt(2) shouldn't have been equal to 1 as well. After all, in those days we were all one... Jim __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Derivation of data points
Dear All, I would like to make the derivation of a points. I tried to use D1tr (linear interpolation). I also tried to used D1ss (spline interpolation) but I do not realy know how to choose the smothing parameter the best. D1ss(x, y, xout = x, spar.offset = 0.1384, spl.spar=NULL) Here is an example of data I would like to derive library(sfsmisc) x-c(30:90) y-c(39.10111,39.71601,40.4367,41.11309,42.02203,42.96469,43.88154,44.72341,45.50918,46.29508,47.29949,48.30178,49.00582,49.7295,50.50255,51.24946,51.8912,52.49289,53.11462,53.61668,54.11853,54.61826,55.16866,55.70223,56.32028,57.10335,57.95425,58.9606,60.68077,61.2205,61.7642,62.51613,63.10644,64.12183,64.67105,66.62656,67.19005,68.16018,69.29873,69.64272,70.20944,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA) D1tr() D1ss(x, y, xout = x, spar.offset = 0.1384, spl.spar=NULL) D1ss(x, y, xout = x, spar.offset = 0.1384, spl.spar=NULL) Error in smooth.spline(x, y) : NA/NaN/Inf in foreign function call (arg 4) Is there a way to return NA for points where there is an NA value as input ? Could anyone give me some advices how to choose values for these spar.offset and spl.spar parameters ? Many thanks in advance, Jessica _ Jessica Gervais Tel: +352- 425991-628 Mail: [EMAIL PROTECTED] Resource Centre for Environmental Technologies, Public Research Centre Henri Tudor, Technoport Schlassgoart, 66 rue de Luxembourg, P.O. BOX 144, L-4002 Esch-sur-Alzette, Luxembourg __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] strange behaviour of is.factor()
Dear all, It appears that the function is.factor() returns different results when used inside the apply() function: that is, is.factor() fails to recognize a factor.. Where is the trick? many thanks, vito df1-data.frame(y=1:10,x=rnorm(10),g=factor(c(rep(A,6),rep(B,4 is.factor(df1[,1]) [1] FALSE is.factor(df1[,2]) [1] FALSE is.factor(df1[,3]) [1] TRUE is.factor(df1$g) [1] TRUE apply(df1,2,is.factor) y x g FALSE FALSE FALSE R.version _ platform i386-pc-mingw32 arch i386 os mingw32 system i386, mingw32 status major 2 minor 6.1 year 2007 month 11 day26 svn rev43537 language R version.string R version 2.6.1 (2007-11-26) -- Vito M.R. Muggeo Dip.to Sc Statist e Matem `Vianelli' Università di Palermo viale delle Scienze, edificio 13 90128 Palermo - ITALY tel: 091 6626240 fax: 091 485726/485612 __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] strange behaviour of is.factor()
vito muggeo wrote: Dear all, It appears that the function is.factor() returns different results when used inside the apply() function: that is, is.factor() fails to recognize a factor.. Where is the trick? many thanks, vito df1-data.frame(y=1:10,x=rnorm(10),g=factor(c(rep(A,6),rep(B,4 is.factor(df1[,1]) [1] FALSE is.factor(df1[,2]) [1] FALSE is.factor(df1[,3]) [1] TRUE is.factor(df1$g) [1] TRUE apply(df1,2,is.factor) y x g FALSE FALSE FALSE Well, apply works on matrices and arrays, hence df1 is coerced to a matrix, i.e. you invoked in fact the same as apply(as.matrix(df1), 2, is.factor) hence you get a matrix of character values which can be confirmed by apply(df1, 2, is.character) Anyway, what you really want is: sapply(df1, is.factor) Uwe Ligges R.version _ platform i386-pc-mingw32 arch i386 os mingw32 system i386, mingw32 status major 2 minor 6.1 year 2007 month 11 day26 svn rev43537 language R version.string R version 2.6.1 (2007-11-26) __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] things that are difficult/impossible to do in SAS or SPSS but simple in R
As far as i know mixture modelling (sums of exponentials) cant be done in SAS or SPSS. For R there is the Rmix package that while not very user friendly at least works. On Jan 15, 2008 8:45 PM, Matthew Keller [EMAIL PROTECTED] wrote: Hi all, I'm giving a talk in a few days to a group of psychology faculty and grad students re the R statistical language. Most people in my dept. use SAS or SPSS. It occurred to me that it would be nice to have a few concrete examples of things that are fairly straightforward to do in R but that are difficult or impossible to do in SAS or SPSS. However, it has been so long since I have used either of those commercial products that I am drawing a blank. I've searched the forums and web for a list and came up with just Bob Muenchen's comparison of general procedures and Patrick Burns' overview of the three. Neither of these give concrete examples of statistical problems that are easily solved in R but not the commercial packages. Can anyone more familiar with SAS or SPSS think of some examples of problems that they couldn't do in one of those packages but that could be done easily in R? Similarly, if there are any examples of the converse I would also be interested to know. Best, Matt -- Matthew C Keller Asst. Professor of Psychology University of Colorado at Boulder www.matthewckeller.com __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] plot labeling and expressions
Johannes Graumann wrote: Hi all, I'm trying to use an iteration that appends something to vector 'peaklabels' like so: peaklabelNames - append( peaklabelNames, substitute(i^{z+phantom()}* (*a*AMU),list(i=y2,z=2,a=0)) ) The vector is supposed to be used with 'text' to put labels on signals in an impulse plot. While not vectorized substitute(i^{z+phantom()}* (*a*AMU),list(i=y2,z=2,a=0)) works for me, the vectorized form doesn't. The labels are represented as y2^2 (AMU) (note the '' in the printed string). Can anyone please give me a hint on how to resolve this? I do not know what you mean by vectorized form. Can you give an example what you want to achieve and what you tried to do so? Uwe Ligges Thanks, Joh __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Quantile regression
I am trying to perform quantile regression analysis to analyse my work. I could install the R package in windows xp. Now I am struggling for the next work.I have *marks of students at the university examinations*( say response variable Y) and their *entrance examination marks* ( Independent one variable X ).I have entered data in Excel spread sheet as records. I will be thankful If one of you could help me how run the package to get the estimates , plots and significant tests.. I am a Sri Lankan MPhil student at . 1. Save your excel data as a comma separated value (csv) file. File - Save As... 2. Read the data into R examdata - read.csv(examdatafile.csv) 3. Install the quantreg package from CRAN Packages - Install packages... 4. Read the help page for the analysis function ?rq 5. Run the analysis model1 - rq(Y~X, data=examdata) 6. Examine the results summary(model1) Regards, Richie. Mathematical Sciences Unit HSL ATTENTION: This message contains privileged and confidential inform...{{dropped:20}} __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Analytical Optimization (Stat question)
Dear Experts, this is more a general stat question, I tried to ask in other places but had no luck with answers (expect one that suggested numerical instead of analytical optimization): The likelihood below is a mixture of two negative binomial distributions: P*f(n;x1,x2,E) + (1-P)*f(n;x3,x4,E) N and E are vectors of same length. I would like to find the fist derivatives with respect to x1,x2,x3,x4 and P (so that I can set them to zero and calculate a bayesian MLE by iterations according to David Draper's Bayesian Modeling, Inference and Prediction). Does anyone have a quick and dirty way? To avoid drawning in rather complicated math... Here's the transcription of the likelihood in S language: P*exp((lgamma(x1+N)))-(((lgamma(x1)+lfactorial(N))+log((1+(E/ x2))^x1)+log((1+(x2/E))^N)))+ (1-P)*exp((lgamma(x3+N)))-(((lgamma(x3)+lfactorial(N))+log((1+(E/ x4))^x3)+log((1+(x4/E))^N))) -- View this message in context: http://www.nabble.com/Analytical-Optimization-%28Stat-question%29-tp14878234p14878234.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] plot labeling and expressions
Uwe Ligges wrote: Johannes Graumann wrote: Hi all, I'm trying to use an iteration that appends something to vector 'peaklabels' like so: peaklabelNames - append( peaklabelNames, substitute(i^{z+phantom()}* (*a*AMU),list(i=y2,z=2,a=0)) ) The vector is supposed to be used with 'text' to put labels on signals in an impulse plot. While not vectorized substitute(i^{z+phantom()}* (*a*AMU),list(i=y2,z=2,a=0)) works for me, the vectorized form doesn't. The labels are represented as y2^2 (AMU) (note the '' in the printed string). Can anyone please give me a hint on how to resolve this? I do not know what you mean by vectorized form. Can you give an example what you want to achieve and what you tried to do so? Thanks for looking at this. The actual code looks something like this: peaklabelNames - c() for(i in sequence(10)){ peaklabelNames - append( peaklabelNames, substitute(i^{z+phantom()}* (*a*AMU),list(i=y2,z=2,a=0)) ) } and is than used after 'plot' as text(somex,somey,labels=peaklabelNames) That doesn't work as described above. Thanks for your time, Joh __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Installing one channel GUI
Hello, I'm trying to install oneChannelGui on my computer. For this purpose, I've tried to carefully follow the manual, and done the following: 1. I've installed the Affy power tools 2. I've installed TCL from http://www.activestate.com/Products/ActiveTcl/ (by following the link at the right side of the page, and installing activeTCL8.5.0.0) Nonetheless, when I try running the oneChannelGUI I get an error message starting off like this: Cannot find Tcl/Tk package BWidget. affylmGUI cannot continue. affylmGUI requires the Tcl/Tk extensions, BWidget and Tktable. You must have Tcl/Tk installed on your computer, not just the minimal Tcl/Tk installation which comes with R (for Windows). If you do have Tcl/Tk installed, including the extensions (e.g. using the ActiveTcl distribution in Windows), make sure that R can find the path to the Tcl library, e.g. C:\Tcl\lib (on Windows) or /usr/lib (on Linux/Unix) or /sw/lib on Mac OSX. This error message contains a reference to a FAQ for windows users (like myself): http://www.stats.ox.ac.uk/pub/R/rw-FAQ.html. However, this webpage does not come up. I have looked in the directory in which I installed TCL, and indeed I couldn't find any Bwidget and Tktable files; however, I don't know how to get them and haven't been able to find them on the web; moreover, I'm not sure how to set the path in R to recognize them. I'd be very grateful for any help, Thank you very much, Schraga Schwartz Department of Human Molecular Genetics and Biochemistry, Tel Aviv University Medical School, Tel Aviv 69978, Israel. Tel: +972-3-640 6894 email: [EMAIL PROTECTED] [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Different results in calculating SD of 2 numbers
At 11:32 16.01.2008, Jim Lemon wrote: (Ted Harding) wrote: On 16-Jan-08 08:45:04, Martin Maechler wrote: RM == Ron Michael [EMAIL PROTECTED] on Wed, 16 Jan 2008 00:14:56 -0800 (PST) writes: RM Hi all, RM Can anyone tell me why I am getting different results in calculating SD of 2 numbers ? (1.25-0.95)/2 RM [1] 0.15 sd(c(1.25, 0.95)) RM [1] 0.2121320 # why it is different from 0.15? because 1 is different from 2 ! If 2 was 1, than sqrt(2) == 1 as well, but actually I don't think the universe and we all would exist in that case Martin Maechler, ETH Of course we would!! -- Since FALSE implies X is TRUE for any X. But FALSE would also imply that X is FALSE, so you are entitled to your view as well, Martin. Then again, as pi might have been equal to 1 prior to the Big Bang, I see no reason why sqrt(2) shouldn't have been equal to 1 as well. After all, in those days we were all one... Jim Of course the question is off topic, but I like it. In my understanding mathematics is a theoretical model, that may or may not describe properly certain aspects of a reality. I cannot see, why a theoretical model should have any influence on our existence, as long as we don't apply it in an unreasonable way. To believe in our existence or to prove it is a totally different case. Heinz __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Automatic traceback
I would like to have an automatic traceback printed on error. Is there a way to do this? options(error=traceback) seems to print the previous error, not the current error. I'm guessing this is because the traceback is not set until the error handler is done running. options(error=traceback) stop(1) Error: 1 No traceback available stop(2) Error: 2 1: stop(1) stop(3) Error: 3 1: stop(2) I am using R version 2.6.0 (2007-10-03). -- Michael Hoffman __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Exact wilcoxon may differ in R and SPSS/StatXact (due to round off in the latter pair)
Dear R-users, If you use the exact Wilcoxon test in the coin package, I would like make you aware of that SPSS/StatXact MAY perform a round-off before doing their exact Wilcoxon-Mann-Whitney test (if you ever are unlucky enough not to use R). I have data from two treatments and was surprised to find that SPSS (15 under Windows) and R differed in their p-values (0.167 resp. 0.172). It turns out that SPSS rounds off an entry which is equal to -0.899 to -0.9 (thus producing a tie at this position). While the former entry probably is the result of some stupid algorithmic twist in some software (take your guesses), I think that wilcox_exact in the coin package is superior by not assuming that data are to be tied when deemed close enough by some poor defined measure (but I'm biased). Try wilcox_test(delta_hba1c~as.factor(Treatment), data=U, distribution=exact) And wilcox_test(signif(delta_hba1c,3)~as.factor(Treatment), data=U, distribution=exact) Thanks to Torsten Hothorn for discussing this with me and for producing such a neat package (together with Kurt Hornik, Mark A. van de Wiel and Achim Zeileis)! Cheers, Fredrik Nilsson. My data: U a data frame with Treatment;delta_hba1c 1;-1.7 2;-1.9 1;0 1;-1.9 1;-1 1;-1.2 2;-1.7 2;-1.6 1;-0.9 2;-3.5 2;-3.1 1;-1.6 2;-1.2 2;-3.8 2;-0.899 2;-1.4 2;-1.2 1;-1.3 1;-1.6 2;-1.8 1;-1.5 1;-0.7 2;-0.7 2;0 2;-1.8 1;-1.2 1;-0.3 1;-2 1;-2.3 2;-5 2;-1.3 1;-2.6 2;-1.4 2;-3.6 2;-5.6 1;-1.7 __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Automatic traceback
On Wed, 16 Jan 2008, Michael Hoffman wrote: I would like to have an automatic traceback printed on error. Is there a way to do this? options(error=traceback) seems to print the previous error, not the current error. I'm guessing this is because the traceback is not set until the error handler is done running. Yes. .Traceback is written immediately before the jump to toplevel, to allow e.g. try() to recover from the problem. options(error=traceback) stop(1) Error: 1 No traceback available stop(2) Error: 2 1: stop(1) stop(3) Error: 3 1: stop(2) I am using R version 2.6.0 (2007-10-03). There is a compact traceback printed automatically in non-interactive use, and you can turn that on by the following options 'showWarnCalls', 'showErrorCalls': a logical. Should warning and error messages show a summary of the call stack? By default error calls are shown in non-interactive sessions. -- Brian D. Ripley, [EMAIL PROTECTED] Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UKFax: +44 1865 272595 __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Question concerning pdfs
Thanks a lot - that gives the same result as the idea I had - only much easier. Rainer On Jan 16, 2008 12:18 PM, Dimitris Rizopoulos [EMAIL PROTECTED] wrote: I think you need: dx2 - exp(dx) dp2 - dp / dx2 sum(c(0, diff(dx2)) * dp2) I hope it helps. Best, Dimitris Dimitris Rizopoulos Ph.D. Student Biostatistical Centre School of Public Health Catholic University of Leuven Address: Kapucijnenvoer 35, Leuven, Belgium Tel: +32/(0)16/336899 Fax: +32/(0)16/337015 Web: http://med.kuleuven.be/biostat/ http://www.student.kuleuven.be/~m0390867/dimitris.htmhttp://www.student.kuleuven.be/%7Em0390867/dimitris.htm - Original Message - From: Rainer M Krug [EMAIL PROTECTED] To: r-help [EMAIL PROTECTED] Sent: Wednesday, January 16, 2008 10:34 AM Subject: [R] Question concerning pdfs Hi I have a dataset of absolute growth rates g ranging from close to 0 to around whatever of which I want to calculate a pdf. If I use density(g) the pdf will extend to below 0 so I logtransform g and do d - density(log(g)). Now I would like to transform this pdf back, i.e. d$x - exp(d$x) but what do I have to do with d$y? (below is a small example) Thanks for your help, Rainer g - exp(rnorm(100)) ## Just to generate the example data d - density(log(g)) dx - d$x dp - d$y sum(c(0, (diff(dx))) * dp) ## this is equal to one plot(dx, dp) dx2 - exp(dx) dp2 - ??? ## what should I do here? plot(dx2, dp2) ## what should I do here? sum(c(0, (diff(exp(dx2 * dp2)## this should be one sum( c(0, (diff(dx2))) * ( dp1 / c(1, (diff(exp(dx2 * c(0, (diff(dx1 ) ##This is obviously also one, but can I use this to define my dp2? i.e. dp2 - dp1 / c(1, (diff(exp(dx2 * c(0, (diff(dx1 ### __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Disclaimer: http://www.kuleuven.be/cwis/email_disclaimer.htm [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] help with reshaping data into long format (correct question)
try this: x[6, which(x[5,]==y)] - y levels(x$id) - c(levels(x$id)[drop=T], treat) x - x[-5,] x[5, id] - treat levels(x$id) - gsub(^ques, , levels(x$id)) x3 - as.data.frame(t(x[,-1])) names(x3) - x$id foo - function(x, ...) { tmp - as.numeric(as.character(unlist(x[,grep(_, names(x), value=T)]))) y - x[,c(disease, age, city, sex, treat)][rep(1,length(tmp)),] newdf - data.frame(y, quess=grep(_, names(x), value=T), value=tmp) return(newdf) } do.call(rbind, lapply(x4, foo)) On 15/01/2008, Tom Cohen [EMAIL PROTECTED] wrote: Dear list, I have the following data set id 1 2 3 4 5 6 7 8 9 10 disease a b c d e f g h i j age 23 40 32 34 25 32 22 35 29 21 cityNY LD NY SG NY LD VG SA LD SG sex 1 1 2 2 2 2 1 1 1 2 treat_a y y yy treat_b n n n n n n ques1_1 2 4 5 6 8 3 1 2 4 5 ques1_2 6 4 5 12 10 9 8 4 5 7 ques1_3 17 23 32 25 14 24 23 22 32 29 ques2_1 4 7 9 10 6 8 5 7 8 9 ques2_2 8 9 10 12 17 19 14 21 22 19 ques2_3 23 18 19 20 23 24 26 28 29 22 ques3_1 5 7 9 1 4 7 9 8 10 5 ques3_2 34 35 32 23 31 29 27 25 32 33 ques3_3 29 33 27 25 27 23 24 29 27 24 where the first row is the header row in a dataframe. First I want to merge the two variables treat_a and treat_b to a new variable called treat which will be given n if it's left blank in the variable treat_a and y if it's left blank in treat_b. The new data set will look like id 1 2 3 4 5 6 7 8 9 10 disease a b c d e f g h i j age 23 40 32 34 25 32 22 35 29 21 cityNY LD NY SG NY LD VG SA LD SG sex 1 1 2 2 2 2 1 1 1 2 treatn n n y y y n n y n ques1_1 2 4 5 6 8 3 1 2 4 5 ques1_2 6 4 5 12 10 9 8 4 5 7 ques1_3 17 23 32 25 14 24 23 22 32 29 ques2_1 4 7 9 10 6 8 5 7 8 9 ques2_2 8 9 10 12 17 19 14 21 22 19 ques2_3 23 18 19 20 23 24 26 28 29 22 ques3_1 5 7 9 1 4 7 9 8 10 5 ques3_2 34 35 32 23 31 29 27 25 32 33 ques3_3 29 33 27 25 27 23 24 29 27 24 Now I want to reshape the data in a long format with target output id disease age city sex treat ques ques_value 1 a 23 NY1 n 1_1 2 1 a 23 NY1 n 1_2 6 1 a 23 NY1 n 1_3 17 1 a 23 NY1 n 2_1 4 1 a 23 NY1 n 2_2 8 1 a 23 NY1 n 2_3 23 1 a 23 NY1 n 3_1 5 1 a 23 NY1 n 3_2 34 1 a 23 NY1 n 3_3 29 2 b 40 LD1 n 1 _1 4 2 b 40 LD1 n 1 _2 4 2 b 40 LD1 n 1 _3 23 2 b 40 LD1 n 2_1 7 2 b 40 LD1 n 2_2 9 2 b 40 LD1 n 2_3 18 2 b 40 LD1 n 3_1 7 2 b 40 LD1 n 3_2 35 2 b 40 LD1 n 3_3 33 .. .. .. 10 j 21 SG2 n 3_3 24 How can I do this in R? Thanks alot for any help, Tom - Jämför pris på flygbiljetter och hotellrum: http://shopping.yahoo.se/c-169901-resor-biljetter.html [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Henrique Dallazuanna Curitiba-Paraná-Brasil 25° 25' 40 S 49° 16' 22 O __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Automatic traceback
Prof Brian Ripley wrote: On Wed, 16 Jan 2008, Michael Hoffman wrote: I would like to have an automatic traceback printed on error. Is there a way to do this? There is a compact traceback printed automatically in non-interactive use, and you can turn that on by the following options 'showWarnCalls', 'showErrorCalls': a logical. Should warning and error messages show a summary of the call stack? By default error calls are shown in non-interactive sessions. Thanks, that is very helpful. Is there a way to get something slightly more verbose? -- Michael Hoffman __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] between sum of squares for clusters
Hello, how to compute the between sum of squares the for the clusters obtained by kmeans for the example below? I would like to compute the SSB-SSW based information measures for the clusters, as implemented in cclust, but I am getting an error message. Serguei x1,x2,x3,x4,x5,cl 1.3,0.2,-1.2,3.2,-2.5,1 1.3,-0.4,-1.2,2.8,-1.8,1 -1.4,-0.3,0.7,-0.9,0.5,2 -1,-0.6,1.3,-0.6,0.9,2 -1.4,-0.1,0.8,-0.5,1.1,2 -1,-0.6,0.9,-0.4,1.4,2 0.8,0.9,-1,0.3,-1.1,3 -1.4,-0.8,2.8,-1.1,1.1,4 -0.5,-0.3,-0.1,0.5,-0.3,5 -0.1,1,0,0.1,0.2,5 -0.1,-0.3,-0.4,-0.2,0.4,5 -1.4,2.8,0.7,-0.9,0.6,6 -1,1.8,0.6,-1,1.7,6 0.4,-0.4,0.9,-0.7,0.4,7 0.4,-0.4,0.8,-0.6,0.8,7 0.4,-0.6,0.7,-0.2,1,7 -1.4,1.9,0.6,-0.4,-0.2,8 -1.4,1.7,0.3,-0.4,-0.1,8 [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Graphical output: dials and meters for a dashboard?
Here is a quick and dirty function to do so (things can easily be changed to reflect preferences): [...] Thanks Greg, that's working fine and is a fabulous starting point. Much appreciated! Multiple dials can be created using par(mfrow= ... Or the my.symbols function from the TeachingDemos package. I see there are several ways of having multiple plots: split.screen, mfcol etc. I have now got multiple dials going using split.screen, but I was wondering, are all approaches to multiple plots effectively the same or do they have different merits? Is there an approach best suited to regularly updated displays? [[replacing trailing spam]] PJ __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Graphical output: dials and meters for a dashboard?
You can do a basic dial with something like this: Thanks Jim. After installing plotrix I still had a bit of trouble getting this to work and I don't (yet) know enough R to fix it: speedoplot(0.5,5,5,2,Speedoplot) Error in polygon(xv, yv, border = border, col = col, lty = lty, lwd = lwd) : plot.new has not been called yet But the error went away if I plotted something else first. Also the colour bands are skewed - but that may just be a side-effect of my other plot. and if you want something fancier, you can call a 3D renderer like POVRay: http://www.povray.org to render very realistic objects. Sounds interesting, but probably a bit overkill at this stage. Thanks again for coding up the dial! PJ __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Graphical output: dials and meters for a dashboard?
I'm new to R and am evaluating it to see whether it would be an appropriate tool to create a dashboard (a graphical statistical summary page). Could someone tell me if it is possible to display data as dials or meters. e.g. the four dials here: http://www.pentaho.com/images/snap_dashboard_1.png The question would why would you want to? You are trying to understand your data, not driving a race car or aeroplane. You might want to check out the books and writing of Stephen Few (http://www.perceptualedge.com) who makes this case powerfully and eloquently, and also suggests alternatives that are far more useful. Thanks for the pointers to Stephen Few's work. He has some good advice on dashboard design for monitoring real-time processes which is exactly what I'm doing. PJ __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Rprofile.site not executed?
It seems that my Rprofile.site file is not executed when I start R. To test this I included the following code in that file: .First - function(){ cat(\nWelcome at, date(), \n) flush.console() } When I start R the message above is not displayed. I am running R 2.6.1 (rgui.exe) under Vista Home Premium. The Rprofile.site is in the etc folder and the R_PROFILE variable has the value . I looked in the help (?Startup) but could not figure out what is wrong. Any suggestions? Thanks. FS __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] affylmGUI
I have been trying to use the package affylmGUI but keep getting the error message that it cannot find the package Bwidget. I have downloaded the activeTcl for Windows and installed it in the default location C:\Tcl. The problem still persists. I have also tried to copy the files from C:\Tcl\lib into the C:\Arquivos de programas\R\R-2.6.1\Tcl\lib but the problem still there. Any help would be greatly appreciated Marcos Pinho Instituto Nacional de Câncer Rio de Janeiro - Brasil Tel: 55-21-3233-1426 email: [EMAIL PROTECTED] [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Own classes in histogram
Hi, I try to make a histogram from a variable that contains the number of shoots from about 1000 individuals from a specific plant species (the range is 1-110). Those numbers are highly skewed to the right. My question is: how can I make my own classes with the lattice histogram? I tried it with breaks=c(0,5,10,15,20,25,110) but my 25-110-class is presented as one huge bin ranging from 25 to 110. Is there a way to plot this bin in equal size as the others? And how is it possible to change the annotation of the x-axis, let's say the last tick named 25? Thanks for any help! Regards, Denis __ Denis Aydin mailto:[EMAIL PROTECTED] Mittwoch, 16. Januar 2008, 14:56 __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Rprofile.site not executed?
Hi I am running under Windows XP using R2.6.1. I pasted your code in my Rprofile.site in the etc directory and it worked for me. All I can suugest is: 1. Check you really put it in the etc directory. (Do you have an old version of R somewhere ...?) 2. Is it really called Rprofile.site. (Not .RProfile.site?) 3. Is your Rprofile.site protected against read? Or the etc directory? Regards JS --- -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Fernando Saldanha Sent: 16 January 2008 14:00 To: R-help@r-project.org Subject: [R] Rprofile.site not executed? It seems that my Rprofile.site file is not executed when I start R. To test this I included the following code in that file: .First - function(){ cat(\nWelcome at, date(), \n) flush.console() } When I start R the message above is not displayed. I am running R 2.6.1 (rgui.exe) under Vista Home Premium. The Rprofile.site is in the etc folder and the R_PROFILE variable has the value . I looked in the help (?Startup) but could not figure out what is wrong. Any suggestions? Thanks. FS __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Non linear regression with 2 explanatory variables
hits=-2.6 tests=BAYES_00 X-USF-Spam-Flag: NO On Wed, 2008-01-16 at 11:02 +0100, Janice Kielbassa wrote: Hello! I want to do a non-linear regression with 2 explanatory variables (something like : length ~ a * time * exp( b* temperature)), having a data set (length, time, temperature). Which function could I use (I tried nls but I think it doesn't work) Janice, I'll start by saying I can't help you as I have never used nls() myself and I am not familiar with this type of analysis. Why do you think that nls() doesn't work? It is a widely used part of R and thus probably very well tested. My understanding of these things is that nls is a sophisticated tool that requires some effort on the part of the user, such as selecting appropriate starting values. You are unlikely to get any further assistance from the list unless you read the posting guide and post an example of what you did (preferably with the actual data or dummy data with the same properties if not) and the exact error message or output from R that lead you to believe that nls() did not work. HTH G Thanks a lot! Janice __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- %~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~% Dr. Gavin Simpson [t] +44 (0)20 7679 0522 ECRC, UCL Geography, [f] +44 (0)20 7679 0565 Pearson Building, [e] gavin.simpsonATNOSPAMucl.ac.uk Gower Street, London [w] http://www.ucl.ac.uk/~ucfagls/ UK. WC1E 6BT. [w] http://www.freshwaters.org.uk %~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~% __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Using a data frame to create a legend
If I understand your question: x - rnorm(100) plot(x) legend(topright, capture.output(t(t(summary(x) On 16/01/2008, Tom Snowden [EMAIL PROTECTED] wrote: Hi, I am currently in the process of translating a large script from S-Plus over to R. It's going well so far and all the high level stuff is working fine, but as they say 'the devil is in the details' and my low level stuff is struggling. Specifically, I have enountered a problem translating from key() to legend(); in splus I was able to create a tables of statistics (AUCs and averages that I had calculated earlier in the script) that lined up with the key using bits of script as simple as: key( text=list(temp.cd), text=list(temp.a), text=list(temp.b), text=list(temp.c), text=list(temp.d), text=list(temp.lab), lines=list(type=c(n, rep(o, length(temp.cd))), col=temp.COL, pch=temp.PCH), border=F, corner=c(1, 1), align=T, cex=0.9) It is not obvious to me how I would achieve something similar in R and any help would be greatly appreciated. Tom -- View this message in context: http://www.nabble.com/Using-a-data-frame-to-create-a-legend-tp14880656p14880656.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Henrique Dallazuanna Curitiba-Paraná-Brasil 25° 25' 40 S 49° 16' 22 O __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] affylmGUI
See, from a few hours ago: https://stat.ethz.ch/pipermail/r-help/2008-January/150493.html On Wed, 16 Jan 2008, Marcos Pinho wrote: I have been trying to use the package affylmGUI but keep getting the error message that it cannot find the package Bwidget. I have downloaded the activeTcl for Windows and installed it in the default location C:\Tcl. The problem still persists. I have also tried to copy the files from C:\Tcl\lib into the C:\Arquivos de programas\R\R-2.6.1\Tcl\lib but the problem still there. Any help would be greatly appreciated Marcos Pinho Instituto Nacional de Câncer Rio de Janeiro - Brasil Tel: 55-21-3233-1426 email: [EMAIL PROTECTED] [[alternative HTML version deleted]] -- Brian D. Ripley, [EMAIL PROTECTED] Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UKFax: +44 1865 272595__ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] how to calculate factor Scoring Coefficient s
Dear R users, Recently, I am learning by myself to do factor analysis with R. Could some one guide me how to calculate 'factor scoring coefficients' or obtain 'factor scores' with the results from principal( ) or factor.pa( ) function in psych package? In SAS, it can be done with option SCORE by PROC FACTOR procedure. Many Thanks. felix __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] R and Vista
Hello R users, I have been using R for a while on xp and have just updated my system to vista. Have encountered some problems... First and main problem is that i cannot make R recognize my own written functions by coping them into the Rprofile.site on the etc folder. For some reason, this very useful tool seems not to be working anymore. Could someone help?? Any other suggestion to make R start with my functions? Thanks a lot, Marcia -- View this message in context: http://www.nabble.com/R-and-Vista-tp14882350p14882350.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] R and Vista
On 1/16/2008 10:19 AM, marciarr wrote: Hello R users, I have been using R for a while on xp and have just updated my system to vista. Have encountered some problems... First and main problem is that i cannot make R recognize my own written functions by coping them into the Rprofile.site on the etc folder. For some reason, this very useful tool seems not to be working anymore. Could someone help?? Any other suggestion to make R start with my functions? What does the command R.home() print in an R session on your system? Can you add /etc/Rprofile.site to the end, and read the file? For example, on my system I see R.home() [1] F:\\R\\R-2.6.1 and see readLines(F:\\R\\R-2.6.1/etc/Rprofile.site) [1] # Things you might want to change [2] [3] # options(papersize=\a4\) [4] # options(editor=\notepad\) [ remaining lines deleted ] Duncan Murdoch __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Rprofile.site not executed?
I have exactly the same problem, just made the same question to the list 2 hours after you (your message was still not posted). Hope someone answers us! Fernando Saldanha wrote: It seems that my Rprofile.site file is not executed when I start R. To test this I included the following code in that file: .First - function(){ cat(\nWelcome at, date(), \n) flush.console() } When I start R the message above is not displayed. I am running R 2.6.1 (rgui.exe) under Vista Home Premium. The Rprofile.site is in the etc folder and the R_PROFILE variable has the value . I looked in the help (?Startup) but could not figure out what is wrong. Any suggestions? Thanks. FS __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- View this message in context: http://www.nabble.com/Rprofile.site-not-executed--tp14882869p14883245.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] exact method in coxph
I'm trying to estimate a cox proportional hazards regression for repeated events (in gap time) with time varying covariates. The dataset consists of just around 6000 observations (lines) (110 events). The (stylized) data look as follows: unit dur0 dur1 eventn event ongoing x 1 01 0 0 0 32.23 1 12 0 1 1 35.34 1 01 1 0 1 36.12 1 01 1 1 1 45.83 1 12 2 0 0 32.43 1 23 2 0 0 53.63 1 44 2 1 1 45.48 2 01 0 0 0 14.84 2 12 0 1 1 08.63 A complication here is that units can experience repeated events while previous events are still ongoing. I tried the following: cox1 - coxph( Surv( dur0, dur1, event) ~ strata(eventn) + x) This works fine under the breslow and efron method. However, since I have a fair number of ties, especially of repeated events while previous events are still ongoing, the exact method seems advisable. The help says that the exact method is computationally demanding, but even after days the computing it won't finish. Also, if I include a frailty-term, the exact method gives me results in no time. Is my setup incorrect? Many thanks in advance! - Julian Wucherpfennig PhD Student Political Science ETH Zurich - Swiss Federal Institute of Technology -- View this message in context: http://www.nabble.com/exact-method-in-coxph-tp14883387p14883387.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Rprofile.site not executed?
On 1/16/2008 8:59 AM, Fernando Saldanha wrote: It seems that my Rprofile.site file is not executed when I start R. To test this I included the following code in that file: .First - function(){ cat(\nWelcome at, date(), \n) flush.console() } When I start R the message above is not displayed. I am running R 2.6.1 (rgui.exe) under Vista Home Premium. The Rprofile.site is in the etc folder and the R_PROFILE variable has the value . That may be your problem. Having the value is different from not existing. Sys.getenv(R_PROFILE) will return in either case, but names(Sys.getenv()) will not show it if it doesn't exist. If this isn't your problem, then please try the advice I sent to Marcia a few minutes ago. Duncan Murdoch I looked in the help (?Startup) but could not figure out what is wrong. Any suggestions? Thanks. FS __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] R and Vista
On 1/16/2008 10:53 AM, Marcia Rocha wrote: Hello Duncan, Thank you for your answer. I get a very strange path on my R.home(): C:\\PROGRA~2\\R\\R-25~1.0 And the command readLines(C:\\PROGRA~2\\R\\R-25~1.0\etc\Rprofile.site) returns an Error (a syntax one, I triple checked the syntax...) Would you know what this means? The error is about the single backslashes (I used forward slashes, because that's what R uses internally), and the lack of quotes. You should try readLines(C:\\PROGRA~2\\R\\R-25~1.0/etc/Rprofile.site) However, I'm guessing based on your path that you're using R 2.5.x. I'd upgrade to 2.6.1 if you can; it has had some things fixed to deal with Vista. Duncan Murdoch Thank you agian, Marcia On Jan 16, 2008 4:36 PM, Duncan Murdoch [EMAIL PROTECTED] wrote: On 1/16/2008 10:19 AM, marciarr wrote: Hello R users, I have been using R for a while on xp and have just updated my system to vista. Have encountered some problems... First and main problem is that i cannot make R recognize my own written functions by coping them into the Rprofile.site on the etc folder. For some reason, this very useful tool seems not to be working anymore. Could someone help?? Any other suggestion to make R start with my functions? What does the command R.home() print in an R session on your system? Can you add /etc/Rprofile.site to the end, and read the file? For example, on my system I see R.home() [1] F:\\R\\R-2.6.1 and see readLines(F:\\R\\R-2.6.1/etc/Rprofile.site) [1] # Things you might want to change [2] [3] # options(papersize=\a4\) [4] # options(editor=\notepad\) [ remaining lines deleted ] Duncan Murdoch __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Non linear regression with 2 explanatory variables
Gavin Simpson wrote: hits=-2.6 tests=BAYES_00 X-USF-Spam-Flag: NO On Wed, 2008-01-16 at 11:02 +0100, Janice Kielbassa wrote: Hello! I want to do a non-linear regression with 2 explanatory variables (something like : length ~ a * time * exp( b* temperature)), having a data set (length, time, temperature). Which function could I use (I tried nls but I think it doesn't work) Janice, I'll start by saying I can't help you as I have never used nls() myself and I am not familiar with this type of analysis. maybe it helps if you have a look at Chapter 10 Nonlinear Models by Douglas M. Bates and John M. Chambers in: John M. Chambers, Trevor J. Hastie (Eds.): Statistical Models in S. Chapman Hall/CRC , 1992 Best, Roland __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Supressing error messages on try function
Hi! Why do I still get an error message on the try function?: options(show.error.messages = FALSE) trab -matrix(nrow=6,ncol=6) trab[,] -0.0001 rownames(trab) - c(A,B,C,D,E,I) colnames(trab) - c(A,B,C,D,E,I) indice - c(3,9,15,21,27,33) for (i in 1:6) { + indica -indice[i] + for (j in 0:5){ + # trabajo -na.remove(Servicio[,indica+j]) + trab[i,j+1] - try(pp.test(na.remove(Servicio[,indica+j]))$statistic,silent=TRUE)}} Hubo 35 avisos (use warnings() para verlos) trab A B C D A -91.0106940099417 -93.0801725394798 -75.4341204496035 -46.6207719226855 B -73.8492925425051 -70.5586282981188 -101.614988942500 -82.2714031040752 C -71.7670802564532 -68.4322642682006 -77.1019926591636 -70.0837841986902 D -46.0449172721826 Error in pp.test(na.remove(Servicio[, indica + j])) : \n Singularities in regression\n -61.4482431169745 -49.1104388262267 E -50.9585955273747 -52.3786516745925 -51.1000107610379 -51.1000107610379 I -83.0651877153614 -78.9250095794153 -87.0109510418216 -79.2108347154887 E I A -83.412702018264 -95.6741432416986 B -82.2770351988955 -76.0720393731655 C -80.2654629001921 -87.2121235599635 D -47.5290118476599 -46.9431100805296 E -47.923976815854 -51.0806358774243 I -82.9725166785599 -79.0824192946018 Thanks, Ignacio Perez Ph.D. IQuartil Ltda. Bogota, Colombia [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] replace numbers in a column conditional on their value
Dear R help, I have a data frame column in which I would like to replace some of the numbers dependent on their value. data frame = zz AveExpr t P.Value FC 7.481964 7.323950 1.778503e-04 2.218760 7.585783 12.233056 6.679776e-06 2.155867 6.953215 6.996525 2.353705e-04 1.685733 7.647513 8.099859 9.512639e-05 1.674742 7.285446 7.558675 1.463732e-04 1.584071 6.405605 3.344031 1.276812e-02 1.541569 I would like to replace the values in column 'FC' which are 2 with their squared value. If I do this, however, I get a warning but it does the sum correctly. Warning message: number of items to replace is not a multiple of replacement length in: zz[, 4][zz[, 4] 2] - zz[, 4]^2 Is there a way to do this without the warning? - [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] replace numbers in a column conditional on their value
Try something like, ##Untested zz$FC - ifelse(zz$FC 2, zz$FC^2, zz$FC) and see ?ifelse -Erik Iverson Jabez Wilson wrote: Dear R help, I have a data frame column in which I would like to replace some of the numbers dependent on their value. data frame = zz AveExpr t P.Value FC 7.481964 7.323950 1.778503e-04 2.218760 7.585783 12.233056 6.679776e-06 2.155867 6.953215 6.996525 2.353705e-04 1.685733 7.647513 8.099859 9.512639e-05 1.674742 7.285446 7.558675 1.463732e-04 1.584071 6.405605 3.344031 1.276812e-02 1.541569 I would like to replace the values in column 'FC' which are 2 with their squared value. If I do this, however, I get a warning but it does the sum correctly. Warning message: number of items to replace is not a multiple of replacement length in: zz[, 4][zz[, 4] 2] - zz[, 4]^2 Is there a way to do this without the warning? - [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Error in plot.new() : figure margins too large
Hi I am getting error : Error in plot.new() : figure margins too large Can you please help -code is temp - seq(550/2, 2200, 550/2) sV2 - c(1, 1+temp[-length(temp)]) eV2 - temp i=1 bitmap(paste(c:/vidhu/poster/poster_56half_2, LETTERS[i], .png, sep = ), png256,width = 55.5, height = 8.875, res = 300) par(mfrow = c(28,1), mar = c(0.5,3,0.5,0.5), mgp = c(2,0.65,0)) for(i in 1:length(sV2)) { cat(i = , i, \n, sep = ) if (i%%2) { pSL(sV2[i], eV2[i], 5)} } dev.off() windows() [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Problem with running installed package on Windows
Uwe, thanks for your response. The version of R was 2.6.1 and the version of the package is the most recent 2.2-13. As mentioned, it works fine on OS X but not on Windows XP. I will try using Rtools (from Duncan Murdoch's site) and install manually using the .zip file. Any other ideas? Your example works for me. Please read the posting guide that asks you to provide the following important information for us: Which version of R is this? Which version of the package? The recent version on CRAN master is: Package: clim.pact Version: 2.2-13 Date: January 10 2008 If you got another version, which mirror did you use (it might be outdated and someone will need to fix it, if you are using R=2.6.1)? Uwe Ligges James Ferguson wrote: Hello, I have installed the package clim.pact in R on both Mac OS X and Windows XP. Everything works fine on the Mac but in Windows, I have a problem when I try to execute some simple commands. I get this error: Error in gzfile(file, wb) : unable to open connection In addition: Warning message: In gzfile(file, wb) : cannot open compressed file 'data/eof_dnmi+_slp_90W60E-30N80N_Jan_mon.Rdata' It happens, for example, when I type in the commands data(DNMI.slp) followed by eof.1 - EOF(DNMI.slp,mon=1) but the problem is only in Windows. Does anyone have any advice for me? I installed the package simply through the software R using the drop down menus (i.e. I did NOT download a .zip file first). Thanks in advance for your help, James Ferguson, University of Victoria jcf at uvic dot ca __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] replace numbers in a column conditional on their value
I have a data frame column in which I would like to replace some of the numbers dependent on their value. data frame = zz AveExpr t P.Value FC 7.481964 7.323950 1.778503e-04 2.218760 7.585783 12.233056 6.679776e-06 2.155867 6.953215 6.996525 2.353705e-04 1.685733 7.647513 8.099859 9.512639e-05 1.674742 7.285446 7.558675 1.463732e-04 1.584071 6.405605 3.344031 1.276812e-02 1.541569 I would like to replace the values in column 'FC' which are 2 with their squared value. If I do this, however, I get a warning but it does the sum correctly. Warning message: number of items to replace is not a multiple of replacement length in: zz[, 4][zz[, 4] 2] - zz[, 4]^2 Try zz$FC[zz$FC 2] - (zz$FC[zz$FC 2])^2 Regards, Richie. Mathematical Sciences Unit HSL ATTENTION: This message contains privileged and confidential inform...{{dropped:20}} __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Problem with running installed package on Windows
On Wed, Jan 16, 2008 at 08:58:50AM -0800, James Ferguson wrote: Uwe, thanks for your response. The version of R was 2.6.1 and the version of the package is the most recent 2.2-13. As mentioned, it works fine on OS X but not on Windows XP. I will try using Rtools (from Duncan Murdoch's site) and install manually using the .zip file. Any other ideas? You don't need Rtools to install from the .zip file. .zip files are binary packages, only R is needed to install them: Rcmd install Rtools is only needed for compiling packages and/or R from source. Just before you start installing Rtools. Gabor -- Csardi Gabor [EMAIL PROTECTED]UNIL DGM __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] [PS] Different results in calculating SD of 2 numbers
And another problem, in addition to the points made by others, is that the formula for the SD gives a biased estimate (it underestimates it) of the population SD for small n when sampling from a normal distribution. When n is about twelve or so or more, the bias can usually be ignored (it is about 2.2%), but when you have only two numbers, the correction factor is about 1.25. The approximate correction formula, as I understand it, is (n-.75)/(n-1), so if n = 2, then it is 1.25/1, but this is not exact. The real formula is more complex (not difficult, but involves the gamma function) and my reference to it is not at this office, or I would give it. HTH, Ben -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Ron Michael Sent: Wednesday, January 16, 2008 2:15 AM To: [EMAIL PROTECTED] Subject: [PS] [R] Different results in calculating SD of 2 numbers Hi all, Can anyone tell me why I am getting different results in calculating SD of 2 numbers ? (1.25-0.95)/2 [1] 0.15 sd(c(1.25, 0.95)) [1] 0.2121320 # why it is different from 0.15? Regards, Send instant messages to your online friends http://uk.messenger.yahoo.com [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Halfing Kernels in Kernel Density?
hits=-2.5 tests=BAYES_00,FORGED_RCVD_HELO X-USF-Spam-Flag: NO Hello, I have got a question regarding the function density: Is there a way in R to half kernels or to use kernels which are heavily skewed to one side? My problem is as follows: I have a set of archaeological sites which are dated by coins (e. g. made in the reign of Hadrianus). However, normally, these coins give only the first possible date, but not the exact one. So, it is quite possible that the coin was struck in, say, 115 BC, but was hidden in 160 BC. Such an event is, of course, much more likely when the coin was still new. So, the chance that the coin got hidden lessened during the course of time. In order to take this fact in consideration, I would like to use only the right half of the, for example, gaussian kernel (or, alternatively, a heavily skewed kernel) when plotting the density of the coins. Is there a way to accomplish this in R? Any suggestions are much appreciated! Nils __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Own classes in histogram
Denis Aydin wrote: I try to make a histogram from a variable that contains the number of shoots from about 1000 individuals from a specific plant species (the range is 1-110). Those numbers are highly skewed to the right. My question is: how can I make my own classes with the lattice histogram? I tried it with breaks=c(0,5,10,15,20,25,110) but my 25-110-class is presented as one huge bin ranging from 25 to 110. Is there a way to plot this bin in equal size as the others? And how is it possible to change the annotation of the x-axis, let's say the last tick named 25? There may be a more elegant way to do this within 'hist', but you can create the binned data with hist and then plot it with 'barplot' to get even width bars: tmp1 - hist(your.data, breaks=c(0, 5, 10, 15, 20, 25, 110)) barplot(tmp1$counts, names.arg=c(0, 5, 10, 15, 20, 25, 25)) The names.arg list handles the x-axis labels, as you wished. - David Hewitt Virginia Institute of Marine Science http://www.vims.edu/fish/students/dhewitt/ -- View this message in context: http://www.nabble.com/Own-classes-in-%22histogram%22-tp14883184p14886370.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] degrees of freedom and random effects in lmer
Dear All, I used lmer for data with non-normally distributed error and both fixed and random effects. I tried to calculate a Type III sums of squares result, by I conducting likelihood ratio tests of the full model against a model reduced by one variable at a time (for each variable separately). These tests gave appropriate degrees of freedom for each of the two fixed effects, but when I left out one of two random effects (each random effect is a categorical variable with 5 and 8 levels, respectively) and tested that reduced model against the full model, output showed that the test degrees of freedom = 1, which was incorrect. Since I used an experimental design with spatial and temporal blocks-where I repeated the same experiment several times, with a different treatments in each spatial block each time (and with different combinations of individuals in each treatment)-I am now thinking that I should leave the random effects in the model no matter what (and only test for fixed effects). This leaves me with three related questions: 1. Why do Likelihood Ratio Tests of a full model against a model with one less random effect report the incorrect degrees of freedom? Are such tests treating each random variable as one combined entity? I can provide code and data if this would help. 2. In a publication, is it reasonable to report that I only tested models that included random effects? Do I need to report results of a test of significance of these random effects (i.e., I am not sure how or if I should include any information about the random effects in my ANOVA-type tables)? 3. If I should test for the significance of random effects, per se (and report these), is it more appropriate to simply fit models with and without random effects to see if the pattern of fixed effects is different? I can look at random effects using ranef(model_name), but this function does not assess their significance. I am not subscribed to this list, so if possible, please reply to me directly at [EMAIL PROTECTED] . Thank you for your time and help. Sincerely, Tracy Feldman [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Pause on graphics
My R script needs to pause or wait for a key or mouse on each graph. I used the following statement after each plot par(ask=TRUE) This works on Windows but not on MacOS. Is there any way to pause on graph in MacOS? Thanks, Vu [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Error in plot.new() : figure margins too large
I am getting error : Error in plot.new() : figure margins too large Can you please help -code is temp - seq(550/2, 2200, 550/2) sV2 - c(1, 1+temp[-length(temp)]) eV2 - temp i=1 bitmap(paste(c:/vidhu/poster/poster_56half_2, LETTERS[i], .png, sep = ), png256,width = 55.5, height = 8.875, res = 300) par(mfrow = c(28,1), mar = c(0.5,3,0.5,0.5), mgp = c(2,0.65,0)) for(i in 1:length(sV2)) { cat(i = , i, \n, sep = ) if (i%%2) { pSL(sV2[i], eV2[i], 5)} } dev.off() windows() The error indicates that when you have drawn the margins, there is no room for the plot. I suspect that this is because your bitmap is very wide, but you are using a column for the multiframe. Try par(mfrow=c(1,28)) instead. Regards, Richie. Mathematical Sciences Unit HSL ATTENTION: This message contains privileged and confidential inform...{{dropped:20}} __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Probability weights with density estimation
On Wed, 16 Jan 2008, David Winsemius wrote: I am a physician examining an NHANES dataset available at the NCHS website: http://www.cdc.gov/nchs/about/major/nhanes/nhanes2005-2006/demo_d.xpt http://www.cdc.gov/nchs/about/major/nhanes/nhanes2005-2006/hdl_d.xpt http://www.cdc.gov/nchs/about/major/nhanes/nhanes2005-2006/tchol_d.xpt Thank you to the R authors and the foreign package authors in particular. Importing from the SAS export fomat file was a snap. It consists of demographic data linked to laboratory measurements. Each subject has an associated sampling weight. I have gotten informative displays following the examples using kde2d() in VR MASSe2 (more thanks), but these were unweighted analyses. The ratio of total cholesterol (TC) to HDL cholesterol is used clinically to estimate risk of future heart disease, and I am looking at how such ratios divide or intersect with the TC x HDL-C distribution. Rather than include all the real data, let me just post a simulation that shows a contourplot reasonably similar to what I am seeing. TC.ran - exp(rnorm(400,1.5,.3)) HDL.ran - exp(rnorm(400,.4,.3) ) f1-kde2d(HDL.ran,TC.ran,n=25,lims=c(0,4,2,10)) contour(f1$x,f1$y,f1$z,ylim=c(0,8),xlim=c(0,3),ylab=TC mmol/L, xlab=HDL mmol/L) lines(f1$x,5*f1$x) # iso-ratio lines lines(f1$x,4*f1$x) lines(f1$x,3*f1$x) Two questions: Is there a 2d density estimation function that has provision for probability weights (or inverse sampling probabilities)? I seem to remember a discussion on the list about whether such a procedure would be meaningful, but my searches cannot locate that thread or any worked examples that incorporate sampling weights. It looks like you can use bkde2D from the KernSmooth package. You might look at the function sqlocpoly in surveyNG which uses the KernSmooth package for details. If there is such a function, would it be a simple matter to calculate the proportion of the total population that would be expected to have a ratio of y.ran/x.ran of less than a particular number, say 4.0? Maybe my eyesight is failing, but I did not see where you define 'y.ran' and 'x.ran'. If they, like 'TC.ran' and 'HDL.ran', are just variables that are dierctly measured in your survey, then estimating the proportion less than a given value for y.ran/x.ran is standard survey sampling fare and no density estimation is needed. In which case, the 'survey' package at CRAN is what you want. HTH, Chuck -- Respectfully; David Winsemius __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Charles C. Berry(858) 534-2098 Dept of Family/Preventive Medicine E mailto:[EMAIL PROTECTED] UC San Diego http://famprevmed.ucsd.edu/faculty/cberry/ La Jolla, San Diego 92093-0901 __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Can anyone help??
Hi, Im getting the following error when I attempt to read a csv file into R. I have the file saved on my C drive. Id really appreciate it if anyone can help My Command: survey - read.csv (file = C:\onlinesurvey.csv,head= TRUE, sep =,) Error: Error in file(file, r) : unable to open connection In addition: Warning messages: 1: '\o' is an unrecognized escape in a character string 2: unrecognized escape removed from C:\onlinesurvey.csv 3: In file(file, r) : cannot open file 'C:onlinesurvey.csv', reason 'No such file or directory' I have the file located on the C drive so I do not know why its telling me no such file or directiry. -- View this message in context: http://www.nabble.com/Can-anyone-help---tp14888245p14888245.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Can anyone help??
The problem is that the backslash character (i.e., the \ in C:\online) is used to separate folder names on MS Windows, but it's used for something else in R. Try survey - read.csv(file=file.path(C:, onlinesurvey.csv), head= TRUE, sep =,) -Ben p.s., As the posting guide instructs, please try to make your subject lines more descriptive than help or error. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of hoogeebear Sent: Wednesday, January 16, 2008 1:35 PM To: r-help@r-project.org Subject: [R] Can anyone help?? Hi, Im getting the following error when I attempt to read a csv file into R. I have the file saved on my C drive. Id really appreciate it if anyone can help My Command: survey - read.csv (file = C:\onlinesurvey.csv,head= TRUE, sep =,) Error: Error in file(file, r) : unable to open connection In addition: Warning messages: 1: '\o' is an unrecognized escape in a character string 2: unrecognized escape removed from C:\onlinesurvey.csv 3: In file(file, r) : cannot open file 'C:onlinesurvey.csv', reason 'No such file or directory' I have the file located on the C drive so I do not know why its telling me no such file or directiry. -- View this message in context: http://www.nabble.com/Can-anyone-help--- tp14888245p14888245.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting- guide.html and provide commented, minimal, self-contained, reproducible code. The information transmitted in this electronic communication is intended only for the person or entity to whom it is addressed and may contain confidential and/or privileged material. Any review, retransmission, dissemination or other use of or taking of any action in reliance upon this information by persons or entities other than the intended recipient is prohibited. If you received this information in error, please contact the Compliance HelpLine at 800-856-1983 and properly dispose of this information. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Can anyone help??
FAQ Q 7.8 rw-FAQ Q 2.16 should both help, as perhaps should the warning about unrecognized escape removed from C:\onlinesurvey.csv You need to use forward slashes or double the backslashes. On Wed, 16 Jan 2008, hoogeebear wrote: Hi, Im getting the following error when I attempt to read a csv file into R. I have the file saved on my C drive. Id really appreciate it if anyone can help My Command: survey - read.csv (file = C:\onlinesurvey.csv,head= TRUE, sep =,) sep = , is the default (the 'c' in csv stands for 'comma') Error: Error in file(file, r) : unable to open connection In addition: Warning messages: 1: '\o' is an unrecognized escape in a character string 2: unrecognized escape removed from C:\onlinesurvey.csv 3: In file(file, r) : cannot open file 'C:onlinesurvey.csv', reason 'No such file or directory' I have the file located on the C drive so I do not know why its telling me no such file or directiry. -- Brian D. Ripley, [EMAIL PROTECTED] Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UKFax: +44 1865 272595 __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Pause on graphics
Vu Nguyen a écrit : My R script needs to pause or wait for a key or mouse on each graph. I used the following statement after each plot par(ask=TRUE) This works on Windows but not on MacOS. Is there any way to pause on graph in MacOS? Thanks, Vu scan() should work __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Can anyone help??
Hi Guys, Thank you very much for the quick response. Adding the extra \ has fixed the errors. Thanks again, Regards, John. hoogeebear wrote: Hi, Im getting the following error when I attempt to read a csv file into R. I have the file saved on my C drive. Id really appreciate it if anyone can help My Command: survey - read.csv (file = C:\onlinesurvey.csv,head= TRUE, sep =,) Error: Error in file(file, r) : unable to open connection In addition: Warning messages: 1: '\o' is an unrecognized escape in a character string 2: unrecognized escape removed from C:\onlinesurvey.csv 3: In file(file, r) : cannot open file 'C:onlinesurvey.csv', reason 'No such file or directory' I have the file located on the C drive so I do not know why its telling me no such file or directiry. -- View this message in context: http://www.nabble.com/Can-anyone-help---tp14888245p14888280.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Pause on graphics
On 17/01/2008, at 6:46 AM, Vu Nguyen wrote: My R script needs to pause or wait for a key or mouse on each graph. I used the following statement after each plot par(ask=TRUE) This works on Windows but not on MacOS. Is there any way to pause on graph in MacOS? (1) Why do you set par(ask=TRUE) ***after each plot***??? It would seem to me to make more sense to set it ***once*** before commencing the sequence of plots. (2) par(ask=TRUE) appears to work just fine for me on MacOS: par(ask=TRUE) for(i in 1:3) plot(i:(10*i)) does exactly what I would expect. cheers, Rolf Turner ## Attention:\ This e-mail message is privileged and confid...{{dropped:9}} __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] replace numbers in a column conditional on their value
On 17/01/2008, at 5:45 AM, Jabez Wilson wrote: Dear R help, I have a data frame column in which I would like to replace some of the numbers dependent on their value. data frame = zz AveExpr t P.Value FC 7.481964 7.323950 1.778503e-04 2.218760 7.585783 12.233056 6.679776e-06 2.155867 6.953215 6.996525 2.353705e-04 1.685733 7.647513 8.099859 9.512639e-05 1.674742 7.285446 7.558675 1.463732e-04 1.584071 6.405605 3.344031 1.276812e-02 1.541569 I would like to replace the values in column 'FC' which are 2 with their squared value. If I do this, however, I get a warning but it does the sum correctly. Warning message: number of items to replace is not a multiple of replacement length in: zz[, 4][zz[, 4] 2] - zz[, 4]^2 Is there a way to do this without the warning? Other replies have suggested a better way to do this, but have not made it clear what you are doing wrong. The problem is that in your example you are effectively trying to replace 2 values with a vector of length 6 (i.e. zz[,4] ^2). This will use the first two values of the vector of length 6 to replace the two values that you've chosen to replace. This ``works'' in your example since your two values to be replaced come first in the column. But it *won't* work in general, warning message or no warning message. E.g. zz - data.frame(x=1:6,y=1:6,z=1:6,w=c(1,2,3,3,2,1)) zz x y z w 1 1 1 1 1 2 2 2 2 2 3 3 3 3 3 4 4 4 4 3 5 5 5 5 2 6 6 6 6 1 R zz[,4][zz[,4]2] - zz[,4]^2 Warning message: In zz[, 4][zz[, 4] 2] - zz[, 4]^2 : number of items to replace is not a multiple of replacement length zz x y z w 1 1 1 1 1 2 2 2 2 2 3 3 3 3 1 4 4 4 4 4 5 5 5 5 2 6 6 6 6 1 The two values (3rd and 4th) to be replaced got replaced by 1 and 4 --- the squares of the first two entries of the column. Moral of the story: ***DON'T SUPPRESS WARNINGS***!!! ***HEED THEM***!!! The use of ifelse that others have suggested is the right way to go. But you could do what you want using a syntax similar to that which you indeed used, but corrected as follows: zz - data.frame(x=1:6,y=1:6,z=1:6,w=c(1,2,3,3,2,1)) zz[,4][zz[,4]2] - zz[,4][zz[,4]2]^2 # See the difference? zz x y z w 1 1 1 1 1 2 2 2 2 2 3 3 3 3 9 4 4 4 4 9 5 5 5 5 2 6 6 6 6 1 cheers, Rolf Turner ## Attention:\ This e-mail message is privileged and confid...{{dropped:9}} __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Non linear regression with 2 explanatory variables
I have never had much success in using nls(). If you scan the archives you will find one or two postings from me on this topic. I have received no useful responses to these postings. I have found that anything that I tried (and failed) to do using nls() could be done quite easily using optim(). cheers, Rolf Turner On 17/01/2008, at 3:56 AM, Gavin Simpson wrote: hits=-2.6 tests=BAYES_00 X-USF-Spam-Flag: NO On Wed, 2008-01-16 at 11:02 +0100, Janice Kielbassa wrote: Hello! I want to do a non-linear regression with 2 explanatory variables (something like : length ~ a * time * exp( b* temperature)), having a data set (length, time, temperature). Which function could I use (I tried nls but I think it doesn't work) Janice, I'll start by saying I can't help you as I have never used nls() myself and I am not familiar with this type of analysis. Why do you think that nls() doesn't work? It is a widely used part of R and thus probably very well tested. My understanding of these things is that nls is a sophisticated tool that requires some effort on the part of the user, such as selecting appropriate starting values. ## Attention:\ This e-mail message is privileged and confid...{{dropped:9}} __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] R and Vista
Duncan Murdoch wrote: Thank you for your answer. I get a very strange path on my R.home(): C:\\PROGRA~2\\R\\R-25~1.0 And the command readLines(C:\\PROGRA~2\\R\\R-25~1.0\etc\Rprofile.site) returns an Error (a syntax one, I triple checked the syntax...) Would you know what this means? The error is about the single backslashes (I used forward slashes, because that's what R uses internally), and the lack of quotes. You should try readLines(C:\\PROGRA~2\\R\\R-25~1.0/etc/Rprofile.site) However, I'm guessing based on your path that you're using R 2.5.x. I'd upgrade to 2.6.1 if you can; it has had some things fixed to deal with Vista. There might be other problems: from her name and the paths she gave, she's probably brazilian or portuguese. Windows, in Portuguese, does a very stupid thing (not as stupid as spaces inside filenames, but a close second): it uses _accented_ characters in filenames and paths. And they are not standard. So there may be a filename conflict here. Alberto Monteiro __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Pause on graphics
Sorry, I meant par(ask=TRUE) before each plot. On MacOS, when I ran the my script, it did not wait for input at all. Only the last graph was remaining. Thanks, Vu - Original Message From: Rolf Turner [EMAIL PROTECTED] To: Vu Nguyen [EMAIL PROTECTED] Cc: R-help@r-project.org Sent: Wednesday, January 16, 2008 11:26:29 AM Subject: Re: [R] Pause on graphics On 17/01/2008, at 6:46 AM, Vu Nguyen wrote: My R script needs to pause or wait for a key or mouse on each graph. I used the following statement after each plot par(ask=TRUE) This works on Windows but not on MacOS. Is there any way to pause on graph in MacOS? (1) Why do you set par(ask=TRUE) ***after each plot***??? It would seem to me to make more sense to set it ***once*** before commencing the sequence of plots. (2) par(ask=TRUE) appears to work just fine for me on MacOS: par(ask=TRUE) for(i in 1:3) plot(i:(10*i)) does exactly what I would expect. cheers, Rolf Turner ## Attention:\ This e-mail message is privileged and confid...{{dropped:11}} __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Grouping data
Hi, I am quite new to R (but like it very much!), so please apologize if this is a too simple question. I have a large data frame consisting of data from a survey. There is, for example, information about age and education (a numeric value from 1-9). Now I would like to extract the total amount of each type of education within different age groups (e.g. from 18 to 25, from 25 to 35 etc.). How could I achieve this? (I have been thinking about using 'subset', but if there are better ideas they are welcome :) ) An example might clarify my point. Let's assume the following data: # age edu 1 25 2 2 33 5 3 22 3 4 19 1 5 21 3 6 30 4 7 32 4 8 31 1 What I want to have is: edu 18-25 25-35 ... 1 1 1 2 1 0 3 2 0 4 0 2 5 0 1 Thanks in advance kind regards, Kimmo __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Grouping data
Hi Kimmo, try cut() to create a factor with levels according to the range of values, and (among other options) table() to make the table. Cheers Andrew. On Wed, Jan 16, 2008 at 10:06:23PM +0200, K. Elo wrote: Hi, I am quite new to R (but like it very much!), so please apologize if this is a too simple question. I have a large data frame consisting of data from a survey. There is, for example, information about age and education (a numeric value from 1-9). Now I would like to extract the total amount of each type of education within different age groups (e.g. from 18 to 25, from 25 to 35 etc.). How could I achieve this? (I have been thinking about using 'subset', but if there are better ideas they are welcome :) ) An example might clarify my point. Let's assume the following data: # age edu 1 25 2 2 33 5 3 22 3 4 19 1 5 21 3 6 30 4 7 32 4 8 31 1 What I want to have is: edu 18-25 25-35 ... 1 1 1 2 1 0 3 2 0 4 0 2 5 0 1 Thanks in advance kind regards, Kimmo __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. -- Andrew Robinson Department of Mathematics and StatisticsTel: +61-3-8344-9763 University of Melbourne, VIC 3010 Australia Fax: +61-3-8344-4599 http://www.ms.unimelb.edu.au/~andrewpr http://blogs.mbs.edu/fishing-in-the-bay/ __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Grouping data
K. Elo wrote: Hi, I am quite new to R (but like it very much!), so please apologize if this is a too simple question. I have a large data frame consisting of data from a survey. There is, for example, information about age and education (a numeric value from 1-9). Now I would like to extract the total amount of each type of education within different age groups (e.g. from 18 to 25, from 25 to 35 etc.). How could I achieve this? (I have been thinking about using 'subset', but if there are better ideas they are welcome :) ) An example might clarify my point. Let's assume the following data: # age edu 1 25 2 2 33 5 3 22 3 4 19 1 5 21 3 6 30 4 7 32 4 8 31 1 What I want to have is: edu 18-25 25-35 ... 1 1 1 2 1 0 3 2 0 4 0 2 5 0 1 Thanks in advance kind regards, Kimmo See ?cut which will enable you to take a continuous vector and convert it into a factor based upon breakpoints. Use this combined with ?table which will give you a cross tabulation. Something along the lines of the following, presuming that your data is in a data frame called 'DF': with(DF, table(edu, cut(age, breaks = c(18, 25, 35 edu (18,25] (25,35] 1 1 1 2 1 0 3 2 0 4 0 2 5 0 1 Note the default symbology of the returned labels indicating whether or not the interval breakpoints are open or closed in each grouping. This is covered in the help for cut(). Pay attention to the 'include.lowest' and 'right' arguments. Note also the 'trick' of using with() here, so that the column names are evaluated within the *environment* of the dataframe. See ?with for more information there. HTH, Marc Schwartz __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Rmpi on Linux x86_64 GNU/Linux
I'm having trouble with R CMD INSTALL Rmpi_0.5-5.tar.gz --configure-args=~/lam lam is is installed locally. lamboot -d (or lamboot-d and also recon) works. make -k check from the lamtest suite passes all tests. Is this is problem with the -fPIC compiler as in the message? Should it be modified in the Makefile? Any help or comments are appreciated, thanks. * Installing to library '/u1/uaf/ogorman/R/x86_64-unknown-linux-gnu-library/2.6' * Installing *source* package 'Rmpi' ... checking for gcc... gcc checking for C compiler default output file name... a.out checking whether the C compiler works... yes checking whether we are cross compiling... no checking for suffix of executables... checking for suffix of object files... o checking whether we are using the GNU C compiler... yes checking whether gcc accepts -g... yes checking for gcc option to accept ISO C89... none needed Try to find mpi.h ... Found in /import/home/u1/uaf/ogorman/lam/include Try to find libmpi.so or libmpich.a checking for main in -lmpi... yes Try to find liblam.so ... checking for main in -llam... yes checking for openpty in -lutil... yes checking for main in -lpthread... yes configure: creating ./config.status config.status: creating src/Makevars ** libs gcc -std=gnu99 -I/usr/local/pkg/r/r-2.6.1/lib64/R/include -I/usr/local/pkg/r/r-2.6.1/lib64/R/include -DPACKAGE_NAME=\\ -DPACKAGE_TARNAME=\\ -DPACKAGE_VERSION=\\ -DPACKAGE_STRING=\\ -DPACKAGE_BUGREPORT=\\ -I/import/home/u1/uaf/ogorman/lam/include -DMPI2 -DLAM -fPIC -I/usr/local/include-fpic -g -O2 -c conversion.c -o conversion.o gcc -std=gnu99 -I/usr/local/pkg/r/r-2.6.1/lib64/R/include -I/usr/local/pkg/r/r-2.6.1/lib64/R/include -DPACKAGE_NAME=\\ -DPACKAGE_TARNAME=\\ -DPACKAGE_VERSION=\\ -DPACKAGE_STRING=\\ -DPACKAGE_BUGREPORT=\\ -I/import/home/u1/uaf/ogorman/lam/include -DMPI2 -DLAM -fPIC -I/usr/local/include-fpic -g -O2 -c internal.c -o internal.o gcc -std=gnu99 -I/usr/local/pkg/r/r-2.6.1/lib64/R/include -I/usr/local/pkg/r/r-2.6.1/lib64/R/include -DPACKAGE_NAME=\\ -DPACKAGE_TARNAME=\\ -DPACKAGE_VERSION=\\ -DPACKAGE_STRING=\\ -DPACKAGE_BUGREPORT=\\ -I/import/home/u1/uaf/ogorman/lam/include -DMPI2 -DLAM -fPIC -I/usr/local/include-fpic -g -O2 -c RegQuery.c -o RegQuery.o gcc -std=gnu99 -I/usr/local/pkg/r/r-2.6.1/lib64/R/include -I/usr/local/pkg/r/r-2.6.1/lib64/R/include -DPACKAGE_NAME=\\ -DPACKAGE_TARNAME=\\ -DPACKAGE_VERSION=\\ -DPACKAGE_STRING=\\ -DPACKAGE_BUGREPORT=\\ -I/import/home/u1/uaf/ogorman/lam/include -DMPI2 -DLAM -fPIC -I/usr/local/include-fpic -g -O2 -c Rmpi.c -o Rmpi.o gcc -std=gnu99 -shared -L/usr/local/lib64 -o Rmpi.so conversion.o internal.o RegQuery.o Rmpi.o -L/import/home/u1/uaf/ogorman/lam/lib -lmpi -llam -lutil -lpthread -fPIC /usr/lib64/gcc-lib/x86_64-suse-linux/3.3.3/../../../../x86_64-suse-linux/bin/ld: /import/home/u1/uaf/ogorman/lam/lib/libmpi.a(abort.o): relocation R_X86_64_32 can not be used when making a shared object; recompile with -fPIC /import/home/u1/uaf/ogorman/lam/lib/libmpi.a: could not read symbols: Bad value collect2: ld returned 1 exit status make: *** [Rmpi.so] Error 1 chmod: cannot access `/import/home/u1/uaf/ogorman/R/x86_64-unknown-linux-gnu-library/2.6/Rmpi/libs/*': No such file or directory ERROR: compilation failed for package 'Rmpi' ** Removing '/import/home/u1/uaf/ogorman/R/x86_64-unknown-linux-gnu-library/2.6/Rmpi' -- The struggle for today, is not altogether for today - it is for a vast future also. -- Abraham Linclon, December 3, 1861 __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Question concerning pdfs
You may want to look at the logspline package. It is another way of estimating densities and allows you to specify boundries on the domain of x. -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare [EMAIL PROTECTED] (801) 408-8111 -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Rainer M Krug Sent: Wednesday, January 16, 2008 2:35 AM To: r-help Subject: [R] Question concerning pdfs Hi I have a dataset of absolute growth rates g ranging from close to 0 to around whatever of which I want to calculate a pdf. If I use density(g) the pdf will extend to below 0 so I logtransform g and do d - density(log(g)). Now I would like to transform this pdf back, i.e. d$x - exp(d$x) but what do I have to do with d$y? (below is a small example) Thanks for your help, Rainer g - exp(rnorm(100)) ## Just to generate the example data d - density(log(g)) dx - d$x dp - d$y sum(c(0, (diff(dx))) * dp) ## this is equal to one plot(dx, dp) dx2 - exp(dx) dp2 - ??? ## what should I do here? plot(dx2, dp2) ## what should I do here? sum(c(0, (diff(exp(dx2 * dp2)## this should be one sum( c(0, (diff(dx2))) * ( dp1 / c(1, (diff(exp(dx2 * c(0, (diff(dx1 ) ##This is obviously also one, but can I use this to define my dp2? i.e. dp2 - dp1 / c(1, (diff(exp(dx2 * c(0, (diff(dx1 ### __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] color ranges on a 2D plot
useR's I am trying to color the points on a scatter plot (code below) with two colors. Red for values 0.5 -1.0 and blue for 0.0 - .49. Does anyone know a easy way to do this? x - runif(100, 0, 1) y - runif(100, 0, 1) plot(y ~ x, pch=16) Thanks, dxc13 -- View this message in context: http://www.nabble.com/color-ranges-on-a-2D-plot-tp14893457p14893457.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] using an element of an array as a new object
I would work with 2 different objects to be safe (you can rename the 2nd after everything works if you want). Try something like: filesBox2 - array( list(), dim(filesBox) ) filesBox2[4,1] - read.table(paste(dir2, filesBox[4,1], sep=), header = FALSE) . . . Hope this helps, -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare [EMAIL PROTECTED] (801) 408-8111 -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of ppaarrkk Sent: Wednesday, January 16, 2008 9:16 AM To: r-help@r-project.org Subject: [R] using an element of an array as a new object I have an array called filesBox. I want to take each element of the first column and assign a dataset to it. For example : filesBox[4,1] returns [1] fileR Then I want to assign fileR which exists as a text file to the R object fileR like this : filesBox[4,1] - read.table(paste(dir2, filesBox[4,1], sep=), header = FALSE) But this doesn't work because filesBox[4,1] is an element of an array but I want it as a new R (effectively) data frame. Any ideas please ? -- View this message in context: http://www.nabble.com/using-an-element-of-an-array-as-a-new-ob ject-tp14884435p14884435.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] using table function
Can you give a simple example. I am not clear on what you mean but table function in R console when you talk about two vectors. --- Ricardo Perrone [EMAIL PROTECTED] wrote: Hi, How to join two large vectors ordered, where one has the variable's levels and another has the frequencies, in way similar to that showing by table function in R console? and considering this two vectors how to use summary function to produce statistical informations like mean, sd, min, max and quartile? Thanks Ricardo Looking for last minute shopping deals? __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] outer on matrices / arrays
Check out: https://stat.ethz.ch/pipermail/r-help/2005-January/065085.html On Jan 16, 2008 3:59 PM, eariasca [EMAIL PROTECTED] wrote: Hi, I would like to evaluate a function f(x,y) taking two vectors as entries on all pairs of X rows and Y rows, where X and Y are n-by-p and m-by-p matrices respectively. Of course, I would like to avoid loops if possible, as the dataset I want to process is quite large. I was not able to find a combination of outer() and apply() to do this -- note that I am fairly new to R. Below is a simple example of what I would like to do -- for illustration purposes only, as I am not interested in this particular function. X = matrix(sample(1:3,size=15,replace=TRUE),5,3) Y = matrix(sample(1:3,size=10,replace=TRUE),5,3) f = function(x,y) { max(x/y) } A = matrix(0,5,5) for (i in 1:5) { for (j in 1:5) { A[i,j] = f(X[i,],Y[j,]) } } Thanks for your help. Ery Arias-Castro [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] To Share And To Invest In
THAT THEY MAY BE . . .. I am an insider who is an initiate into masking societies (masquerades) in West Africa. I am also an alumnus of the University of Alberta, Canada (1974). I have been engaged in research for over three decades on the causes, which prompted the remarks mentioned below among others. G. W. F. Hegel coined the concept of African stupidity. Lévy-Bruhl defined what he called pre-logical attitudes of the African. James Watson (2007 Nobel Prize winner in chemistry) remarked publicly that the African has a gene, which predisposed them to stupidity. I have discovered that, while the apparently derogatory or racist theories may not all be correct, they could not all be wrong either (if we ignored the racial politics about it, or considered the mater scientifically). Something unique is discoverable about the African mind, psyche, or the paradigm of their fundamental culture or attitudes. I do not believe that this makes them superior or inferior to other races. I also believe in common humanity; hence, what one may be tempted to consider purely Black attitudes is present in every culture at some levels. This means that everybody stands to benefit from the research, regardless of his or her race. I have set out some details on the mater on the following website sanctuary.salvationway.net I have been able to heal a modest number of persons (blacks and non-blacks) based on the understanding of the working of minds, psyche, spirit, or basic attitudes of human beings in general and Blacks in particular. I am neither asking for cash nor for any handouts or material benefits for myself. I invite you to come and share and to invest. Please visit our website at sanctuary.salvationway.net for details. Thank you for your attention. R. D. Hargaalga. ([EMAIL PROTECTED]) If you received this message in error, or would like to unsubscribe, please send a blank email to [EMAIL PROTECTED] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] color ranges on a 2D plot
You did not say what variable you want to be in the ranges to determine the colors, but try any of these to see if they do what you want: x - runif(100) y - runif(100) z - runif(100) plot(x,y, pch=16, col=ifelse( x 0.5, 'blue','red')) plot(x,y, pch=16, col=ifelse( y 0.5, 'blue','red')) plot(x,y, pch=16, col=ifelse( z 0.5, 'blue','red')) library(TeachingDemos) y[1] - 0.5 plot(x,y, pch=16, col='red,) clipplot( points(x,y,pch=16,col='blue'), ylim=c(0,0.5) ) The last one is probably overkill, but can give a nice effect with larger cex values. If none of those work for you, restate the question with better detail. Hope this helps, -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare [EMAIL PROTECTED] (801) 408-8111 -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of dxc13 Sent: Wednesday, January 16, 2008 1:35 PM To: r-help@r-project.org Subject: [R] color ranges on a 2D plot useR's I am trying to color the points on a scatter plot (code below) with two colors. Red for values 0.5 -1.0 and blue for 0.0 - .49. Does anyone know a easy way to do this? x - runif(100, 0, 1) y - runif(100, 0, 1) plot(y ~ x, pch=16) Thanks, dxc13 -- View this message in context: http://www.nabble.com/color-ranges-on-a-2D-plot-tp14893457p148 93457.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] color ranges on a 2D plot
dxc13 wrote: useR's I am trying to color the points on a scatter plot (code below) with two colors. Red for values 0.5 -1.0 and blue for 0.0 - .49. Does anyone know a easy way to do this? x- runif(100, 0, 1) y- runif(100, 0, 1) plot(y ~ x, pch=16) Thanks, dxc13 You did not specify if this is for just the 'x' values, the 'y' values, or both. If the latter, more than two colors might make sense. For just the 'x' values and two colors, the easiest might be something like: plot(x, y, col = ifelse(x = 0.5, red, blue)) Change 'x' to 'y' for the same on 'y'. Alternatively, you could do something like the following for coloring based upon both 'x' and 'y': cols - character(length(x)) xgt - x = 0.5 ygt - y = 0.5 cols[which(xgt ygt)] - black cols[which(!xgt ygt)] - red cols[which(xgt !ygt)] - blue cols[which(!xgt !ygt)] - green plot(x, y, col = cols, pch = 16) HTH, Marc Schwartz __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Can anyone help??
Try replacing '\' with '/' Regards, -Cody Cody Hamilton Edwards Lifesciences -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of hoogeebear Sent: Wednesday, January 16, 2008 10:35 AM To: r-help@r-project.org Subject: [R] Can anyone help?? Hi, Im getting the following error when I attempt to read a csv file into R. I have the file saved on my C drive. Id really appreciate it if anyone can help My Command: survey - read.csv (file = C:\onlinesurvey.csv,head= TRUE, sep =,) Error: Error in file(file, r) : unable to open connection In addition: Warning messages: 1: '\o' is an unrecognized escape in a character string 2: unrecognized escape removed from C:\onlinesurvey.csv 3: In file(file, r) : cannot open file 'C:onlinesurvey.csv', reason 'No such file or directory' I have the file located on the C drive so I do not know why its telling me no such file or directiry. -- View this message in context: http://www.nabble.com/Can-anyone-help---tp14888245p14888245.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Rmpi on Linux x86_64 GNU/Linux
On Wed, 16 Jan 2008, Brian O'Gorman wrote: I'm having trouble with R CMD INSTALL Rmpi_0.5-5.tar.gz --configure-args=~/lam lam is is installed locally. That's the problem. You need to build a shared library version, not a static version, to allow it to be compiled into shared objects. (--enable-shared --disable-static, as I recall.) Or at least ensure that your static library is PIC (add -fPIC to the compiler flags and rebuild from scratch). When you do, you may find that linking against some library (perhaps -lutil?) is missing, and you need to modify the Makefiles to include that. (Maybe the latest lam has that corrected: check it appears as a dependency of liblam.so.0.0.0.) You will also need to ensure the location you install is known to ldconfig or in LD_LIBRARY_PATH. I built Rmpi successfully on F8 last week, *provided* you only have the .x86_64 lam[-devel] RPMs installed and not also the .i386 ones (Rmpi looks in /usr/lib on x86_64 before /usr/lib64, which is incorrect). Just in case anyone else meets that quirk. (yum install will by default add both cputypes.) lamboot -d (or lamboot-d and also recon) works. make -k check from the lamtest suite passes all tests. Is this is problem with the -fPIC compiler as in the message? Should it be modified in the Makefile? Any help or comments are appreciated, thanks. [And please use R-devel for technical (non-R) programming questions.] * Installing to library '/u1/uaf/ogorman/R/x86_64-unknown-linux-gnu-library/2.6' * Installing *source* package 'Rmpi' ... checking for gcc... gcc checking for C compiler default output file name... a.out checking whether the C compiler works... yes checking whether we are cross compiling... no checking for suffix of executables... checking for suffix of object files... o checking whether we are using the GNU C compiler... yes checking whether gcc accepts -g... yes checking for gcc option to accept ISO C89... none needed Try to find mpi.h ... Found in /import/home/u1/uaf/ogorman/lam/include Try to find libmpi.so or libmpich.a checking for main in -lmpi... yes Try to find liblam.so ... checking for main in -llam... yes checking for openpty in -lutil... yes checking for main in -lpthread... yes configure: creating ./config.status config.status: creating src/Makevars ** libs gcc -std=gnu99 -I/usr/local/pkg/r/r-2.6.1/lib64/R/include -I/usr/local/pkg/r/r-2.6.1/lib64/R/include -DPACKAGE_NAME=\\ -DPACKAGE_TARNAME=\\ -DPACKAGE_VERSION=\\ -DPACKAGE_STRING=\\ -DPACKAGE_BUGREPORT=\\ -I/import/home/u1/uaf/ogorman/lam/include -DMPI2 -DLAM -fPIC -I/usr/local/include-fpic -g -O2 -c conversion.c -o conversion.o gcc -std=gnu99 -I/usr/local/pkg/r/r-2.6.1/lib64/R/include -I/usr/local/pkg/r/r-2.6.1/lib64/R/include -DPACKAGE_NAME=\\ -DPACKAGE_TARNAME=\\ -DPACKAGE_VERSION=\\ -DPACKAGE_STRING=\\ -DPACKAGE_BUGREPORT=\\ -I/import/home/u1/uaf/ogorman/lam/include -DMPI2 -DLAM -fPIC -I/usr/local/include-fpic -g -O2 -c internal.c -o internal.o gcc -std=gnu99 -I/usr/local/pkg/r/r-2.6.1/lib64/R/include -I/usr/local/pkg/r/r-2.6.1/lib64/R/include -DPACKAGE_NAME=\\ -DPACKAGE_TARNAME=\\ -DPACKAGE_VERSION=\\ -DPACKAGE_STRING=\\ -DPACKAGE_BUGREPORT=\\ -I/import/home/u1/uaf/ogorman/lam/include -DMPI2 -DLAM -fPIC -I/usr/local/include-fpic -g -O2 -c RegQuery.c -o RegQuery.o gcc -std=gnu99 -I/usr/local/pkg/r/r-2.6.1/lib64/R/include -I/usr/local/pkg/r/r-2.6.1/lib64/R/include -DPACKAGE_NAME=\\ -DPACKAGE_TARNAME=\\ -DPACKAGE_VERSION=\\ -DPACKAGE_STRING=\\ -DPACKAGE_BUGREPORT=\\ -I/import/home/u1/uaf/ogorman/lam/include -DMPI2 -DLAM -fPIC -I/usr/local/include-fpic -g -O2 -c Rmpi.c -o Rmpi.o gcc -std=gnu99 -shared -L/usr/local/lib64 -o Rmpi.so conversion.o internal.o RegQuery.o Rmpi.o -L/import/home/u1/uaf/ogorman/lam/lib -lmpi -llam -lutil -lpthread -fPIC /usr/lib64/gcc-lib/x86_64-suse-linux/3.3.3/../../../../x86_64-suse-linux/bin/ld: /import/home/u1/uaf/ogorman/lam/lib/libmpi.a(abort.o): relocation R_X86_64_32 can not be used when making a shared object; recompile with -fPIC /import/home/u1/uaf/ogorman/lam/lib/libmpi.a: could not read symbols: Bad value collect2: ld returned 1 exit status make: *** [Rmpi.so] Error 1 chmod: cannot access `/import/home/u1/uaf/ogorman/R/x86_64-unknown-linux-gnu-library/2.6/Rmpi/libs/*': No such file or directory ERROR: compilation failed for package 'Rmpi' ** Removing '/import/home/u1/uaf/ogorman/R/x86_64-unknown-linux-gnu-library/2.6/Rmpi' -- Brian D. Ripley, [EMAIL PROTECTED] Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UKFax: +44 1865 272595 __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting
Re: [R] things that are difficult/impossible to do in SAS or SPSS but simple in R
SAS has no facilities for date arithmetic and no easy way to build it yourself. In fact, that's the biggest problem with SAS: it stinks as a programming environment, so it's always much more difficult than it should be to do something new. As soon as you get away from the canned procs and have to write something of your own, SAS falls down. I don't know enough about SPSS to comment. -- Jeff __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Non linear regression with 2 explanatory variables
Dear Rolf, One thing that sometimes makes nls easier to apply is using the 'formula' argument like you would use the 'fn' argument of optim. That is, if you have a residual function that has arguments x, y, a, b and you need to optimize a and b, you would make a call like nls(~resid(x,y,a=astart, b=bstart), control = nls.control(warnOnly = TRUE, printEval = TRUE), start = list(a=astart, b=bstart)) This did not work easily before R-2.6.0, but does now. The Puromycin analysis from the help files is an example of this useage and below is another. Or do you already use nls this way and still have problems? # get data as a sum of exponentials dataSumOfExp - function(rates = seq(.05, .005, length=3), times = 1:100, amps = rep(1, length(rates))) { tfun - function(t,r) exp(-r*t) ## get C with tfun C - mapply(tfun, r=rates, MoreArgs=list(t=times)) ## add the columns of C with relative amplitudes 1, and add noise C %*% amps + rnorm( nrow(C) ) * max(C) * .1 } # residual function resFun - function(rates, amps, measured, times = 1:100) { tfun - function(t,r) exp(-r*t) CEst - mapply(tfun, r=rates, MoreArgs=list(t=times)) measured - CEst %*% amps } # get data measured - dataSumOfExp() # optimize rates of exponentials and their relative amplitudes res - nls(~resFun(rates = rates, measured = measured, amps = amps), control = nls.control(warnOnly = TRUE, printEval = TRUE), start = list(rates = c(.04, .1, .001), amps = rep(1,3)), trace = TRUE) summary(res) On Thu, 17 Jan 2008, Rolf Turner wrote: I have never had much success in using nls(). If you scan the archives you will find one or two postings from me on this topic. I have received no useful responses to these postings. I have found that anything that I tried (and failed) to do using nls() could be done quite easily using optim(). cheers, Rolf Turner On 17/01/2008, at 3:56 AM, Gavin Simpson wrote: hits=-2.6 tests=BAYES_00 X-USF-Spam-Flag: NO On Wed, 2008-01-16 at 11:02 +0100, Janice Kielbassa wrote: Hello! I want to do a non-linear regression with 2 explanatory variables (something like : length ~ a * time * exp( b* temperature)), having a data set (length, time, temperature). Which function could I use (I tried nls but I think it doesn't work) Janice, I'll start by saying I can't help you as I have never used nls() myself and I am not familiar with this type of analysis. Why do you think that nls() doesn't work? It is a widely used part of R and thus probably very well tested. My understanding of these things is that nls is a sophisticated tool that requires some effort on the part of the user, such as selecting appropriate starting values. ## Attention:\ This e-mail message is privileged and confid...{{dropped:9}} __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Problem with running installed package on Windows
Thanks for everyone's help - I figured out the problem, or at least some way of making the package work properly. I noticed that everything was OK if I logged in as administrator. Not sure why that might be. Regards from Victoria, James Ferguson On Wed, Jan 16, 2008 at 08:58:50AM -0800, James Ferguson wrote: Uwe, thanks for your response. The version of R was 2.6.1 and the version of the package is the most recent 2.2-13. As mentioned, it works fine on OS X but not on Windows XP. I will try using Rtools (from Duncan Murdoch's site) and install manually using the .zip file. Any other ideas? You don't need Rtools to install from the .zip file. .zip files are binary packages, only R is needed to install them: Rcmd install Rtools is only needed for compiling packages and/or R from source. Just before you start installing Rtools. Gabor -- Csardi Gabor [EMAIL PROTECTED]UNIL DGM __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] step-down bootstrap multiple comparisons in R?
I've been using SAS PROC MULTTEST to perform multiple comparisons on data that are not normally distributed by using the stepdown bootstrap procedures of Westfall and Young (1993). According to the SAS manual, the bootstrap method creates pseudo-data sets by sampling observations with replacement from each within-stratum pool of observations. An entire data set is thus created, and p-values for all tests are computed on this pseudo-data set. A counter records whether the minimum p-value from the pseudo-data set is less than or equal to the actual p-value for each base test. (If there are R tests, then there are R such counters.) This process is repeated a large number of times, and the proportion of resampled data sets where the minimum pseudo-p-value is less than or equal to an actual p-value is the adjusted p-value reported by PROC MULTTEST. The algorithms are described by Westfall and Young (1993). R has the MULTCOMP package for simultaneous tests and confidence intervals for general linear hypotheses in parametric models, but I'm wondering if any one has created a package or routine that would allow me calculate adjusted p-values in the non-parametric case. In particular, I'm looking for a way to re-create the stepdown bootstrap comparisons I performed with SAS using R. I've looked, but haven't figured out how to do it in yet with R. Thanks in advance for any insight! -greg Gregory Stewart, Ph.D. Manager of Scientific Computing The Evergreen State College Olympia, WA 98505 360-867-6909 [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] things that are difficult/impossible to do in SAS or SPSS but simple in R
-Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Jeffrey J. Hallman Sent: Wednesday, January 16, 2008 2:38 PM To: [EMAIL PROTECTED] Subject: Re: [R] things that are difficult/impossible to do in SAS or SPSS but simple in R SAS has no facilities for date arithmetic and no easy way to build it yourself. This is simply not true. SAS has all sorts of capabilities for doing arithmetic with dates, times and datetimes, including some very useful formats and functions for computing intervals. The original poster asked for suggestions of things that were difficult/impossible to do in SAS or SPSS with the goal of getting SAS/SPSS users to consider R. The only thing he would accomplish by making the above claim to that audience is a loss of credibility. In fact, that's the biggest problem with SAS: it stinks as a programming environment, so it's always much more difficult than it should be to do something new. As soon as you get away from the canned procs and have to write something of your own, SAS falls down. I don't know enough about SPSS to comment. -- Jeff Dan Daniel Nordlund Bothell, WA USA __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] things that are difficult/impossible to do in SAS or SPSS but simple in R
Factors have huge benefits over character data in SAS. For a series regulatory filings, I had miles of SAS code to compute KxK tables where all the cells must show up. For example, if one of the levels of one of the variables was never observed, the corresponding row or column would not show up in proc freq. The basic way around this was to get all possible combinations of the variables and assign each cell to have a row count of 0.0001. Then you would merge this data with the real counts. The missing row/columns would show up since they had data, but it was below the printing threshold of proc freq. Hoepfully, they have added a feature to do this. You can imagine how much work the test documents were for that macro. Contrast that with a simple call to the canned table function in R. And people think that SAS has an advantage when it comes to validation... Also, I always think about having a real programming language with namespaces, object-orientation, real functions, scoping, etc. This is very important and often under-recognized. For example, I've seen SAS macros called inside of SAS macros; this can be dangerous because the data lives in the same area and if two macros had a dataset with the same name the data would be over-written. -- Max __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] snow on OS X
Hi, I installed snow via R.app (from R 2.6.0) on OS X (10.4.11, Tiger), though I did not install Rmpi or Rsprng. My first question - has anybody installed Rsprng on OS X? The link from the CRAN package page seems to indicate that the sprng code was not installed rather than Rsprng not building. Second, I tried to create a cluster using the SOCKET option by doing cl - makeSOCKcluster(rep('localhost',2)) However, after issuing this, R just seems to hang. I have set up passwordless ssh, so that doing ssh localhost logs me into my machine without any password, so I'm not sure what the problem is Any pointers would be appreciated --- Rajarshi Guha [EMAIL PROTECTED] GPG Fingerprint: 0CCA 8EE2 2EEB 25E2 AB04 06F7 1BB9 E634 9B87 56EE --- ...but there was no one in it... - RG __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.